Felder fuer: Passwort, Auswahl, Read-Only etc.
Update der Vaadin-Lib auf 6.5.3
This commit is contained in:
parent
a1c1b35b83
commit
fea45e7c91
Binary file not shown.
BIN
hsarweb/WebContent/WEB-INF/lib/vaadin-6.5.3.jar
Normal file
BIN
hsarweb/WebContent/WEB-INF/lib/vaadin-6.5.3.jar
Normal file
Binary file not shown.
@ -1,9 +1,18 @@
|
|||||||
package de.hsadmin.web;
|
package de.hsadmin.web;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
import de.hsadmin.web.config.ModuleConfig;
|
import de.hsadmin.web.config.ModuleConfig;
|
||||||
import de.hsadmin.web.config.PropertyConfig;
|
import de.hsadmin.web.config.PropertyConfig;
|
||||||
|
import de.hsadmin.web.config.PropertyDefaultValue;
|
||||||
|
import de.hsadmin.web.config.PropertyFormField;
|
||||||
|
import de.hsadmin.web.config.PropertySelectValues;
|
||||||
|
import de.hsadmin.web.config.PropertyTableColumn;
|
||||||
|
|
||||||
public class DomainModule extends GenericModule {
|
public class DomainModule extends GenericModule {
|
||||||
|
|
||||||
@ -11,14 +20,55 @@ public class DomainModule extends GenericModule {
|
|||||||
|
|
||||||
private ModuleConfig moduleConfig;
|
private ModuleConfig moduleConfig;
|
||||||
|
|
||||||
public DomainModule() {
|
@Override
|
||||||
|
protected void initModule() {
|
||||||
moduleConfig = new ModuleConfig("domain");
|
moduleConfig = new ModuleConfig("domain");
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "id", Long.class, true, true));
|
moduleConfig.setUpdateAble(false);
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "name", String.class));
|
String login = getApplication().getLogin();
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "user", String.class));
|
final String pac = login.length() >= 5 ? login.substring(0, 5) : "";
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "pac", String.class, true));
|
PropertyConfig idProp = new PropertyConfig(moduleConfig, "id", Long.class, PropertyTableColumn.INTERNAL_KEY, PropertyFormField.INTERNAL_KEY);
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "hive", String.class, true));
|
PropertyConfig nameProp = new PropertyConfig(moduleConfig, "name", String.class, PropertyFormField.WRITEONCE);
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "since", Date.class));
|
PropertyConfig userProp = new PropertyConfig(moduleConfig, "user", String.class, PropertyFormField.WRITEONCE);
|
||||||
|
userProp.setDefaultValue(new PropertyDefaultValue() {
|
||||||
|
@Override
|
||||||
|
public String getDefaultValue() {
|
||||||
|
return pac;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
userProp.setSelectValues(new PropertySelectValues() {
|
||||||
|
@Override
|
||||||
|
public boolean newItemsAllowed() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean hasSelectList() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public Map<String, String> getSelectValues() {
|
||||||
|
List<String> list = getUsers();
|
||||||
|
TreeMap<String,String> map = new TreeMap<String, String>();
|
||||||
|
for (String usr : list) {
|
||||||
|
map.put(usr, usr);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
PropertyConfig pacProp = new PropertyConfig(moduleConfig, "pac", String.class, PropertyTableColumn.HIDDEN, PropertyFormField.READONLY);
|
||||||
|
pacProp.setDefaultValue(new PropertyDefaultValue() {
|
||||||
|
@Override
|
||||||
|
public String getDefaultValue() {
|
||||||
|
return pac;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
PropertyConfig hiveProp = new PropertyConfig(moduleConfig, "hive", String.class, PropertyTableColumn.HIDDEN, PropertyFormField.NONE);
|
||||||
|
PropertyConfig sinceProp = new PropertyConfig(moduleConfig, "since", Date.class, PropertyFormField.READONLY);
|
||||||
|
moduleConfig.addProperty(idProp);
|
||||||
|
moduleConfig.addProperty(nameProp);
|
||||||
|
moduleConfig.addProperty(userProp);
|
||||||
|
moduleConfig.addProperty(pacProp);
|
||||||
|
moduleConfig.addProperty(hiveProp);
|
||||||
|
moduleConfig.addProperty(sinceProp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -26,4 +76,25 @@ public class DomainModule extends GenericModule {
|
|||||||
return moduleConfig;
|
return moduleConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getUsers() {
|
||||||
|
ArrayList<String> list = new ArrayList<String>();
|
||||||
|
try {
|
||||||
|
Object callSearch = getApplication().getRemote().callSearch("user", new HashMap<String, String>());
|
||||||
|
if (callSearch instanceof Object[]) {
|
||||||
|
for (Object row : ((Object[])callSearch)) {
|
||||||
|
if (row instanceof Map<?, ?>) {
|
||||||
|
Object object = ((Map<?, ?>) row).get("name");
|
||||||
|
if (object instanceof String) {
|
||||||
|
list.add((String) object);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (HsarwebException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
getApplication().showSystemException(e);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,17 @@
|
|||||||
package de.hsadmin.web;
|
package de.hsadmin.web;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
import de.hsadmin.web.config.ModuleConfig;
|
import de.hsadmin.web.config.ModuleConfig;
|
||||||
import de.hsadmin.web.config.PropertyConfig;
|
import de.hsadmin.web.config.PropertyConfig;
|
||||||
|
import de.hsadmin.web.config.PropertyDefaultValue;
|
||||||
|
import de.hsadmin.web.config.PropertyFormField;
|
||||||
|
import de.hsadmin.web.config.PropertySelectValues;
|
||||||
|
import de.hsadmin.web.config.PropertyTableColumn;
|
||||||
|
|
||||||
public class EMailAddressModule extends GenericModule {
|
public class EMailAddressModule extends GenericModule {
|
||||||
|
|
||||||
@ -9,17 +19,47 @@ public class EMailAddressModule extends GenericModule {
|
|||||||
|
|
||||||
private ModuleConfig moduleConfig;
|
private ModuleConfig moduleConfig;
|
||||||
|
|
||||||
public EMailAddressModule() {
|
@Override
|
||||||
|
protected void initModule() {
|
||||||
moduleConfig = new ModuleConfig("emailaddress");
|
moduleConfig = new ModuleConfig("emailaddress");
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "id", Long.class, true, true));
|
String login = getApplication().getLogin();
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "emailaddress", String.class));
|
final String pac = login.length() >= 5 ? login.substring(0, 5) : "";
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "localpart", String.class, true));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "id", Long.class, PropertyTableColumn.INTERNAL_KEY, PropertyFormField.INTERNAL_KEY));
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "subdomain", String.class, true));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "emailaddress", String.class, PropertyFormField.NONE));
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "domain", String.class, true));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "localpart", String.class, PropertyTableColumn.HIDDEN, PropertyFormField.WRITEONCE));
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "target", String.class));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "subdomain", String.class, PropertyTableColumn.HIDDEN, PropertyFormField.WRITEONCE));
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "admin", String.class, true));
|
PropertyConfig DomainProp = new PropertyConfig(moduleConfig, "domain", String.class, PropertyTableColumn.HIDDEN, PropertyFormField.WRITEONCE);
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "pac", String.class, true));
|
DomainProp.setSelectValues(new PropertySelectValues() {
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "fulldomain", String.class, true));
|
@Override
|
||||||
|
public boolean newItemsAllowed() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean hasSelectList() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public Map<String, String> getSelectValues() {
|
||||||
|
Map<String, String> map = new TreeMap<String, String>();
|
||||||
|
List<String> list = getDomains();
|
||||||
|
for (String dom : list) {
|
||||||
|
map.put(dom, dom);
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
moduleConfig.addProperty(DomainProp);
|
||||||
|
PropertyConfig targetProp = new PropertyConfig(moduleConfig, "target", String.class);
|
||||||
|
targetProp.setDefaultValue(new PropertyDefaultValue() {
|
||||||
|
@Override
|
||||||
|
public String getDefaultValue() {
|
||||||
|
return pac + "-";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
moduleConfig.addProperty(targetProp);
|
||||||
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "admin", String.class, PropertyTableColumn.HIDDEN, PropertyFormField.NONE));
|
||||||
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "pac", String.class, PropertyTableColumn.HIDDEN, PropertyFormField.NONE));
|
||||||
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "fulldomain", String.class, PropertyTableColumn.HIDDEN, PropertyFormField.NONE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -27,4 +67,25 @@ public class EMailAddressModule extends GenericModule {
|
|||||||
return moduleConfig;
|
return moduleConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getDomains() {
|
||||||
|
ArrayList<String> list = new ArrayList<String>();
|
||||||
|
try {
|
||||||
|
Object callSearch = getApplication().getRemote().callSearch("domain", new HashMap<String, String>());
|
||||||
|
if (callSearch instanceof Object[]) {
|
||||||
|
for (Object row : ((Object[])callSearch)) {
|
||||||
|
if (row instanceof Map<?, ?>) {
|
||||||
|
Object object = ((Map<?, ?>) row).get("name");
|
||||||
|
if (object instanceof String) {
|
||||||
|
list.add((String) object);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (HsarwebException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
getApplication().showSystemException(e);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,9 @@ package de.hsadmin.web;
|
|||||||
|
|
||||||
import de.hsadmin.web.config.ModuleConfig;
|
import de.hsadmin.web.config.ModuleConfig;
|
||||||
import de.hsadmin.web.config.PropertyConfig;
|
import de.hsadmin.web.config.PropertyConfig;
|
||||||
|
import de.hsadmin.web.config.PropertyDefaultValue;
|
||||||
|
import de.hsadmin.web.config.PropertyFormField;
|
||||||
|
import de.hsadmin.web.config.PropertyTableColumn;
|
||||||
|
|
||||||
public class EMailAliasModule extends GenericModule {
|
public class EMailAliasModule extends GenericModule {
|
||||||
|
|
||||||
@ -9,12 +12,42 @@ public class EMailAliasModule extends GenericModule {
|
|||||||
|
|
||||||
private ModuleConfig moduleConfig;
|
private ModuleConfig moduleConfig;
|
||||||
|
|
||||||
public EMailAliasModule() {
|
@Override
|
||||||
|
protected void initModule() {
|
||||||
moduleConfig = new ModuleConfig("emailalias");
|
moduleConfig = new ModuleConfig("emailalias");
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "id", Long.class, true, true));
|
String login = getApplication().getLogin();
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "name", String.class));
|
final String pac = login.length() >= 5 ? login.substring(0, 5) : "";
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "target", String.class));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "id", Long.class, PropertyTableColumn.INTERNAL_KEY, PropertyFormField.INTERNAL_KEY));
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "pac", String.class, true));
|
PropertyConfig nameProp = new PropertyConfig(moduleConfig, "name", String.class);
|
||||||
|
nameProp.setDefaultValue(new PropertyDefaultValue() {
|
||||||
|
@Override
|
||||||
|
public String getDefaultValue() {
|
||||||
|
if (pac.length() >= 5) {
|
||||||
|
return pac + "-";
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
moduleConfig.addProperty(nameProp);
|
||||||
|
PropertyConfig targetProp = new PropertyConfig(moduleConfig, "target", String.class);
|
||||||
|
targetProp.setDefaultValue(new PropertyDefaultValue() {
|
||||||
|
@Override
|
||||||
|
public String getDefaultValue() {
|
||||||
|
if (pac.length() >= 5) {
|
||||||
|
return pac + "-";
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
moduleConfig.addProperty(targetProp);
|
||||||
|
PropertyConfig pacProp = new PropertyConfig(moduleConfig, "pac", String.class, PropertyTableColumn.HIDDEN, PropertyFormField.READONLY);
|
||||||
|
pacProp.setDefaultValue(new PropertyDefaultValue() {
|
||||||
|
@Override
|
||||||
|
public String getDefaultValue() {
|
||||||
|
return pac;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
moduleConfig.addProperty(pacProp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -14,6 +14,7 @@ import com.vaadin.data.Property;
|
|||||||
import com.vaadin.terminal.ExternalResource;
|
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.AbstractTextField;
|
||||||
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.Form;
|
||||||
@ -21,6 +22,8 @@ import com.vaadin.ui.HorizontalLayout;
|
|||||||
import com.vaadin.ui.Label;
|
import com.vaadin.ui.Label;
|
||||||
import com.vaadin.ui.Layout;
|
import com.vaadin.ui.Layout;
|
||||||
import com.vaadin.ui.Link;
|
import com.vaadin.ui.Link;
|
||||||
|
import com.vaadin.ui.PasswordField;
|
||||||
|
import com.vaadin.ui.Select;
|
||||||
import com.vaadin.ui.Table;
|
import com.vaadin.ui.Table;
|
||||||
import com.vaadin.ui.TextField;
|
import com.vaadin.ui.TextField;
|
||||||
import com.vaadin.ui.VerticalLayout;
|
import com.vaadin.ui.VerticalLayout;
|
||||||
@ -31,6 +34,8 @@ import com.vaadin.ui.themes.BaseTheme;
|
|||||||
import de.hsadmin.web.config.LocaleConfig;
|
import de.hsadmin.web.config.LocaleConfig;
|
||||||
import de.hsadmin.web.config.ModuleConfig;
|
import de.hsadmin.web.config.ModuleConfig;
|
||||||
import de.hsadmin.web.config.PropertyConfig;
|
import de.hsadmin.web.config.PropertyConfig;
|
||||||
|
import de.hsadmin.web.config.PropertyFormField;
|
||||||
|
import de.hsadmin.web.config.PropertyTableColumn;
|
||||||
|
|
||||||
public abstract class GenericModule implements Serializable {
|
public abstract class GenericModule implements Serializable {
|
||||||
|
|
||||||
@ -43,12 +48,19 @@ public abstract class GenericModule implements Serializable {
|
|||||||
|
|
||||||
public void setApplication(MainApplication app) throws HsarwebException {
|
public void setApplication(MainApplication app) throws HsarwebException {
|
||||||
application = app;
|
application = app;
|
||||||
|
initModule();
|
||||||
initTable();
|
initTable();
|
||||||
initLayout();
|
initLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MainApplication getApplication() {
|
||||||
|
return application;
|
||||||
|
}
|
||||||
|
|
||||||
public abstract ModuleConfig getModuleConfig();
|
public abstract ModuleConfig getModuleConfig();
|
||||||
|
|
||||||
|
protected abstract void initModule();
|
||||||
|
|
||||||
public Component getComponent() {
|
public Component getComponent() {
|
||||||
return layout;
|
return layout;
|
||||||
}
|
}
|
||||||
@ -61,6 +73,7 @@ public abstract class GenericModule implements Serializable {
|
|||||||
layout = new VerticalLayout();
|
layout = new VerticalLayout();
|
||||||
layout.setSizeFull();
|
layout.setSizeFull();
|
||||||
final ModuleConfig moduleConfig = getModuleConfig();
|
final ModuleConfig moduleConfig = getModuleConfig();
|
||||||
|
final LocaleConfig localeConfig = application.getLocaleConfig();
|
||||||
if (moduleConfig.isSearchAble() || moduleConfig.isAddAble()) {
|
if (moduleConfig.isSearchAble() || moduleConfig.isAddAble()) {
|
||||||
HorizontalLayout toolbar = new HorizontalLayout();
|
HorizontalLayout toolbar = new HorizontalLayout();
|
||||||
if (moduleConfig.isAddAble()) {
|
if (moduleConfig.isAddAble()) {
|
||||||
@ -73,7 +86,6 @@ public abstract class GenericModule implements Serializable {
|
|||||||
@Override
|
@Override
|
||||||
public void buttonClick(ClickEvent event) {
|
public void buttonClick(ClickEvent event) {
|
||||||
final Form form = createForm();
|
final Form form = createForm();
|
||||||
LocaleConfig localeConfig = application.getLocaleConfig();
|
|
||||||
childWindow = new Window(localeConfig.getText("new"));
|
childWindow = new Window(localeConfig.getText("new"));
|
||||||
childWindow.setWidth(640.0f, Sizeable.UNITS_PIXELS);
|
childWindow.setWidth(640.0f, Sizeable.UNITS_PIXELS);
|
||||||
VerticalLayout vLayout = new VerticalLayout();
|
VerticalLayout vLayout = new VerticalLayout();
|
||||||
@ -120,7 +132,7 @@ public abstract class GenericModule implements Serializable {
|
|||||||
}
|
}
|
||||||
layout.addComponent(table);
|
layout.addComponent(table);
|
||||||
layout.setExpandRatio(table, 1.0f);
|
layout.setExpandRatio(table, 1.0f);
|
||||||
layout.addComponent(new Link("Impressum", new ExternalResource("http://www.hostsharing.net/impressum")));
|
layout.addComponent(new Link(localeConfig.getText("impressum.label"), new ExternalResource(localeConfig.getText("impressum.link"))));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initTable() throws HsarwebException {
|
private void initTable() throws HsarwebException {
|
||||||
@ -142,15 +154,21 @@ public abstract class GenericModule implements Serializable {
|
|||||||
try {
|
try {
|
||||||
table.setWidth(100.0f, Sizeable.UNITS_PERCENTAGE);
|
table.setWidth(100.0f, Sizeable.UNITS_PERCENTAGE);
|
||||||
table.setHeight(100.0f, Sizeable.UNITS_PERCENTAGE);
|
table.setHeight(100.0f, Sizeable.UNITS_PERCENTAGE);
|
||||||
table.setSelectable(true);
|
table.setSelectable(false);
|
||||||
table.setImmediate(true);
|
table.setImmediate(true);
|
||||||
table.setColumnCollapsingAllowed(true);
|
table.setColumnCollapsingAllowed(true);
|
||||||
table.setColumnReorderingAllowed(true);
|
table.setColumnReorderingAllowed(true);
|
||||||
for (PropertyConfig prop : getModuleConfig().getPropertyList()) {
|
for (PropertyConfig prop : getModuleConfig().getPropertyList()) {
|
||||||
table.addContainerProperty(prop.getId(), prop.getType(), prop.getDefaultValue());
|
PropertyTableColumn propTableColumn = prop.getPropTableColumn();
|
||||||
table.setColumnHeader(prop.getId(), prop.getLabel());
|
if (propTableColumn != PropertyTableColumn.NONE) {
|
||||||
if (prop.isHidden()) {
|
table.addContainerProperty(prop.getId(), prop.getType(), prop.getDefaultValue());
|
||||||
table.setColumnCollapsed(prop.getId(), true);
|
table.setColumnHeader(prop.getId(), prop.getLabel());
|
||||||
|
if (propTableColumn == PropertyTableColumn.HIDDEN) {
|
||||||
|
table.setColumnCollapsed(prop.getId(), true);
|
||||||
|
}
|
||||||
|
if (propTableColumn == PropertyTableColumn.INTERNAL_KEY) {
|
||||||
|
table.setColumnCollapsed(prop.getId(), true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getModuleConfig().isUpdateAble()) {
|
if (getModuleConfig().isUpdateAble()) {
|
||||||
@ -171,52 +189,57 @@ public abstract class GenericModule implements Serializable {
|
|||||||
private void loadTable() throws HsarwebException {
|
private void loadTable() throws HsarwebException {
|
||||||
table.removeAllItems();
|
table.removeAllItems();
|
||||||
try {
|
try {
|
||||||
Object callSearch = application.getRemote().callSearch(getModuleConfig().getName(), new HashMap<String, String>());
|
ModuleConfig moduleConfig = getModuleConfig();
|
||||||
List<PropertyConfig> propertyList = getModuleConfig().getPropertyList();
|
Object callSearch = application.getRemote().callSearch(moduleConfig.getName(), new HashMap<String, String>());
|
||||||
|
List<PropertyConfig> propertyList = moduleConfig.getPropertyList();
|
||||||
if (callSearch instanceof Object[]) {
|
if (callSearch instanceof Object[]) {
|
||||||
for (Object row : ((Object[])callSearch)) {
|
for (Object row : ((Object[])callSearch)) {
|
||||||
long oid = -1L;
|
long oid = -1L;
|
||||||
if (row instanceof Map<?, ?>) {
|
if (row instanceof Map<?, ?>) {
|
||||||
int numOfcolumns = propertyList.size();
|
int numOfcolumns = propertyList.size();
|
||||||
if (getModuleConfig().isUpdateAble()) {
|
if (moduleConfig.isUpdateAble()) {
|
||||||
numOfcolumns++;
|
numOfcolumns++;
|
||||||
}
|
}
|
||||||
if (getModuleConfig().isDeleteAble()) {
|
if (moduleConfig.isDeleteAble()) {
|
||||||
numOfcolumns++;
|
numOfcolumns++;
|
||||||
}
|
}
|
||||||
|
numOfcolumns = moduleConfig.getNumOfColumns();
|
||||||
Object[] itemData = new Object[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());
|
PropertyTableColumn propTableColumn = prop.getPropTableColumn();
|
||||||
if (valueObject != null && valueObject instanceof String) {
|
if (propTableColumn != PropertyTableColumn.NONE) {
|
||||||
if (Long.class.equals(prop.getType())) {
|
Object valueObject = ((Map<?, ?>) row).get(prop.getId());
|
||||||
itemData[idx] = Long.parseLong((String) valueObject);
|
if (valueObject != null && valueObject instanceof String) {
|
||||||
}
|
if (Long.class.equals(prop.getType())) {
|
||||||
if (Date.class.equals(prop.getType())) {
|
itemData[idx] = Long.parseLong((String) valueObject);
|
||||||
try {
|
}
|
||||||
itemData[idx] = df.parse((String) valueObject);
|
if (Date.class.equals(prop.getType())) {
|
||||||
} catch (ParseException e) {
|
try {
|
||||||
Calendar cal = Calendar.getInstance();
|
itemData[idx] = df.parse((String) valueObject);
|
||||||
cal.clear();
|
} catch (ParseException e) {
|
||||||
itemData[idx] = cal.getTime();
|
Calendar cal = Calendar.getInstance();
|
||||||
}
|
cal.clear();
|
||||||
}
|
itemData[idx] = cal.getTime();
|
||||||
if (String.class.equals(prop.getType())) {
|
}
|
||||||
itemData[idx] = (String) valueObject;
|
}
|
||||||
}
|
if (String.class.equals(prop.getType())) {
|
||||||
if (prop.isIdent() && Long.class.equals(prop.getType())) {
|
itemData[idx] = (String) valueObject;
|
||||||
if (valueObject instanceof String) {
|
}
|
||||||
oid = Long.parseLong((String) valueObject);
|
if (propTableColumn == PropertyTableColumn.INTERNAL_KEY && Long.class.equals(prop.getType())) {
|
||||||
|
if (valueObject instanceof String) {
|
||||||
|
oid = Long.parseLong((String) valueObject);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
idx++;
|
||||||
}
|
}
|
||||||
idx++;
|
|
||||||
}
|
}
|
||||||
if (getModuleConfig().isUpdateAble()) {
|
if (moduleConfig.isUpdateAble()) {
|
||||||
itemData[idx] = createEditButton(oid);
|
itemData[idx] = createEditButton(oid);
|
||||||
idx++;
|
idx++;
|
||||||
}
|
}
|
||||||
if (getModuleConfig().isDeleteAble()) {
|
if (moduleConfig.isDeleteAble()) {
|
||||||
itemData[idx] = createDeleteButton(oid);
|
itemData[idx] = createDeleteButton(oid);
|
||||||
idx++;
|
idx++;
|
||||||
}
|
}
|
||||||
@ -244,12 +267,7 @@ public abstract class GenericModule implements Serializable {
|
|||||||
Iterator<Component> componentIterator = form.getLayout().getComponentIterator();
|
Iterator<Component> componentIterator = form.getLayout().getComponentIterator();
|
||||||
while (componentIterator.hasNext()) {
|
while (componentIterator.hasNext()) {
|
||||||
Component c = componentIterator.next();
|
Component c = componentIterator.next();
|
||||||
if (c instanceof TextField) {
|
transferToHash(setHash, c);
|
||||||
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);
|
application.getRemote().callUpdate(getModuleConfig().getName(), setHash, whereHash);
|
||||||
loadTable();
|
loadTable();
|
||||||
@ -260,22 +278,33 @@ public abstract class GenericModule implements Serializable {
|
|||||||
Iterator<Component> componentIterator = form.getLayout().getComponentIterator();
|
Iterator<Component> componentIterator = form.getLayout().getComponentIterator();
|
||||||
while (componentIterator.hasNext()) {
|
while (componentIterator.hasNext()) {
|
||||||
Component c = componentIterator.next();
|
Component c = componentIterator.next();
|
||||||
if (c instanceof TextField) {
|
transferToHash(setHash, c);
|
||||||
TextField tf = (TextField) c;
|
|
||||||
Object data = tf.getData();
|
|
||||||
Object value = tf.getValue();
|
|
||||||
setHash.put((String) data, (String) value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
application.getRemote().callAdd(getModuleConfig().getName(), setHash);
|
application.getRemote().callAdd(getModuleConfig().getName(), setHash);
|
||||||
loadTable();
|
loadTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void transferToHash(Map<String, String> setHash, Component c) {
|
||||||
|
if (c instanceof AbstractTextField) {
|
||||||
|
AbstractTextField tf = (AbstractTextField) c;
|
||||||
|
Object data = tf.getData();
|
||||||
|
Object value = tf.getValue();
|
||||||
|
setHash.put((String) data, (String) value);
|
||||||
|
}
|
||||||
|
if (c instanceof Select) {
|
||||||
|
Select sel = (Select) c;
|
||||||
|
Object data = sel.getData();
|
||||||
|
Object value = sel.getValue();
|
||||||
|
setHash.put((String) data, (String) value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private String findIdKey() {
|
private String findIdKey() {
|
||||||
List<PropertyConfig> propertyList = getModuleConfig().getPropertyList();
|
List<PropertyConfig> propertyList = getModuleConfig().getPropertyList();
|
||||||
String idKey = null;
|
String idKey = null;
|
||||||
for (PropertyConfig propConf : propertyList) {
|
for (PropertyConfig propConf : propertyList) {
|
||||||
if (propConf.isIdent()) {
|
PropertyTableColumn propTableColumn = propConf.getPropTableColumn();
|
||||||
|
if (PropertyTableColumn.INTERNAL_KEY == propTableColumn) {
|
||||||
idKey = propConf.getId();
|
idKey = propConf.getId();
|
||||||
return idKey;
|
return idKey;
|
||||||
}
|
}
|
||||||
@ -398,13 +427,34 @@ public abstract class GenericModule implements Serializable {
|
|||||||
f.setData(key);
|
f.setData(key);
|
||||||
Layout layout = f.getLayout();
|
Layout layout = f.getLayout();
|
||||||
for (PropertyConfig prop : getModuleConfig().getPropertyList()) {
|
for (PropertyConfig prop : getModuleConfig().getPropertyList()) {
|
||||||
if (!prop.isIdent()) {
|
PropertyFormField propFormField = prop.getPropFormField();
|
||||||
TextField tf = new TextField(prop.getLabel());
|
if (propFormField != PropertyFormField.INTERNAL_KEY && propFormField != PropertyFormField.NONE) {
|
||||||
tf.setData(prop.getId());
|
if (prop.hasSelectList()) {
|
||||||
tf.setWidth(480.0f, Sizeable.UNITS_PIXELS);
|
Select sel = new Select(prop.getLabel());
|
||||||
Object value = row.get(prop.getId());
|
sel.setData(prop.getId());
|
||||||
tf.setValue(value != null ? value : "");
|
sel.setNullSelectionAllowed(false);
|
||||||
layout.addComponent(tf);
|
sel.setNewItemsAllowed(prop.newItemsAllowed());
|
||||||
|
Map<String, String> selectValues = prop.getSelectValues();
|
||||||
|
for (Object skey : selectValues.keySet()) {
|
||||||
|
sel.addItem(skey);
|
||||||
|
sel.setItemCaption(skey, selectValues.get(skey));
|
||||||
|
}
|
||||||
|
sel.setWidth(480.0f, Sizeable.UNITS_PIXELS);
|
||||||
|
Object value = row.get(prop.getId());
|
||||||
|
sel.setValue(value != null ? value : prop.getDefaultValue());
|
||||||
|
sel.setReadOnly(PropertyFormField.READONLY == propFormField || PropertyFormField.WRITEONCE == propFormField);
|
||||||
|
layout.addComponent(sel);
|
||||||
|
} else {
|
||||||
|
if (propFormField != PropertyFormField.PASSWORD) {
|
||||||
|
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 : prop.getDefaultValue());
|
||||||
|
tf.setReadOnly(PropertyFormField.READONLY == propFormField || PropertyFormField.WRITEONCE == propFormField);
|
||||||
|
layout.addComponent(tf);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return f;
|
return f;
|
||||||
@ -421,12 +471,41 @@ public abstract class GenericModule implements Serializable {
|
|||||||
f.setCaption(getModuleConfig().getLabel("new"));
|
f.setCaption(getModuleConfig().getLabel("new"));
|
||||||
Layout layout = f.getLayout();
|
Layout layout = f.getLayout();
|
||||||
for (PropertyConfig prop : getModuleConfig().getPropertyList()) {
|
for (PropertyConfig prop : getModuleConfig().getPropertyList()) {
|
||||||
if (!prop.isIdent()) {
|
PropertyFormField propFormField = prop.getPropFormField();
|
||||||
TextField tf = new TextField(prop.getLabel());
|
if (PropertyFormField.READWRITE == propFormField || PropertyFormField.WRITEONCE == propFormField || PropertyFormField.PASSWORD == propFormField) {
|
||||||
tf.setData(prop.getId());
|
if (prop.hasSelectList()) {
|
||||||
tf.setWidth(480.0f, Sizeable.UNITS_PIXELS);
|
Select sel = new Select(prop.getLabel());
|
||||||
tf.setValue("");
|
sel.setData(prop.getId());
|
||||||
layout.addComponent(tf);
|
sel.setNullSelectionAllowed(false);
|
||||||
|
sel.setNewItemsAllowed(prop.newItemsAllowed());
|
||||||
|
Map<String, String> selectValues = prop.getSelectValues();
|
||||||
|
for (Object key : selectValues.keySet()) {
|
||||||
|
sel.addItem(key);
|
||||||
|
sel.setItemCaption(key, selectValues.get(key));
|
||||||
|
}
|
||||||
|
sel.setWidth(480.0f, Sizeable.UNITS_PIXELS);
|
||||||
|
sel.setValue(prop.getDefaultValue());
|
||||||
|
layout.addComponent(sel);
|
||||||
|
} else {
|
||||||
|
if (PropertyFormField.PASSWORD == propFormField) {
|
||||||
|
PasswordField tf1 = new PasswordField(getModuleConfig().getLabel(prop.getId() + "1"));
|
||||||
|
tf1.setData(prop.getId());
|
||||||
|
tf1.setWidth(480.0f, Sizeable.UNITS_PIXELS);
|
||||||
|
tf1.setValue(prop.getDefaultValue());
|
||||||
|
layout.addComponent(tf1);
|
||||||
|
PasswordField tf2 = new PasswordField(getModuleConfig().getLabel(prop.getId() + "2"));
|
||||||
|
tf2.setData(prop.getId());
|
||||||
|
tf2.setWidth(480.0f, Sizeable.UNITS_PIXELS);
|
||||||
|
tf2.setValue(prop.getDefaultValue());
|
||||||
|
layout.addComponent(tf2);
|
||||||
|
} else {
|
||||||
|
TextField tf = new TextField(prop.getLabel());
|
||||||
|
tf.setData(prop.getId());
|
||||||
|
tf.setWidth(480.0f, Sizeable.UNITS_PIXELS);
|
||||||
|
tf.setValue(prop.getDefaultValue());
|
||||||
|
layout.addComponent(tf);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return f;
|
return f;
|
||||||
|
@ -95,7 +95,7 @@ public class MainApplication extends Application implements HttpServletRequestLi
|
|||||||
return servletContext.getInitParameter(string);
|
return servletContext.getInitParameter(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getLogin() {
|
public String getLogin() {
|
||||||
return userPrincipal.getName();
|
return userPrincipal.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import java.util.Date;
|
|||||||
|
|
||||||
import de.hsadmin.web.config.ModuleConfig;
|
import de.hsadmin.web.config.ModuleConfig;
|
||||||
import de.hsadmin.web.config.PropertyConfig;
|
import de.hsadmin.web.config.PropertyConfig;
|
||||||
|
import de.hsadmin.web.config.PropertyTableColumn;
|
||||||
|
|
||||||
public class QueueTaskModule extends GenericModule {
|
public class QueueTaskModule extends GenericModule {
|
||||||
|
|
||||||
@ -11,20 +12,21 @@ public class QueueTaskModule extends GenericModule {
|
|||||||
|
|
||||||
private ModuleConfig moduleConfig;
|
private ModuleConfig moduleConfig;
|
||||||
|
|
||||||
public QueueTaskModule() {
|
@Override
|
||||||
|
protected void initModule() {
|
||||||
moduleConfig = new ModuleConfig("q");
|
moduleConfig = new ModuleConfig("q");
|
||||||
moduleConfig.setUpdateAble(false);
|
moduleConfig.setUpdateAble(false);
|
||||||
moduleConfig.setDeleteAble(false);
|
moduleConfig.setDeleteAble(false);
|
||||||
moduleConfig.setAddAble(false);
|
moduleConfig.setAddAble(false);
|
||||||
moduleConfig.setSearchAble(false);
|
moduleConfig.setSearchAble(false);
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "id", Long.class, true, true));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "id", Long.class, PropertyTableColumn.INTERNAL_KEY));
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "title", String.class));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "title", String.class));
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "status", String.class));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "status", String.class));
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "started", Date.class));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "started", Date.class));
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "finished", Date.class));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "finished", Date.class));
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "user", String.class, true));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "user", String.class, PropertyTableColumn.HIDDEN));
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "details", String.class, true));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "details", String.class, PropertyTableColumn.HIDDEN));
|
||||||
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "exception", String.class, true));
|
moduleConfig.addProperty(new PropertyConfig(moduleConfig, "exception", String.class, PropertyTableColumn.HIDDEN));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,7 +1,14 @@
|
|||||||
package de.hsadmin.web;
|
package de.hsadmin.web;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
import de.hsadmin.web.config.ModuleConfig;
|
import de.hsadmin.web.config.ModuleConfig;
|
||||||
import de.hsadmin.web.config.PropertyConfig;
|
import de.hsadmin.web.config.PropertyConfig;
|
||||||
|
import de.hsadmin.web.config.PropertyDefaultValue;
|
||||||
|
import de.hsadmin.web.config.PropertyFormField;
|
||||||
|
import de.hsadmin.web.config.PropertySelectValues;
|
||||||
|
import de.hsadmin.web.config.PropertyTableColumn;
|
||||||
|
|
||||||
public class UnixUserModule extends GenericModule {
|
public class UnixUserModule extends GenericModule {
|
||||||
|
|
||||||
@ -9,26 +16,87 @@ public class UnixUserModule extends GenericModule {
|
|||||||
|
|
||||||
private ModuleConfig moduleConfig;
|
private ModuleConfig moduleConfig;
|
||||||
|
|
||||||
public UnixUserModule() {
|
@Override
|
||||||
|
protected void initModule() {
|
||||||
moduleConfig = new ModuleConfig("user");
|
moduleConfig = new ModuleConfig("user");
|
||||||
PropertyConfig propId = new PropertyConfig(moduleConfig, "id", Long.class, true, true);
|
String login = getApplication().getLogin();
|
||||||
moduleConfig.addProperty(propId);
|
final String pac = login.length() >= 5 ? login.substring(0, 5) : "";
|
||||||
PropertyConfig propUserId = new PropertyConfig(moduleConfig, "userid", Long.class, true);
|
PropertyConfig useridProp = new PropertyConfig(moduleConfig, "userid", Long.class, PropertyTableColumn.HIDDEN, PropertyFormField.READONLY);
|
||||||
moduleConfig.addProperty(propUserId);
|
PropertyConfig idProp = new PropertyConfig(moduleConfig, "id", Long.class, PropertyTableColumn.INTERNAL_KEY, PropertyFormField.INTERNAL_KEY);
|
||||||
PropertyConfig propUserName = new PropertyConfig(moduleConfig, "name", String.class);
|
PropertyConfig nameProp = new PropertyConfig(moduleConfig, "name", String.class, PropertyFormField.WRITEONCE);
|
||||||
moduleConfig.addProperty(propUserName);
|
nameProp.setDefaultValue(new PropertyDefaultValue() {
|
||||||
PropertyConfig propUserComment = new PropertyConfig(moduleConfig, "comment", String.class);
|
@Override
|
||||||
moduleConfig.addProperty(propUserComment);
|
public String getDefaultValue() {
|
||||||
PropertyConfig propShell = new PropertyConfig(moduleConfig, "shell", String.class);
|
if (pac.length() > 0) {
|
||||||
moduleConfig.addProperty(propShell);
|
return pac + "-";
|
||||||
PropertyConfig propHomeDir = new PropertyConfig(moduleConfig, "homedir", String.class, true);
|
}
|
||||||
moduleConfig.addProperty(propHomeDir);
|
return "";
|
||||||
PropertyConfig propPacket = new PropertyConfig(moduleConfig, "pac", String.class, true);
|
}
|
||||||
moduleConfig.addProperty(propPacket);
|
});
|
||||||
PropertyConfig propSoftQuota = new PropertyConfig(moduleConfig, "quota_softlimit", Long.class, true);
|
PropertyConfig passwordProp = new PropertyConfig(moduleConfig, "password", String.class, PropertyTableColumn.NONE, PropertyFormField.PASSWORD);
|
||||||
moduleConfig.addProperty(propSoftQuota);
|
PropertyConfig commentProp = new PropertyConfig(moduleConfig, "comment", String.class);
|
||||||
PropertyConfig propHardQuota = new PropertyConfig(moduleConfig, "quota_hardlimit", Long.class, true);
|
PropertyConfig shellProp = new PropertyConfig(moduleConfig, "shell", String.class);
|
||||||
moduleConfig.addProperty(propHardQuota);
|
shellProp.setDefaultValue(new PropertyDefaultValue() {
|
||||||
|
@Override
|
||||||
|
public String getDefaultValue() {
|
||||||
|
return "/usr/bin/passwd";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
shellProp.setSelectValues(new PropertySelectValues() {
|
||||||
|
@Override
|
||||||
|
public boolean newItemsAllowed() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public Map<String, String> getSelectValues() {
|
||||||
|
Map<String,String> map = new TreeMap<String, String>();
|
||||||
|
map.put("/usr/bin/passwd", "/usr/bin/passwd");
|
||||||
|
map.put("/bin/bash", "/bin/bash");
|
||||||
|
map.put("/bin/dash", "/bin/dash");
|
||||||
|
map.put("/bin/csh", "/bin/csh");
|
||||||
|
map.put("/bin/tcsh", "/bin/tcsh");
|
||||||
|
map.put("/bin/ksh", "/bin/ksh");
|
||||||
|
map.put("/bin/zsh", "/bin/zsh");
|
||||||
|
map.put("/usr/bin/scponly", "/usr/bin/scponly");
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean hasSelectList() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
PropertyConfig homedirProp = new PropertyConfig(moduleConfig, "homedir", String.class, PropertyTableColumn.HIDDEN, PropertyFormField.READONLY);
|
||||||
|
PropertyConfig pacProp = new PropertyConfig(moduleConfig, "pac", String.class, PropertyTableColumn.HIDDEN, PropertyFormField.READONLY);
|
||||||
|
pacProp.setDefaultValue(new PropertyDefaultValue() {
|
||||||
|
@Override
|
||||||
|
public String getDefaultValue() {
|
||||||
|
return pac;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
PropertyConfig softQuotaProp = new PropertyConfig(moduleConfig, "quota_softlimit", Long.class, PropertyTableColumn.HIDDEN);
|
||||||
|
softQuotaProp.setDefaultValue(new PropertyDefaultValue() {
|
||||||
|
@Override
|
||||||
|
public String getDefaultValue() {
|
||||||
|
return "0";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
PropertyConfig hardQuotaProp = new PropertyConfig(moduleConfig, "quota_hardlimit", Long.class, PropertyTableColumn.HIDDEN);
|
||||||
|
hardQuotaProp.setDefaultValue(new PropertyDefaultValue() {
|
||||||
|
@Override
|
||||||
|
public String getDefaultValue() {
|
||||||
|
return "0";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
moduleConfig.addProperty(idProp);
|
||||||
|
moduleConfig.addProperty(useridProp);
|
||||||
|
moduleConfig.addProperty(nameProp);
|
||||||
|
moduleConfig.addProperty(passwordProp);
|
||||||
|
moduleConfig.addProperty(commentProp);
|
||||||
|
moduleConfig.addProperty(shellProp);
|
||||||
|
moduleConfig.addProperty(homedirProp);
|
||||||
|
moduleConfig.addProperty(pacProp);
|
||||||
|
moduleConfig.addProperty(softQuotaProp);
|
||||||
|
moduleConfig.addProperty(hardQuotaProp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -84,4 +84,20 @@ public class ModuleConfig implements Serializable {
|
|||||||
this.searchAble = searchAble;
|
this.searchAble = searchAble;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getNumOfColumns() {
|
||||||
|
int numOfCols = 0;
|
||||||
|
for (PropertyConfig prop : propertyList) {
|
||||||
|
if (prop.getPropTableColumn() != PropertyTableColumn.NONE) {
|
||||||
|
numOfCols++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isUpdateAble()) {
|
||||||
|
numOfCols++;
|
||||||
|
}
|
||||||
|
if (isDeleteAble()) {
|
||||||
|
numOfCols++;
|
||||||
|
}
|
||||||
|
return numOfCols;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,53 +1,65 @@
|
|||||||
package de.hsadmin.web.config;
|
package de.hsadmin.web.config;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class PropertyConfig implements Serializable {
|
public class PropertyConfig implements Serializable, PropertyDefaultValue, PropertySelectValues {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private ModuleConfig moduleConfig;
|
private ModuleConfig moduleConfig;
|
||||||
private String id;
|
private String id;
|
||||||
private Class<?> type;
|
private Class<?> type;
|
||||||
private String defaultValue;
|
private PropertyTableColumn propTableColumn;
|
||||||
private boolean hidden;
|
private PropertyFormField propFormField;
|
||||||
private boolean ident;
|
private PropertyDefaultValue defaultValue;
|
||||||
|
private PropertySelectValues selectValues;
|
||||||
|
|
||||||
public PropertyConfig(ModuleConfig moduleConfig, String id, Class<?> clasz) {
|
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 = "";
|
this.propTableColumn = PropertyTableColumn.DISPLAY;
|
||||||
this.setHidden(false);
|
this.propFormField = PropertyFormField.READWRITE;
|
||||||
this.setIdent(false);
|
this.defaultValue = null;
|
||||||
|
this.selectValues = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PropertyConfig(ModuleConfig moduleConfig, String id, Class<?> clasz, boolean hidden) {
|
public PropertyConfig(ModuleConfig moduleConfig, String id, Class<?> clasz, PropertyFormField formField) {
|
||||||
this.moduleConfig = moduleConfig;
|
this.moduleConfig = moduleConfig;
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.type = clasz;
|
this.type = clasz;
|
||||||
this.defaultValue = "";
|
this.propTableColumn = PropertyTableColumn.DISPLAY;
|
||||||
this.setHidden(hidden);
|
this.propFormField = formField;
|
||||||
this.setIdent(false);
|
this.defaultValue = null;
|
||||||
|
this.selectValues = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PropertyConfig(ModuleConfig moduleConfig, String id, Class<?> clasz, boolean hidden, boolean ident) {
|
public PropertyConfig(ModuleConfig moduleConfig, String id, Class<?> clasz, PropertyTableColumn tablecolumn) {
|
||||||
this.moduleConfig = moduleConfig;
|
this.moduleConfig = moduleConfig;
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.type = clasz;
|
this.type = clasz;
|
||||||
this.defaultValue = "";
|
this.propTableColumn = tablecolumn;
|
||||||
this.setHidden(hidden);
|
this.propFormField = PropertyFormField.READWRITE;
|
||||||
this.setIdent(ident);
|
this.defaultValue = null;
|
||||||
|
this.selectValues = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PropertyConfig(ModuleConfig moduleConfig, String id, Class<?> clasz, PropertyTableColumn tablecolumn, PropertyFormField formField) {
|
||||||
|
this.moduleConfig = moduleConfig;
|
||||||
|
this.id = id;
|
||||||
|
this.type = clasz;
|
||||||
|
this.propTableColumn = tablecolumn;
|
||||||
|
this.propFormField = formField;
|
||||||
|
this.defaultValue = null;
|
||||||
|
this.selectValues = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(String id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
return moduleConfig.getLabel(id);
|
return moduleConfig.getLabel(id);
|
||||||
}
|
}
|
||||||
@ -56,32 +68,49 @@ public class PropertyConfig implements Serializable {
|
|||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setType(Class<?> type) {
|
public PropertyTableColumn getPropTableColumn() {
|
||||||
this.type = type;
|
return propTableColumn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDefaultValue() {
|
public PropertyFormField getPropFormField() {
|
||||||
return defaultValue;
|
return propFormField;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDefaultValue(String defaultValue) {
|
public void setDefaultValue(PropertyDefaultValue defaultValue) {
|
||||||
this.defaultValue = defaultValue;
|
this.defaultValue = defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHidden(boolean hidden) {
|
public void setSelectValues(PropertySelectValues selectValues) {
|
||||||
this.hidden = hidden;
|
this.selectValues = selectValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isHidden() {
|
public String getDefaultValue() {
|
||||||
return hidden;
|
if (defaultValue != null) {
|
||||||
|
return defaultValue.getDefaultValue();
|
||||||
|
}
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIdent(boolean ident) {
|
public Map<String, String> getSelectValues() {
|
||||||
this.ident = ident;
|
if (selectValues != null) {
|
||||||
|
return selectValues.getSelectValues();
|
||||||
|
}
|
||||||
|
return new HashMap<String, String>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isIdent() {
|
public boolean newItemsAllowed() {
|
||||||
return ident;
|
if (selectValues != null) {
|
||||||
|
return selectValues.newItemsAllowed();
|
||||||
|
}
|
||||||
|
return propFormField == PropertyFormField.READWRITE || propFormField == PropertyFormField.WRITEONCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasSelectList() {
|
||||||
|
if (selectValues != null) {
|
||||||
|
return selectValues.hasSelectList();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
package de.hsadmin.web.config;
|
||||||
|
|
||||||
|
public interface PropertyDefaultValue {
|
||||||
|
|
||||||
|
public abstract String getDefaultValue();
|
||||||
|
|
||||||
|
}
|
10
hsarweb/src/de/hsadmin/web/config/PropertyFormField.java
Normal file
10
hsarweb/src/de/hsadmin/web/config/PropertyFormField.java
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
package de.hsadmin.web.config;
|
||||||
|
|
||||||
|
public enum PropertyFormField {
|
||||||
|
INTERNAL_KEY,
|
||||||
|
READWRITE,
|
||||||
|
WRITEONCE,
|
||||||
|
READONLY,
|
||||||
|
PASSWORD,
|
||||||
|
NONE
|
||||||
|
}
|
13
hsarweb/src/de/hsadmin/web/config/PropertySelectValues.java
Normal file
13
hsarweb/src/de/hsadmin/web/config/PropertySelectValues.java
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package de.hsadmin.web.config;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public interface PropertySelectValues {
|
||||||
|
|
||||||
|
public abstract Map<String, String> getSelectValues();
|
||||||
|
|
||||||
|
public abstract boolean newItemsAllowed();
|
||||||
|
|
||||||
|
public abstract boolean hasSelectList();
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
package de.hsadmin.web.config;
|
||||||
|
|
||||||
|
public enum PropertyTableColumn {
|
||||||
|
INTERNAL_KEY,
|
||||||
|
DISPLAY,
|
||||||
|
HIDDEN,
|
||||||
|
NONE
|
||||||
|
}
|
@ -7,3 +7,4 @@ since=connected since
|
|||||||
moduletitle=domains
|
moduletitle=domains
|
||||||
moduleicon=../runo/icons/16/document-web.png
|
moduleicon=../runo/icons/16/document-web.png
|
||||||
new=configure domain
|
new=configure domain
|
||||||
|
update=update domain
|
@ -7,3 +7,4 @@ since=aufgeschaltet seit
|
|||||||
moduletitle=Domains
|
moduletitle=Domains
|
||||||
moduleicon=../runo/icons/16/document-web.png
|
moduleicon=../runo/icons/16/document-web.png
|
||||||
new=Domain konfigurieren
|
new=Domain konfigurieren
|
||||||
|
update=Domaindaten ändern
|
@ -10,3 +10,4 @@ fulldomain=full domain
|
|||||||
moduletitle=email addresses
|
moduletitle=email addresses
|
||||||
moduleicon=../runo/icons/16/email.png
|
moduleicon=../runo/icons/16/email.png
|
||||||
new=create address
|
new=create address
|
||||||
|
update=update address
|
@ -10,3 +10,4 @@ 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
|
new=EMail-Adresse anlegen
|
||||||
|
update=EMail-Adresse ändern
|
@ -5,3 +5,4 @@ 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
|
new=create alias
|
||||||
|
update=update alias
|
@ -5,3 +5,4 @@ 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
|
new=EMail-Alias anlegen
|
||||||
|
update=EMail-Alias ändern
|
@ -4,3 +4,6 @@ delete=delete
|
|||||||
confirmdelete=confirm delete
|
confirmdelete=confirm delete
|
||||||
save=save
|
save=save
|
||||||
abort=abort
|
abort=abort
|
||||||
|
new=new
|
||||||
|
impressum.label=Published by
|
||||||
|
impressum.link=http://www.hostsharing.net/impressum
|
@ -4,3 +4,6 @@ delete=l
|
|||||||
confirmdelete=Diesen Eintrag löschen?
|
confirmdelete=Diesen Eintrag löschen?
|
||||||
save=speichern
|
save=speichern
|
||||||
abort=abbrechen
|
abort=abbrechen
|
||||||
|
new=Eintrag anlegen
|
||||||
|
impressum.label=Impressum
|
||||||
|
impressum.link=http://www.hostsharing.net/impressum
|
@ -1,5 +1,7 @@
|
|||||||
id=identifier
|
id=identifier
|
||||||
name=username
|
name=username
|
||||||
|
password1=password
|
||||||
|
password2=repeat password
|
||||||
comment=comment
|
comment=comment
|
||||||
shell=shell
|
shell=shell
|
||||||
userid=numeric userid
|
userid=numeric userid
|
||||||
@ -9,4 +11,5 @@ quota_softlimit=quota soft limit
|
|||||||
quota_hardlimit=quota hard limit
|
quota_hardlimit=quota hard limit
|
||||||
moduletitle=unix user
|
moduletitle=unix user
|
||||||
new=create user
|
new=create user
|
||||||
|
update=update user
|
||||||
moduleicon=../runo/icons/16/users.png
|
moduleicon=../runo/icons/16/users.png
|
@ -1,5 +1,7 @@
|
|||||||
id=Schlüssel
|
id=Schlüssel
|
||||||
name=Benutzername
|
name=Benutzername
|
||||||
|
password1=Passwort
|
||||||
|
password2=Passwort (Wdhlg.)
|
||||||
comment=Kommentar
|
comment=Kommentar
|
||||||
shell=Shell
|
shell=Shell
|
||||||
userid=Benutzerkennung
|
userid=Benutzerkennung
|
||||||
@ -10,3 +12,4 @@ quota_hardlimit=Hard-Quota [MB]
|
|||||||
moduletitle=Unix User
|
moduletitle=Unix User
|
||||||
moduleicon=../runo/icons/16/users.png
|
moduleicon=../runo/icons/16/users.png
|
||||||
new=Benutzer anlegen
|
new=Benutzer anlegen
|
||||||
|
update=Benutzer ändern
|
Loading…
Reference in New Issue
Block a user