generisches Formular fuer Update und Add begonnen
This commit is contained in:
parent
e62f1fdd50
commit
a1c1b35b83
@ -13,12 +13,12 @@ public class DomainModule extends GenericModule {
|
|||||||
|
|
||||||
public DomainModule() {
|
public DomainModule() {
|
||||||
moduleConfig = new ModuleConfig("domain");
|
moduleConfig = new ModuleConfig("domain");
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "id", Long.class, "", true, true));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "id", Long.class, true, true));
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "name", String.class, ""));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "name", String.class));
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "user", String.class, ""));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "user", String.class));
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "pac", String.class, "", true));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "pac", String.class, true));
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "hive", String.class, "", true));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "hive", String.class, true));
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "since", Date.class, ""));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "since", Date.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -11,15 +11,15 @@ public class EMailAddressModule extends GenericModule {
|
|||||||
|
|
||||||
public EMailAddressModule() {
|
public EMailAddressModule() {
|
||||||
moduleConfig = new ModuleConfig("emailaddress");
|
moduleConfig = new ModuleConfig("emailaddress");
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "id", Long.class, "", true, true));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "id", Long.class, true, true));
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "emailaddress", String.class, ""));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "emailaddress", String.class));
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "localpart", String.class, "", true));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "localpart", String.class, true));
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "subdomain", String.class, "", true));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "subdomain", String.class, true));
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "domain", String.class, "", true));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "domain", String.class, true));
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "target", String.class, ""));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "target", String.class));
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "admin", String.class, "", true));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "admin", String.class, true));
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "pac", String.class, "", true));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "pac", String.class, true));
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "fulldomain", String.class, "", true));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "fulldomain", String.class, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -11,10 +11,10 @@ public class EMailAliasModule extends GenericModule {
|
|||||||
|
|
||||||
public EMailAliasModule() {
|
public EMailAliasModule() {
|
||||||
moduleConfig = new ModuleConfig("emailalias");
|
moduleConfig = new ModuleConfig("emailalias");
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "id", Long.class, "", true, true));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "id", Long.class, true, true));
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "name", String.class, ""));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "name", String.class));
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "target", String.class, ""));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "target", String.class));
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "pac", String.class, "", true));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "pac", String.class, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -6,17 +6,23 @@ import java.text.ParseException;
|
|||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.vaadin.data.Property;
|
import com.vaadin.data.Property;
|
||||||
|
import com.vaadin.terminal.ExternalResource;
|
||||||
import com.vaadin.terminal.Sizeable;
|
import com.vaadin.terminal.Sizeable;
|
||||||
import com.vaadin.terminal.ThemeResource;
|
import com.vaadin.terminal.ThemeResource;
|
||||||
import com.vaadin.ui.Button;
|
import com.vaadin.ui.Button;
|
||||||
import com.vaadin.ui.Component;
|
import com.vaadin.ui.Component;
|
||||||
|
import com.vaadin.ui.Form;
|
||||||
import com.vaadin.ui.HorizontalLayout;
|
import com.vaadin.ui.HorizontalLayout;
|
||||||
import com.vaadin.ui.Label;
|
import com.vaadin.ui.Label;
|
||||||
|
import com.vaadin.ui.Layout;
|
||||||
|
import com.vaadin.ui.Link;
|
||||||
import com.vaadin.ui.Table;
|
import com.vaadin.ui.Table;
|
||||||
|
import com.vaadin.ui.TextField;
|
||||||
import com.vaadin.ui.VerticalLayout;
|
import com.vaadin.ui.VerticalLayout;
|
||||||
import com.vaadin.ui.Window;
|
import com.vaadin.ui.Window;
|
||||||
import com.vaadin.ui.Button.ClickEvent;
|
import com.vaadin.ui.Button.ClickEvent;
|
||||||
@ -31,24 +37,92 @@ public abstract class GenericModule implements Serializable {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private static final DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT);
|
private static final DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT);
|
||||||
|
|
||||||
|
private VerticalLayout layout;
|
||||||
private Table table;
|
private Table table;
|
||||||
private MainApplication application;
|
private MainApplication application;
|
||||||
|
|
||||||
public void setApplication(MainApplication app) throws HsarwebException {
|
public void setApplication(MainApplication app) throws HsarwebException {
|
||||||
this.application = app;
|
application = app;
|
||||||
initTable();
|
initTable();
|
||||||
|
initLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract ModuleConfig getModuleConfig();
|
public abstract ModuleConfig getModuleConfig();
|
||||||
|
|
||||||
public Component getComponent() {
|
public Component getComponent() {
|
||||||
return table;
|
return layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reload() throws HsarwebException {
|
public void reload() throws HsarwebException {
|
||||||
loadTable();
|
loadTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initLayout() {
|
||||||
|
layout = new VerticalLayout();
|
||||||
|
layout.setSizeFull();
|
||||||
|
final ModuleConfig moduleConfig = getModuleConfig();
|
||||||
|
if (moduleConfig.isSearchAble() || moduleConfig.isAddAble()) {
|
||||||
|
HorizontalLayout toolbar = new HorizontalLayout();
|
||||||
|
if (moduleConfig.isAddAble()) {
|
||||||
|
Button btNew = new Button(moduleConfig.getLabel("new"));
|
||||||
|
ThemeResource icon = new ThemeResource("../runo/icons/16/document-add.png");
|
||||||
|
btNew.setIcon(icon);
|
||||||
|
btNew.addListener(new Button.ClickListener() {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private Window childWindow;
|
||||||
|
@Override
|
||||||
|
public void buttonClick(ClickEvent event) {
|
||||||
|
final Form form = createForm();
|
||||||
|
LocaleConfig localeConfig = application.getLocaleConfig();
|
||||||
|
childWindow = new Window(localeConfig.getText("new"));
|
||||||
|
childWindow.setWidth(640.0f, Sizeable.UNITS_PIXELS);
|
||||||
|
VerticalLayout vLayout = new VerticalLayout();
|
||||||
|
vLayout.setMargin(true);
|
||||||
|
vLayout.setSpacing(true);
|
||||||
|
vLayout.addComponent(form);
|
||||||
|
HorizontalLayout hLayout = new HorizontalLayout();
|
||||||
|
Button btSaveRow = new Button(localeConfig.getText("save"));
|
||||||
|
btSaveRow.addListener(new Button.ClickListener() {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
@Override
|
||||||
|
public void buttonClick(ClickEvent event) {
|
||||||
|
application.getMainWindow().removeWindow(childWindow);
|
||||||
|
try {
|
||||||
|
insertRow(form);
|
||||||
|
} catch (HsarwebException e) {
|
||||||
|
application.showUserException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Button btAbort = new Button(localeConfig.getText("abort"));
|
||||||
|
btAbort.addListener(new Button.ClickListener() {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
@Override
|
||||||
|
public void buttonClick(ClickEvent event) {
|
||||||
|
application.getMainWindow().removeWindow(childWindow);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
hLayout.addComponent(btSaveRow);
|
||||||
|
hLayout.addComponent(btAbort);
|
||||||
|
vLayout.addComponent(hLayout);
|
||||||
|
childWindow.setContent(vLayout);
|
||||||
|
childWindow.setModal(true);
|
||||||
|
application.getMainWindow().addWindow(childWindow);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
toolbar.addComponent(btNew);
|
||||||
|
}
|
||||||
|
// if (moduleConfig.isSearchAble()) {
|
||||||
|
// Button btSearch = new Button("search");
|
||||||
|
// toolbar.addComponent(btSearch);
|
||||||
|
// }
|
||||||
|
layout.addComponent(toolbar);
|
||||||
|
}
|
||||||
|
layout.addComponent(table);
|
||||||
|
layout.setExpandRatio(table, 1.0f);
|
||||||
|
layout.addComponent(new Link("Impressum", new ExternalResource("http://www.hostsharing.net/impressum")));
|
||||||
|
}
|
||||||
|
|
||||||
private void initTable() throws HsarwebException {
|
private void initTable() throws HsarwebException {
|
||||||
table = new Table() {
|
table = new Table() {
|
||||||
private static final long serialVersionUID = 35127658139420917L;
|
private static final long serialVersionUID = 35127658139420917L;
|
||||||
@ -79,12 +153,16 @@ public abstract class GenericModule implements Serializable {
|
|||||||
table.setColumnCollapsed(prop.getId(), true);
|
table.setColumnCollapsed(prop.getId(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (getModuleConfig().isUpdateAble()) {
|
||||||
table.addContainerProperty("edit", Button.class, null);
|
table.addContainerProperty("edit", Button.class, null);
|
||||||
table.setColumnWidth("edit", 16);
|
table.setColumnWidth("edit", 16);
|
||||||
table.setColumnHeader("edit", "");
|
table.setColumnHeader("edit", "");
|
||||||
|
}
|
||||||
|
if (getModuleConfig().isDeleteAble()) {
|
||||||
table.addContainerProperty("del", Button.class, null);
|
table.addContainerProperty("del", Button.class, null);
|
||||||
table.setColumnWidth("del", 16);
|
table.setColumnWidth("del", 16);
|
||||||
table.setColumnHeader("del", "");
|
table.setColumnHeader("del", "");
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new HsarwebException(e);
|
throw new HsarwebException(e);
|
||||||
}
|
}
|
||||||
@ -99,7 +177,14 @@ public abstract class GenericModule implements Serializable {
|
|||||||
for (Object row : ((Object[])callSearch)) {
|
for (Object row : ((Object[])callSearch)) {
|
||||||
long oid = -1L;
|
long oid = -1L;
|
||||||
if (row instanceof Map<?, ?>) {
|
if (row instanceof Map<?, ?>) {
|
||||||
Object[] itemData = new Object[propertyList.size()+2];
|
int numOfcolumns = propertyList.size();
|
||||||
|
if (getModuleConfig().isUpdateAble()) {
|
||||||
|
numOfcolumns++;
|
||||||
|
}
|
||||||
|
if (getModuleConfig().isDeleteAble()) {
|
||||||
|
numOfcolumns++;
|
||||||
|
}
|
||||||
|
Object[] itemData = new Object[numOfcolumns];
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
for (PropertyConfig prop : propertyList) {
|
for (PropertyConfig prop : propertyList) {
|
||||||
Object valueObject = ((Map<?, ?>) row).get(prop.getId());
|
Object valueObject = ((Map<?, ?>) row).get(prop.getId());
|
||||||
@ -127,10 +212,14 @@ public abstract class GenericModule implements Serializable {
|
|||||||
}
|
}
|
||||||
idx++;
|
idx++;
|
||||||
}
|
}
|
||||||
|
if (getModuleConfig().isUpdateAble()) {
|
||||||
itemData[idx] = createEditButton(oid);
|
itemData[idx] = createEditButton(oid);
|
||||||
idx++;
|
idx++;
|
||||||
|
}
|
||||||
|
if (getModuleConfig().isDeleteAble()) {
|
||||||
itemData[idx] = createDeleteButton(oid);
|
itemData[idx] = createDeleteButton(oid);
|
||||||
idx++;
|
idx++;
|
||||||
|
}
|
||||||
table.addItem(itemData, oid);
|
table.addItem(itemData, oid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -148,6 +237,40 @@ public abstract class GenericModule implements Serializable {
|
|||||||
loadTable();
|
loadTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateRow(Form form) throws HsarwebException {
|
||||||
|
Map<String, String> whereHash = new HashMap<String, String>();
|
||||||
|
whereHash.put(findIdKey(), ((Long) form.getData()).toString());
|
||||||
|
Map<String, String> setHash = new HashMap<String, String>();
|
||||||
|
Iterator<Component> componentIterator = form.getLayout().getComponentIterator();
|
||||||
|
while (componentIterator.hasNext()) {
|
||||||
|
Component c = componentIterator.next();
|
||||||
|
if (c instanceof TextField) {
|
||||||
|
TextField tf = (TextField) c;
|
||||||
|
Object data = tf.getData();
|
||||||
|
Object value = tf.getValue();
|
||||||
|
setHash.put((String) data, (String) value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
application.getRemote().callUpdate(getModuleConfig().getName(), setHash, whereHash);
|
||||||
|
loadTable();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void insertRow(Form form) throws HsarwebException {
|
||||||
|
Map<String, String> setHash = new HashMap<String, String>();
|
||||||
|
Iterator<Component> componentIterator = form.getLayout().getComponentIterator();
|
||||||
|
while (componentIterator.hasNext()) {
|
||||||
|
Component c = componentIterator.next();
|
||||||
|
if (c instanceof TextField) {
|
||||||
|
TextField tf = (TextField) c;
|
||||||
|
Object data = tf.getData();
|
||||||
|
Object value = tf.getValue();
|
||||||
|
setHash.put((String) data, (String) value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
application.getRemote().callAdd(getModuleConfig().getName(), setHash);
|
||||||
|
loadTable();
|
||||||
|
}
|
||||||
|
|
||||||
private String findIdKey() {
|
private String findIdKey() {
|
||||||
List<PropertyConfig> propertyList = getModuleConfig().getPropertyList();
|
List<PropertyConfig> propertyList = getModuleConfig().getPropertyList();
|
||||||
String idKey = null;
|
String idKey = null;
|
||||||
@ -162,16 +285,51 @@ public abstract class GenericModule implements Serializable {
|
|||||||
|
|
||||||
private Button createEditButton(long id) {
|
private Button createEditButton(long id) {
|
||||||
ThemeResource icon = new ThemeResource("../runo/icons/16/document-txt.png");
|
ThemeResource icon = new ThemeResource("../runo/icons/16/document-txt.png");
|
||||||
Button button = new Button();
|
final Button button = new Button();
|
||||||
button.setIcon(icon);
|
button.setIcon(icon);
|
||||||
button.setData(id);
|
button.setData(id);
|
||||||
button.setStyleName(BaseTheme.BUTTON_LINK);
|
button.setStyleName(BaseTheme.BUTTON_LINK);
|
||||||
button.addListener(new Button.ClickListener() {
|
button.addListener(new Button.ClickListener() {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
private Window childWindow;
|
||||||
@Override
|
@Override
|
||||||
public void buttonClick(ClickEvent event) {
|
public void buttonClick(ClickEvent event) {
|
||||||
// loadTable();
|
final Form form = createForm((Long) button.getData());
|
||||||
System.out.println("Data: " + event.getButton().getData());
|
LocaleConfig localeConfig = application.getLocaleConfig();
|
||||||
|
childWindow = new Window(getModuleConfig().getLabel("moduletitle") + " " + localeConfig.getText("update"));
|
||||||
|
childWindow.setWidth(640.0f, Sizeable.UNITS_PIXELS);
|
||||||
|
VerticalLayout vLayout = new VerticalLayout();
|
||||||
|
vLayout.setMargin(true);
|
||||||
|
vLayout.setSpacing(true);
|
||||||
|
vLayout.addComponent(form);
|
||||||
|
HorizontalLayout hLayout = new HorizontalLayout();
|
||||||
|
Button btSaveRow = new Button(localeConfig.getText("save"));
|
||||||
|
btSaveRow.addListener(new Button.ClickListener() {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
@Override
|
||||||
|
public void buttonClick(ClickEvent event) {
|
||||||
|
application.getMainWindow().removeWindow(childWindow);
|
||||||
|
try {
|
||||||
|
updateRow(form);
|
||||||
|
} catch (HsarwebException e) {
|
||||||
|
application.showUserException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Button btAbort = new Button(localeConfig.getText("abort"));
|
||||||
|
btAbort.addListener(new Button.ClickListener() {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
@Override
|
||||||
|
public void buttonClick(ClickEvent event) {
|
||||||
|
application.getMainWindow().removeWindow(childWindow);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
hLayout.addComponent(btSaveRow);
|
||||||
|
hLayout.addComponent(btAbort);
|
||||||
|
vLayout.addComponent(hLayout);
|
||||||
|
childWindow.setContent(vLayout);
|
||||||
|
childWindow.setModal(true);
|
||||||
|
application.getMainWindow().addWindow(childWindow);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return button;
|
return button;
|
||||||
@ -228,4 +386,50 @@ public abstract class GenericModule implements Serializable {
|
|||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Form createForm(Long key) {
|
||||||
|
try {
|
||||||
|
Map<String, String> where = new HashMap<String, String>();
|
||||||
|
where.put(findIdKey(), key.toString());
|
||||||
|
Object searchResult = application.getRemote().callSearch(getModuleConfig().getName(), where);
|
||||||
|
if (searchResult instanceof Object[]) {
|
||||||
|
Map<?, ?> row = (Map<?, ?>) (((Object[]) searchResult)[0]);
|
||||||
|
Form f = new Form();
|
||||||
|
f.setCaption(getModuleConfig().getLabel("update"));
|
||||||
|
f.setData(key);
|
||||||
|
Layout layout = f.getLayout();
|
||||||
|
for (PropertyConfig prop : getModuleConfig().getPropertyList()) {
|
||||||
|
if (!prop.isIdent()) {
|
||||||
|
TextField tf = new TextField(prop.getLabel());
|
||||||
|
tf.setData(prop.getId());
|
||||||
|
tf.setWidth(480.0f, Sizeable.UNITS_PIXELS);
|
||||||
|
Object value = row.get(prop.getId());
|
||||||
|
tf.setValue(value != null ? value : "");
|
||||||
|
layout.addComponent(tf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
} catch (HsarwebException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Form createForm() {
|
||||||
|
Form f = new Form();
|
||||||
|
f.setCaption(getModuleConfig().getLabel("new"));
|
||||||
|
Layout layout = f.getLayout();
|
||||||
|
for (PropertyConfig prop : getModuleConfig().getPropertyList()) {
|
||||||
|
if (!prop.isIdent()) {
|
||||||
|
TextField tf = new TextField(prop.getLabel());
|
||||||
|
tf.setData(prop.getId());
|
||||||
|
tf.setWidth(480.0f, Sizeable.UNITS_PIXELS);
|
||||||
|
tf.setValue("");
|
||||||
|
layout.addComponent(tf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,12 +14,12 @@ import org.jasig.cas.client.authentication.AuthenticationFilter;
|
|||||||
import org.jasig.cas.client.validation.Assertion;
|
import org.jasig.cas.client.validation.Assertion;
|
||||||
|
|
||||||
import com.vaadin.Application;
|
import com.vaadin.Application;
|
||||||
import com.vaadin.terminal.Sizeable;
|
|
||||||
import com.vaadin.terminal.Terminal;
|
import com.vaadin.terminal.Terminal;
|
||||||
import com.vaadin.terminal.ThemeResource;
|
import com.vaadin.terminal.ThemeResource;
|
||||||
import com.vaadin.terminal.gwt.server.HttpServletRequestListener;
|
import com.vaadin.terminal.gwt.server.HttpServletRequestListener;
|
||||||
import com.vaadin.ui.Component;
|
import com.vaadin.ui.Component;
|
||||||
import com.vaadin.ui.TabSheet;
|
import com.vaadin.ui.TabSheet;
|
||||||
|
import com.vaadin.ui.VerticalLayout;
|
||||||
import com.vaadin.ui.Window;
|
import com.vaadin.ui.Window;
|
||||||
import com.vaadin.ui.TabSheet.SelectedTabChangeEvent;
|
import com.vaadin.ui.TabSheet.SelectedTabChangeEvent;
|
||||||
import com.vaadin.ui.TabSheet.Tab;
|
import com.vaadin.ui.TabSheet.Tab;
|
||||||
@ -45,9 +45,12 @@ public class MainApplication extends Application implements HttpServletRequestLi
|
|||||||
localeConfig = new LocaleConfig(Locale.getDefault(), "main");
|
localeConfig = new LocaleConfig(Locale.getDefault(), "main");
|
||||||
remote = new Remote(this);
|
remote = new Remote(this);
|
||||||
Window mainWindow = new Window(localeConfig.getText("applicationtitle"));
|
Window mainWindow = new Window(localeConfig.getText("applicationtitle"));
|
||||||
|
VerticalLayout verticalLayout = new VerticalLayout();
|
||||||
|
verticalLayout.setSizeFull();
|
||||||
TabSheet tabs = new TabSheet();
|
TabSheet tabs = new TabSheet();
|
||||||
tabs.setWidth(100.0f, Sizeable.UNITS_PERCENTAGE);
|
tabs.setSizeFull();
|
||||||
tabs.setHeight(200.0f, Sizeable.UNITS_PERCENTAGE);
|
// tabs.setWidth(95.0f, Sizeable.UNITS_PERCENTAGE);
|
||||||
|
// tabs.setHeight(95.0f, Sizeable.UNITS_PERCENTAGE);
|
||||||
String modulesParamString = getContextParam("hsarmodules");
|
String modulesParamString = getContextParam("hsarmodules");
|
||||||
modules = new HashMap<String, GenericModule>();
|
modules = new HashMap<String, GenericModule>();
|
||||||
GenericModule firstModule = null;
|
GenericModule firstModule = null;
|
||||||
@ -67,7 +70,8 @@ public class MainApplication extends Application implements HttpServletRequestLi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
tabs.addListener(this);
|
tabs.addListener(this);
|
||||||
mainWindow.addComponent(tabs);
|
verticalLayout.addComponent(tabs);
|
||||||
|
mainWindow.setContent(verticalLayout);
|
||||||
setMainWindow(mainWindow);
|
setMainWindow(mainWindow);
|
||||||
setErrorHandler(new Terminal.ErrorListener() {
|
setErrorHandler(new Terminal.ErrorListener() {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
@ -13,14 +13,18 @@ public class QueueTaskModule extends GenericModule {
|
|||||||
|
|
||||||
public QueueTaskModule() {
|
public QueueTaskModule() {
|
||||||
moduleConfig = new ModuleConfig("q");
|
moduleConfig = new ModuleConfig("q");
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "id", Long.class, "", true, true));
|
moduleConfig.setUpdateAble(false);
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "title", String.class, ""));
|
moduleConfig.setDeleteAble(false);
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "status", String.class, ""));
|
moduleConfig.setAddAble(false);
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "started", Date.class, ""));
|
moduleConfig.setSearchAble(false);
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "finished", Date.class, ""));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "id", Long.class, true, true));
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "user", String.class, "", true));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "title", String.class));
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "details", String.class, "", true));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "status", String.class));
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "exception", String.class, "", true));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "started", Date.class));
|
||||||
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "finished", Date.class));
|
||||||
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "user", String.class, true));
|
||||||
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "details", String.class, true));
|
||||||
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "exception", String.class, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -21,20 +21,41 @@ public class Remote {
|
|||||||
return xmlrpcCall(module, "search", where);
|
return xmlrpcCall(module, "search", where);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void callAdd(String module, Map<String, String> set) throws HsarwebException {
|
||||||
|
xmlrpcCall(module, "add", set);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void callUpdate(String module, Map<String, String> set, Map<String, String> where) throws HsarwebException {
|
||||||
|
xmlrpcCall(module, "update", set, where);
|
||||||
|
}
|
||||||
|
|
||||||
public void callDelete(String module, Map<String, String> where) throws HsarwebException {
|
public void callDelete(String module, Map<String, String> where) throws HsarwebException {
|
||||||
xmlrpcCall(module, "delete", where);
|
xmlrpcCall(module, "delete", where);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object xmlrpcCall(String module, String operation, Map<String, String> where) throws HsarwebException {
|
private Object xmlrpcCall(String module, String operation, Map<String, String> param1) throws HsarwebException {
|
||||||
Object[] params = new Object[3];
|
Object[] params = new Object[3];
|
||||||
params[0] = app.getLogin();
|
params[0] = app.getLogin();
|
||||||
params[1] = app.getProxyTicket();
|
params[1] = app.getProxyTicket();
|
||||||
params[2] = where;
|
params[2] = param1;
|
||||||
Object res;
|
return xmlrpcCall(module + "." + operation, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Object xmlrpcCall(String module, String operation, Map<String, String> param1, Map<String, String> param2) throws HsarwebException {
|
||||||
|
Object[] params = new Object[4];
|
||||||
|
params[0] = app.getLogin();
|
||||||
|
params[1] = app.getProxyTicket();
|
||||||
|
params[2] = param1;
|
||||||
|
params[3] = param2;
|
||||||
|
return xmlrpcCall(module + "." + operation, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Object xmlrpcCall(String operation, Object[] params) throws HsarwebException {
|
||||||
|
Object res = null;
|
||||||
try {
|
try {
|
||||||
res = getClient().execute(module + "." + operation, params);
|
res = getClient().execute(operation, params);
|
||||||
} catch (XmlRpcException e) {
|
} catch (XmlRpcException e) {
|
||||||
throw new HsarwebException("error in remote server call", e);
|
throw new HsarwebException(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -11,15 +11,24 @@ public class UnixUserModule extends GenericModule {
|
|||||||
|
|
||||||
public UnixUserModule() {
|
public UnixUserModule() {
|
||||||
moduleConfig = new ModuleConfig("user");
|
moduleConfig = new ModuleConfig("user");
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "id", Long.class, "", true, true));
|
PropertyConfig propId = new PropertyConfig(moduleConfig, "id", Long.class, true, true);
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "name", String.class, ""));
|
moduleConfig.addProperty(propId);
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "comment", String.class, ""));
|
PropertyConfig propUserId = new PropertyConfig(moduleConfig, "userid", Long.class, true);
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "shell", String.class, ""));
|
moduleConfig.addProperty(propUserId);
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "userid", Long.class, "", true));
|
PropertyConfig propUserName = new PropertyConfig(moduleConfig, "name", String.class);
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "homedir", String.class, "", true));
|
moduleConfig.addProperty(propUserName);
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "pac", String.class, "", true));
|
PropertyConfig propUserComment = new PropertyConfig(moduleConfig, "comment", String.class);
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "quota_softlimit", Long.class, "", true));
|
moduleConfig.addProperty(propUserComment);
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "quota_hardlimit", Long.class, "", true));
|
PropertyConfig propShell = new PropertyConfig(moduleConfig, "shell", String.class);
|
||||||
|
moduleConfig.addProperty(propShell);
|
||||||
|
PropertyConfig propHomeDir = new PropertyConfig(moduleConfig, "homedir", String.class, true);
|
||||||
|
moduleConfig.addProperty(propHomeDir);
|
||||||
|
PropertyConfig propPacket = new PropertyConfig(moduleConfig, "pac", String.class, true);
|
||||||
|
moduleConfig.addProperty(propPacket);
|
||||||
|
PropertyConfig propSoftQuota = new PropertyConfig(moduleConfig, "quota_softlimit", Long.class, true);
|
||||||
|
moduleConfig.addProperty(propSoftQuota);
|
||||||
|
PropertyConfig propHardQuota = new PropertyConfig(moduleConfig, "quota_hardlimit", Long.class, true);
|
||||||
|
moduleConfig.addProperty(propHardQuota);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2,8 +2,10 @@ package de.hsadmin.web.config;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class ModuleConfig implements Serializable {
|
public class ModuleConfig implements Serializable {
|
||||||
|
|
||||||
@ -11,12 +13,22 @@ public class ModuleConfig implements Serializable {
|
|||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
private List<PropertyConfig> propertyList;
|
private List<PropertyConfig> propertyList;
|
||||||
|
private Map<String, PropertyConfig> propertyMap;
|
||||||
private LocaleConfig localeConfig;
|
private LocaleConfig localeConfig;
|
||||||
|
private boolean deleteAble;
|
||||||
|
private boolean updateAble;
|
||||||
|
private boolean addAble;
|
||||||
|
private boolean searchAble;
|
||||||
|
|
||||||
public ModuleConfig(String name) {
|
public ModuleConfig(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
propertyList = new ArrayList<PropertyConfig>();
|
propertyList = new ArrayList<PropertyConfig>();
|
||||||
|
propertyMap = new HashMap<String, PropertyConfig>();
|
||||||
localeConfig = new LocaleConfig(Locale.getDefault(), name);
|
localeConfig = new LocaleConfig(Locale.getDefault(), name);
|
||||||
|
addAble = true;
|
||||||
|
updateAble = true;
|
||||||
|
deleteAble = true;
|
||||||
|
searchAble = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
@ -24,15 +36,52 @@ public class ModuleConfig implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addProperty(PropertyConfig property) {
|
public void addProperty(PropertyConfig property) {
|
||||||
this.propertyList.add(property);
|
propertyList.add(property);
|
||||||
|
propertyMap.put(property.getId(), property);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PropertyConfig> getPropertyList() {
|
public List<PropertyConfig> getPropertyList() {
|
||||||
return propertyList;
|
return propertyList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PropertyConfig getProperty(String id) {
|
||||||
|
return propertyMap.get(id);
|
||||||
|
}
|
||||||
|
|
||||||
public String getLabel(String key) {
|
public String getLabel(String key) {
|
||||||
return localeConfig.getText(key);
|
return localeConfig.getText(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isDeleteAble() {
|
||||||
|
return deleteAble;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isUpdateAble() {
|
||||||
|
return updateAble;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAddAble() {
|
||||||
|
return addAble;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSearchAble() {
|
||||||
|
return searchAble;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeleteAble(boolean deleteAble) {
|
||||||
|
this.deleteAble = deleteAble;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdateAble(boolean updateAble) {
|
||||||
|
this.updateAble = updateAble;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAddAble(boolean addAble) {
|
||||||
|
this.addAble = addAble;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSearchAble(boolean searchAble) {
|
||||||
|
this.searchAble = searchAble;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,29 +13,29 @@ public class PropertyConfig implements Serializable {
|
|||||||
private boolean hidden;
|
private boolean hidden;
|
||||||
private boolean ident;
|
private boolean ident;
|
||||||
|
|
||||||
public PropertyConfig(ModuleConfig moduleConfig, String id, Class<?> clasz, String defaultValue) {
|
public PropertyConfig(ModuleConfig moduleConfig, String id, Class<?> clasz) {
|
||||||
this.moduleConfig = moduleConfig;
|
this.moduleConfig = moduleConfig;
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.type = clasz;
|
this.type = clasz;
|
||||||
this.defaultValue = defaultValue;
|
this.defaultValue = "";
|
||||||
this.setHidden(false);
|
this.setHidden(false);
|
||||||
this.setIdent(false);
|
this.setIdent(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PropertyConfig(ModuleConfig moduleConfig, String id, Class<?> clasz, String defaultValue, boolean hidden) {
|
public PropertyConfig(ModuleConfig moduleConfig, String id, Class<?> clasz, boolean hidden) {
|
||||||
this.moduleConfig = moduleConfig;
|
this.moduleConfig = moduleConfig;
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.type = clasz;
|
this.type = clasz;
|
||||||
this.defaultValue = defaultValue;
|
this.defaultValue = "";
|
||||||
this.setHidden(hidden);
|
this.setHidden(hidden);
|
||||||
this.setIdent(false);
|
this.setIdent(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PropertyConfig(ModuleConfig moduleConfig, String id, Class<?> clasz, String defaultValue, boolean hidden, boolean ident) {
|
public PropertyConfig(ModuleConfig moduleConfig, String id, Class<?> clasz, boolean hidden, boolean ident) {
|
||||||
this.moduleConfig = moduleConfig;
|
this.moduleConfig = moduleConfig;
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.type = clasz;
|
this.type = clasz;
|
||||||
this.defaultValue = defaultValue;
|
this.defaultValue = "";
|
||||||
this.setHidden(hidden);
|
this.setHidden(hidden);
|
||||||
this.setIdent(ident);
|
this.setIdent(ident);
|
||||||
}
|
}
|
||||||
|
@ -6,3 +6,4 @@ hive=host
|
|||||||
since=connected since
|
since=connected since
|
||||||
moduletitle=domains
|
moduletitle=domains
|
||||||
moduleicon=../runo/icons/16/document-web.png
|
moduleicon=../runo/icons/16/document-web.png
|
||||||
|
new=configure domain
|
@ -6,3 +6,4 @@ hive=Server
|
|||||||
since=aufgeschaltet seit
|
since=aufgeschaltet seit
|
||||||
moduletitle=Domains
|
moduletitle=Domains
|
||||||
moduleicon=../runo/icons/16/document-web.png
|
moduleicon=../runo/icons/16/document-web.png
|
||||||
|
new=Domain konfigurieren
|
@ -1,5 +1,5 @@
|
|||||||
id=identifier
|
id=identifier
|
||||||
emailaddress=adress
|
emailaddress=address
|
||||||
localpart=local part
|
localpart=local part
|
||||||
subdomain=subdomain
|
subdomain=subdomain
|
||||||
domain=main domain
|
domain=main domain
|
||||||
@ -9,3 +9,4 @@ pac=packet
|
|||||||
fulldomain=full domain
|
fulldomain=full domain
|
||||||
moduletitle=email addresses
|
moduletitle=email addresses
|
||||||
moduleicon=../runo/icons/16/email.png
|
moduleicon=../runo/icons/16/email.png
|
||||||
|
new=create address
|
@ -9,3 +9,4 @@ pac=Paket
|
|||||||
fulldomain=volle Domain
|
fulldomain=volle Domain
|
||||||
moduletitle=EMail Adressen
|
moduletitle=EMail Adressen
|
||||||
moduleicon=../runo/icons/16/email.png
|
moduleicon=../runo/icons/16/email.png
|
||||||
|
new=EMail-Adresse anlegen
|
@ -4,3 +4,4 @@ target=target(s)
|
|||||||
pac=packet
|
pac=packet
|
||||||
moduletitle=email aliases
|
moduletitle=email aliases
|
||||||
moduleicon=../runo/icons/16/email-send.png
|
moduleicon=../runo/icons/16/email-send.png
|
||||||
|
new=create alias
|
@ -4,3 +4,4 @@ target=Ziel(e)
|
|||||||
pac=Paket
|
pac=Paket
|
||||||
moduletitle=EMail Aliases
|
moduletitle=EMail Aliases
|
||||||
moduleicon=../runo/icons/16/email-send.png
|
moduleicon=../runo/icons/16/email-send.png
|
||||||
|
new=EMail-Alias anlegen
|
@ -1,4 +1,6 @@
|
|||||||
applicationtitle=HSAdmin Web Application
|
applicationtitle=HSAdmin Web Application
|
||||||
|
update=update
|
||||||
delete=delete
|
delete=delete
|
||||||
confirmdelete=confirm delete
|
confirmdelete=confirm delete
|
||||||
|
save=save
|
||||||
abort=abort
|
abort=abort
|
@ -1,4 +1,6 @@
|
|||||||
applicationtitle=HSAdmin Web Application
|
applicationtitle=HSAdmin Web Application
|
||||||
|
update=bearbeiten
|
||||||
delete=löschen
|
delete=löschen
|
||||||
confirmdelete=Diese Zeile löschen?
|
confirmdelete=Diesen Eintrag löschen?
|
||||||
|
save=speichern
|
||||||
abort=abbrechen
|
abort=abbrechen
|
@ -8,4 +8,5 @@ pac=packet
|
|||||||
quota_softlimit=quota soft limit
|
quota_softlimit=quota soft limit
|
||||||
quota_hardlimit=quota hard limit
|
quota_hardlimit=quota hard limit
|
||||||
moduletitle=unix user
|
moduletitle=unix user
|
||||||
|
new=create user
|
||||||
moduleicon=../runo/icons/16/users.png
|
moduleicon=../runo/icons/16/users.png
|
@ -1,11 +1,12 @@
|
|||||||
id=Schlüssel
|
id=Schlüssel
|
||||||
name=Benutzername
|
name=Benutzername
|
||||||
comment=Beschreibung
|
comment=Kommentar
|
||||||
shell=Unix Shell
|
shell=Shell
|
||||||
userid=Numerische Id
|
userid=Benutzerkennung
|
||||||
homedir=Heimat Verzeichnis
|
homedir=Heimat Verzeichnis
|
||||||
pac=Paket
|
pac=Paket
|
||||||
quota_softlimit=Weiche Quota
|
quota_softlimit=Soft-Quota [MB]
|
||||||
quota_hardlimit=Harte Quota
|
quota_hardlimit=Hard-Quota [MB]
|
||||||
moduletitle=Unix Benutzer
|
moduletitle=Unix User
|
||||||
moduleicon=../runo/icons/16/users.png
|
moduleicon=../runo/icons/16/users.png
|
||||||
|
new=Benutzer anlegen
|
Loading…
Reference in New Issue
Block a user