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() {
|
||||
moduleConfig = new ModuleConfig("domain");
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "id", Long.class, "", true, true));
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "name", String.class, ""));
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "user", String.class, ""));
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "pac", 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, "id", Long.class, true, true));
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "name", String.class));
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "user", String.class));
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "pac", String.class, true));
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "hive", String.class, true));
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "since", Date.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -11,15 +11,15 @@ public class EMailAddressModule extends GenericModule {
|
||||
|
||||
public EMailAddressModule() {
|
||||
moduleConfig = new ModuleConfig("emailaddress");
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "id", Long.class, "", true, true));
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "emailaddress", String.class, ""));
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "localpart", 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, "target", String.class, ""));
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "admin", 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, "id", Long.class, true, true));
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "emailaddress", String.class));
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "localpart", 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, "target", String.class));
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "admin", String.class, true));
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "pac", String.class, true));
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "fulldomain", String.class, true));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -11,10 +11,10 @@ public class EMailAliasModule extends GenericModule {
|
||||
|
||||
public EMailAliasModule() {
|
||||
moduleConfig = new ModuleConfig("emailalias");
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "id", Long.class, "", true, true));
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "name", String.class, ""));
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "target", String.class, ""));
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "pac", String.class, "", true));
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "id", Long.class, true, true));
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "name", String.class));
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "target", String.class));
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "pac", String.class, true));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -6,17 +6,23 @@ import java.text.ParseException;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.vaadin.data.Property;
|
||||
import com.vaadin.terminal.ExternalResource;
|
||||
import com.vaadin.terminal.Sizeable;
|
||||
import com.vaadin.terminal.ThemeResource;
|
||||
import com.vaadin.ui.Button;
|
||||
import com.vaadin.ui.Component;
|
||||
import com.vaadin.ui.Form;
|
||||
import com.vaadin.ui.HorizontalLayout;
|
||||
import com.vaadin.ui.Label;
|
||||
import com.vaadin.ui.Layout;
|
||||
import com.vaadin.ui.Link;
|
||||
import com.vaadin.ui.Table;
|
||||
import com.vaadin.ui.TextField;
|
||||
import com.vaadin.ui.VerticalLayout;
|
||||
import com.vaadin.ui.Window;
|
||||
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 DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT);
|
||||
|
||||
private VerticalLayout layout;
|
||||
private Table table;
|
||||
private MainApplication application;
|
||||
|
||||
public void setApplication(MainApplication app) throws HsarwebException {
|
||||
this.application = app;
|
||||
application = app;
|
||||
initTable();
|
||||
initLayout();
|
||||
}
|
||||
|
||||
public abstract ModuleConfig getModuleConfig();
|
||||
|
||||
public Component getComponent() {
|
||||
return table;
|
||||
return layout;
|
||||
}
|
||||
|
||||
public void reload() throws HsarwebException {
|
||||
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 {
|
||||
table = new Table() {
|
||||
private static final long serialVersionUID = 35127658139420917L;
|
||||
@ -79,12 +153,16 @@ public abstract class GenericModule implements Serializable {
|
||||
table.setColumnCollapsed(prop.getId(), true);
|
||||
}
|
||||
}
|
||||
table.addContainerProperty("edit", Button.class, null);
|
||||
table.setColumnWidth("edit", 16);
|
||||
table.setColumnHeader("edit", "");
|
||||
table.addContainerProperty("del", Button.class, null);
|
||||
table.setColumnWidth("del", 16);
|
||||
table.setColumnHeader("del", "");
|
||||
if (getModuleConfig().isUpdateAble()) {
|
||||
table.addContainerProperty("edit", Button.class, null);
|
||||
table.setColumnWidth("edit", 16);
|
||||
table.setColumnHeader("edit", "");
|
||||
}
|
||||
if (getModuleConfig().isDeleteAble()) {
|
||||
table.addContainerProperty("del", Button.class, null);
|
||||
table.setColumnWidth("del", 16);
|
||||
table.setColumnHeader("del", "");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new HsarwebException(e);
|
||||
}
|
||||
@ -99,7 +177,14 @@ public abstract class GenericModule implements Serializable {
|
||||
for (Object row : ((Object[])callSearch)) {
|
||||
long oid = -1L;
|
||||
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;
|
||||
for (PropertyConfig prop : propertyList) {
|
||||
Object valueObject = ((Map<?, ?>) row).get(prop.getId());
|
||||
@ -127,10 +212,14 @@ public abstract class GenericModule implements Serializable {
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
itemData[idx] = createEditButton(oid);
|
||||
idx++;
|
||||
itemData[idx] = createDeleteButton(oid);
|
||||
idx++;
|
||||
if (getModuleConfig().isUpdateAble()) {
|
||||
itemData[idx] = createEditButton(oid);
|
||||
idx++;
|
||||
}
|
||||
if (getModuleConfig().isDeleteAble()) {
|
||||
itemData[idx] = createDeleteButton(oid);
|
||||
idx++;
|
||||
}
|
||||
table.addItem(itemData, oid);
|
||||
}
|
||||
}
|
||||
@ -148,6 +237,40 @@ public abstract class GenericModule implements Serializable {
|
||||
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() {
|
||||
List<PropertyConfig> propertyList = getModuleConfig().getPropertyList();
|
||||
String idKey = null;
|
||||
@ -162,16 +285,51 @@ public abstract class GenericModule implements Serializable {
|
||||
|
||||
private Button createEditButton(long id) {
|
||||
ThemeResource icon = new ThemeResource("../runo/icons/16/document-txt.png");
|
||||
Button button = new Button();
|
||||
final Button button = new Button();
|
||||
button.setIcon(icon);
|
||||
button.setData(id);
|
||||
button.setStyleName(BaseTheme.BUTTON_LINK);
|
||||
button.addListener(new Button.ClickListener() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Window childWindow;
|
||||
@Override
|
||||
public void buttonClick(ClickEvent event) {
|
||||
// loadTable();
|
||||
System.out.println("Data: " + event.getButton().getData());
|
||||
final Form form = createForm((Long) button.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;
|
||||
@ -228,4 +386,50 @@ public abstract class GenericModule implements Serializable {
|
||||
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 com.vaadin.Application;
|
||||
import com.vaadin.terminal.Sizeable;
|
||||
import com.vaadin.terminal.Terminal;
|
||||
import com.vaadin.terminal.ThemeResource;
|
||||
import com.vaadin.terminal.gwt.server.HttpServletRequestListener;
|
||||
import com.vaadin.ui.Component;
|
||||
import com.vaadin.ui.TabSheet;
|
||||
import com.vaadin.ui.VerticalLayout;
|
||||
import com.vaadin.ui.Window;
|
||||
import com.vaadin.ui.TabSheet.SelectedTabChangeEvent;
|
||||
import com.vaadin.ui.TabSheet.Tab;
|
||||
@ -45,9 +45,12 @@ public class MainApplication extends Application implements HttpServletRequestLi
|
||||
localeConfig = new LocaleConfig(Locale.getDefault(), "main");
|
||||
remote = new Remote(this);
|
||||
Window mainWindow = new Window(localeConfig.getText("applicationtitle"));
|
||||
VerticalLayout verticalLayout = new VerticalLayout();
|
||||
verticalLayout.setSizeFull();
|
||||
TabSheet tabs = new TabSheet();
|
||||
tabs.setWidth(100.0f, Sizeable.UNITS_PERCENTAGE);
|
||||
tabs.setHeight(200.0f, Sizeable.UNITS_PERCENTAGE);
|
||||
tabs.setSizeFull();
|
||||
// tabs.setWidth(95.0f, Sizeable.UNITS_PERCENTAGE);
|
||||
// tabs.setHeight(95.0f, Sizeable.UNITS_PERCENTAGE);
|
||||
String modulesParamString = getContextParam("hsarmodules");
|
||||
modules = new HashMap<String, GenericModule>();
|
||||
GenericModule firstModule = null;
|
||||
@ -67,7 +70,8 @@ public class MainApplication extends Application implements HttpServletRequestLi
|
||||
}
|
||||
}
|
||||
tabs.addListener(this);
|
||||
mainWindow.addComponent(tabs);
|
||||
verticalLayout.addComponent(tabs);
|
||||
mainWindow.setContent(verticalLayout);
|
||||
setMainWindow(mainWindow);
|
||||
setErrorHandler(new Terminal.ErrorListener() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
@ -13,14 +13,18 @@ public class QueueTaskModule extends GenericModule {
|
||||
|
||||
public QueueTaskModule() {
|
||||
moduleConfig = new ModuleConfig("q");
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "id", Long.class, "", true, true));
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "title", String.class, ""));
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "status", String.class, ""));
|
||||
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));
|
||||
moduleConfig.setUpdateAble(false);
|
||||
moduleConfig.setDeleteAble(false);
|
||||
moduleConfig.setAddAble(false);
|
||||
moduleConfig.setSearchAble(false);
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "id", Long.class, true, true));
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "title", String.class));
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "status", String.class));
|
||||
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
|
||||
|
@ -21,20 +21,41 @@ public class Remote {
|
||||
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 {
|
||||
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];
|
||||
params[0] = app.getLogin();
|
||||
params[1] = app.getProxyTicket();
|
||||
params[2] = where;
|
||||
Object res;
|
||||
params[2] = param1;
|
||||
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 {
|
||||
res = getClient().execute(module + "." + operation, params);
|
||||
res = getClient().execute(operation, params);
|
||||
} catch (XmlRpcException e) {
|
||||
throw new HsarwebException("error in remote server call", e);
|
||||
throw new HsarwebException(e.getMessage(), e);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
@ -11,15 +11,24 @@ public class UnixUserModule extends GenericModule {
|
||||
|
||||
public UnixUserModule() {
|
||||
moduleConfig = new ModuleConfig("user");
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "id", Long.class, "", true, true));
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "name", String.class, ""));
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "comment", String.class, ""));
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "shell", String.class, ""));
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "userid", Long.class, "", true));
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "homedir", String.class, "", true));
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "pac", String.class, "", true));
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "quota_softlimit", Long.class, "", true));
|
||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "quota_hardlimit", Long.class, "", true));
|
||||
PropertyConfig propId = new PropertyConfig(moduleConfig, "id", Long.class, true, true);
|
||||
moduleConfig.addProperty(propId);
|
||||
PropertyConfig propUserId = new PropertyConfig(moduleConfig, "userid", Long.class, true);
|
||||
moduleConfig.addProperty(propUserId);
|
||||
PropertyConfig propUserName = new PropertyConfig(moduleConfig, "name", String.class);
|
||||
moduleConfig.addProperty(propUserName);
|
||||
PropertyConfig propUserComment = new PropertyConfig(moduleConfig, "comment", String.class);
|
||||
moduleConfig.addProperty(propUserComment);
|
||||
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
|
||||
|
@ -2,8 +2,10 @@ package de.hsadmin.web.config;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
public class ModuleConfig implements Serializable {
|
||||
|
||||
@ -11,12 +13,22 @@ public class ModuleConfig implements Serializable {
|
||||
|
||||
private String name;
|
||||
private List<PropertyConfig> propertyList;
|
||||
private Map<String, PropertyConfig> propertyMap;
|
||||
private LocaleConfig localeConfig;
|
||||
private boolean deleteAble;
|
||||
private boolean updateAble;
|
||||
private boolean addAble;
|
||||
private boolean searchAble;
|
||||
|
||||
public ModuleConfig(String name) {
|
||||
this.name = name;
|
||||
propertyList = new ArrayList<PropertyConfig>();
|
||||
propertyMap = new HashMap<String, PropertyConfig>();
|
||||
localeConfig = new LocaleConfig(Locale.getDefault(), name);
|
||||
addAble = true;
|
||||
updateAble = true;
|
||||
deleteAble = true;
|
||||
searchAble = true;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
@ -24,15 +36,52 @@ public class ModuleConfig implements Serializable {
|
||||
}
|
||||
|
||||
public void addProperty(PropertyConfig property) {
|
||||
this.propertyList.add(property);
|
||||
propertyList.add(property);
|
||||
propertyMap.put(property.getId(), property);
|
||||
}
|
||||
|
||||
public List<PropertyConfig> getPropertyList() {
|
||||
return propertyList;
|
||||
}
|
||||
|
||||
public PropertyConfig getProperty(String id) {
|
||||
return propertyMap.get(id);
|
||||
}
|
||||
|
||||
public String getLabel(String 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 ident;
|
||||
|
||||
public PropertyConfig(ModuleConfig moduleConfig, String id, Class<?> clasz, String defaultValue) {
|
||||
public PropertyConfig(ModuleConfig moduleConfig, String id, Class<?> clasz) {
|
||||
this.moduleConfig = moduleConfig;
|
||||
this.id = id;
|
||||
this.type = clasz;
|
||||
this.defaultValue = defaultValue;
|
||||
this.defaultValue = "";
|
||||
this.setHidden(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.id = id;
|
||||
this.type = clasz;
|
||||
this.defaultValue = defaultValue;
|
||||
this.defaultValue = "";
|
||||
this.setHidden(hidden);
|
||||
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.id = id;
|
||||
this.type = clasz;
|
||||
this.defaultValue = defaultValue;
|
||||
this.defaultValue = "";
|
||||
this.setHidden(hidden);
|
||||
this.setIdent(ident);
|
||||
}
|
||||
|
@ -6,3 +6,4 @@ hive=host
|
||||
since=connected since
|
||||
moduletitle=domains
|
||||
moduleicon=../runo/icons/16/document-web.png
|
||||
new=configure domain
|
@ -6,3 +6,4 @@ hive=Server
|
||||
since=aufgeschaltet seit
|
||||
moduletitle=Domains
|
||||
moduleicon=../runo/icons/16/document-web.png
|
||||
new=Domain konfigurieren
|
@ -1,5 +1,5 @@
|
||||
id=identifier
|
||||
emailaddress=adress
|
||||
emailaddress=address
|
||||
localpart=local part
|
||||
subdomain=subdomain
|
||||
domain=main domain
|
||||
@ -9,3 +9,4 @@ pac=packet
|
||||
fulldomain=full domain
|
||||
moduletitle=email addresses
|
||||
moduleicon=../runo/icons/16/email.png
|
||||
new=create address
|
@ -9,3 +9,4 @@ pac=Paket
|
||||
fulldomain=volle Domain
|
||||
moduletitle=EMail Adressen
|
||||
moduleicon=../runo/icons/16/email.png
|
||||
new=EMail-Adresse anlegen
|
@ -4,3 +4,4 @@ target=target(s)
|
||||
pac=packet
|
||||
moduletitle=email aliases
|
||||
moduleicon=../runo/icons/16/email-send.png
|
||||
new=create alias
|
@ -4,3 +4,4 @@ target=Ziel(e)
|
||||
pac=Paket
|
||||
moduletitle=EMail Aliases
|
||||
moduleicon=../runo/icons/16/email-send.png
|
||||
new=EMail-Alias anlegen
|
@ -1,4 +1,6 @@
|
||||
applicationtitle=HSAdmin Web Application
|
||||
update=update
|
||||
delete=delete
|
||||
confirmdelete=confirm delete
|
||||
save=save
|
||||
abort=abort
|
@ -1,4 +1,6 @@
|
||||
applicationtitle=HSAdmin Web Application
|
||||
update=bearbeiten
|
||||
delete=löschen
|
||||
confirmdelete=Diese Zeile löschen?
|
||||
confirmdelete=Diesen Eintrag löschen?
|
||||
save=speichern
|
||||
abort=abbrechen
|
@ -8,4 +8,5 @@ pac=packet
|
||||
quota_softlimit=quota soft limit
|
||||
quota_hardlimit=quota hard limit
|
||||
moduletitle=unix user
|
||||
new=create user
|
||||
moduleicon=../runo/icons/16/users.png
|
@ -1,11 +1,12 @@
|
||||
id=Schlüssel
|
||||
name=Benutzername
|
||||
comment=Beschreibung
|
||||
shell=Unix Shell
|
||||
userid=Numerische Id
|
||||
comment=Kommentar
|
||||
shell=Shell
|
||||
userid=Benutzerkennung
|
||||
homedir=Heimat Verzeichnis
|
||||
pac=Paket
|
||||
quota_softlimit=Weiche Quota
|
||||
quota_hardlimit=Harte Quota
|
||||
moduletitle=Unix Benutzer
|
||||
quota_softlimit=Soft-Quota [MB]
|
||||
quota_hardlimit=Hard-Quota [MB]
|
||||
moduletitle=Unix User
|
||||
moduleicon=../runo/icons/16/users.png
|
||||
new=Benutzer anlegen
|
Loading…
Reference in New Issue
Block a user