4 files added
15 files modified
| | |
| | | public void buttonClick(ClickEvent event) { |
| | | application.getMainWindow().removeWindow(childWindow); |
| | | try { |
| | | Map<String, String> map = new HashMap<String, String>(); |
| | | Map<String, AbstractProperty> map = new HashMap<String, AbstractProperty>(); |
| | | genericForm.transferToHash(map, form); |
| | | ((InsertAble) thisModule).insertRow(map); |
| | | componentFactory.loadData(); |
New file |
| | |
| | | package de.hsadmin.web; |
| | | |
| | | public class AbstractProperty { |
| | | |
| | | } |
| | |
| | | public List<String> getDatabaseUsers() { |
| | | ArrayList<String> list = new ArrayList<String>(); |
| | | try { |
| | | Object callSearch = getApplication().getRemote().callSearch(getUserModuleIdent(), new HashMap<String, String>()); |
| | | Object callSearch = getApplication().getRemote().callSearch(getUserModuleIdent(), new HashMap<String, AbstractProperty>()); |
| | | if (callSearch instanceof Object[]) { |
| | | for (Object row : ((Object[])callSearch)) { |
| | | if (row instanceof Map<?, ?>) { |
| | |
| | | |
| | | public interface DeleteAble { |
| | | |
| | | public void deleteRow(Map<String, String> paramHash) throws HsarwebException; |
| | | public void deleteRow(Map<String, AbstractProperty> paramHash) throws HsarwebException; |
| | | |
| | | } |
| | |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public void insertRow(Map<String, String> paramHash) throws HsarwebException { |
| | | public void insertRow(Map<String, AbstractProperty> paramHash) throws HsarwebException { |
| | | getApplication().getRemote().callAdd(getModuleConfig().getRemoteName(), paramHash); |
| | | } |
| | | |
| | | public void deleteRow(Map<String, String> paramHash) throws HsarwebException { |
| | | public void deleteRow(Map<String, AbstractProperty> paramHash) throws HsarwebException { |
| | | getApplication().getRemote().callDelete(getModuleConfig().getRemoteName(), paramHash); |
| | | } |
| | | |
| | | public void updateRow(Map<String, String> paramHash) throws HsarwebException { |
| | | Map<String, String> whereHash = new HashMap<String, String>(); |
| | | public void updateRow(Map<String, AbstractProperty> paramHash) throws HsarwebException { |
| | | Map<String, AbstractProperty> whereHash = new HashMap<String, AbstractProperty>(); |
| | | String idKey = findIdKey(); |
| | | whereHash.put(idKey, paramHash.get(idKey)); |
| | | getApplication().getRemote().callUpdate(getModuleConfig().getRemoteName(), paramHash, whereHash); |
| | |
| | | public List<String> getUsers() { |
| | | ArrayList<String> list = new ArrayList<String>(); |
| | | try { |
| | | Object callSearch = getApplication().getRemote().callSearch("user", new HashMap<String, String>()); |
| | | Object callSearch = getApplication().getRemote().callSearch("user", new HashMap<String, AbstractProperty>()); |
| | | if (callSearch instanceof Object[]) { |
| | | for (Object row : ((Object[])callSearch)) { |
| | | if (row instanceof Map<?, ?>) { |
| | |
| | | public List<String> getEMailAliases() { |
| | | ArrayList<String> list = new ArrayList<String>(); |
| | | try { |
| | | Object callSearch = getApplication().getRemote().callSearch("emailalias", new HashMap<String, String>()); |
| | | Object callSearch = getApplication().getRemote().callSearch("emailalias", new HashMap<String, AbstractProperty>()); |
| | | if (callSearch instanceof Object[]) { |
| | | for (Object row : ((Object[])callSearch)) { |
| | | if (row instanceof Map<?, ?>) { |
| | |
| | | public List<String> getDomains() { |
| | | ArrayList<String> list = new ArrayList<String>(); |
| | | try { |
| | | Object callSearch = getApplication().getRemote().callSearch("domain", new HashMap<String, String>()); |
| | | Object callSearch = getApplication().getRemote().callSearch("domain", new HashMap<String, AbstractProperty>()); |
| | | if (callSearch instanceof Object[]) { |
| | | for (Object row : ((Object[])callSearch)) { |
| | | if (row instanceof Map<?, ?>) { |
| | |
| | | public List<String> getPackets() { |
| | | ArrayList<String> list = new ArrayList<String>(); |
| | | try { |
| | | Object callSearch = getApplication().getRemote().callSearch("pac", new HashMap<String, String>()); |
| | | Object callSearch = getApplication().getRemote().callSearch("pac", new HashMap<String, AbstractProperty>()); |
| | | if (callSearch instanceof Object[]) { |
| | | for (Object row : ((Object[])callSearch)) { |
| | | if (row instanceof Map<?, ?>) { |
| | |
| | | |
| | | public interface InsertAble { |
| | | |
| | | public void insertRow(Map<String, String> paramHash) throws HsarwebException; |
| | | public void insertRow(Map<String, AbstractProperty> paramHash) throws HsarwebException; |
| | | |
| | | } |
New file |
| | |
| | | package de.hsadmin.web; |
| | | |
| | | import java.util.List; |
| | | |
| | | public class ListOfStringsProperty extends AbstractProperty { |
| | | public List<String> properties; |
| | | |
| | | public ListOfStringsProperty(){ |
| | | // ?? this.properties = new List<String>(); |
| | | } |
| | | |
| | | public boolean Add(String string){ |
| | | return properties.add(string); |
| | | } |
| | | } |
| | |
| | | this.app = application; |
| | | } |
| | | |
| | | public Object callSearch(String module, Map<String, String> where) throws HsarwebException { |
| | | public Object callSearch(String module, Map<String, AbstractProperty> where) throws HsarwebException { |
| | | return xmlrpcCall(module, "search", where); |
| | | } |
| | | |
| | | public void callAdd(String module, Map<String, String> set) throws HsarwebException { |
| | | public void callAdd(String module, Map<String, AbstractProperty> set) throws HsarwebException { |
| | | xmlrpcCall(module, "add", set); |
| | | } |
| | | |
| | | public void callUpdate(String module, Map<String, String> set, Map<String, String> where) throws HsarwebException { |
| | | public void callUpdate(String module, Map<String, AbstractProperty> set, Map<String, AbstractProperty> 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, AbstractProperty> where) throws HsarwebException { |
| | | xmlrpcCall(module, "delete", where); |
| | | } |
| | | |
| | | private Object xmlrpcCall(String module, String operation, Map<String, String> param1) throws HsarwebException { |
| | | private Object xmlrpcCall(String module, String operation, Map<String, AbstractProperty> param1) throws HsarwebException { |
| | | Object[] params = new Object[3]; |
| | | params[0] = app.getRunAs(); |
| | | params[1] = app.getProxyTicket(); |
| | |
| | | return xmlrpcCall(module + "." + operation, params); |
| | | } |
| | | |
| | | private Object xmlrpcCall(String module, String operation, Map<String, String> param1, Map<String, String> param2) throws HsarwebException { |
| | | private Object xmlrpcCall(String module, String operation, Map<String, AbstractProperty> param1, Map<String, AbstractProperty> param2) throws HsarwebException { |
| | | Object[] params = new Object[4]; |
| | | params[0] = app.getRunAs(); |
| | | params[1] = app.getProxyTicket(); |
| | |
| | | } |
| | | return client; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package de.hsadmin.web; |
| | | |
| | | public class StringProperty extends AbstractProperty { |
| | | public String property ; |
| | | |
| | | public StringProperty(String property) { |
| | | this.property = property; |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | public interface UpdateAble { |
| | | |
| | | public void updateRow(Map<String, String> paramHash) throws HsarwebException; |
| | | public void updateRow(Map<String, AbstractProperty> paramHash) throws HsarwebException; |
| | | |
| | | } |
| | |
| | | package de.hsadmin.web.config; |
| | | |
| | | import de.hsadmin.web.AbstractProperty; |
| | | import de.hsadmin.web.HsarwebException; |
| | | |
| | | public interface PropertyFieldFactory { |
| | | |
| | | public Object createFieldComponent(PropertyConfig prop, Object value); |
| | | |
| | | public String getValue(PropertyConfig prop, Object component) throws HsarwebException; |
| | | public AbstractProperty getValue(PropertyConfig prop, Object component) throws HsarwebException; |
| | | |
| | | public void setReadOnly(boolean readOnly); |
| | | |
| | |
| | | import com.vaadin.ui.DateField; |
| | | import com.vaadin.ui.PopupDateField; |
| | | |
| | | import de.hsadmin.web.AbstractProperty; |
| | | import de.hsadmin.web.StringProperty; |
| | | import de.hsadmin.web.config.PropertyConfig; |
| | | import de.hsadmin.web.config.PropertyFieldFactory; |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public String getValue(PropertyConfig prop, Object component) { |
| | | public AbstractProperty getValue(PropertyConfig prop, Object component) { |
| | | if (component instanceof DateField) { |
| | | return serverDf.format((Date) ((DateField) component).getValue()); |
| | | return (new StringProperty(serverDf.format((Date) ((DateField) component).getValue()))); // TODO: besser DateProperty ? |
| | | } |
| | | return null; |
| | | } |
| | |
| | | import com.vaadin.terminal.Sizeable; |
| | | import com.vaadin.ui.TextField; |
| | | |
| | | import de.hsadmin.web.AbstractProperty; |
| | | import de.hsadmin.web.StringProperty; |
| | | import de.hsadmin.web.config.PropertyConfig; |
| | | import de.hsadmin.web.config.PropertyFieldFactory; |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public String getValue(PropertyConfig prop, Object component) { |
| | | public AbstractProperty getValue(PropertyConfig prop, Object component) { |
| | | if (component instanceof TextField) { |
| | | return (String) ((TextField) component).getValue(); |
| | | return new StringProperty((String) ((TextField) component).getValue()); |
| | | } |
| | | return null; |
| | | } |
New file |
| | |
| | | /** |
| | | * |
| | | */ |
| | | package de.hsadmin.web.vaadin; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | import com.vaadin.data.Property; |
| | | import com.vaadin.data.Property.ValueChangeEvent; |
| | | import com.vaadin.terminal.Sizeable; |
| | | import com.vaadin.ui.AbstractField; |
| | | import com.vaadin.ui.HorizontalLayout; |
| | | import com.vaadin.ui.Select; |
| | | import com.vaadin.ui.VerticalLayout; |
| | | |
| | | import de.hsadmin.web.AbstractProperty; |
| | | import de.hsadmin.web.HsarwebException; |
| | | import de.hsadmin.web.ListOfStringsProperty; |
| | | import de.hsadmin.web.config.PropertyConfig; |
| | | import de.hsadmin.web.config.PropertyFieldFactory; |
| | | |
| | | /** |
| | | * @author pblissenbach |
| | | * |
| | | */ |
| | | public class DomainOptionsPropertyFieldFactory implements PropertyFieldFactory { |
| | | private Map<String,AbstractProperty> optionTypes ; // TODO: auf Vorrat hier |
| | | private ListOfStringsProperty setOptions ; |
| | | private boolean readOnly = false; |
| | | private boolean writeOnce = false; |
| | | private VerticalLayout layout; |
| | | |
| | | public DomainOptionsPropertyFieldFactory() { |
| | | // TODO: besorge Options und ihre Typen aus der DB |
| | | optionTypes = new HashMap<String,AbstractProperty>() ; |
| | | optionTypes.put("backupmxforexternalmx", null); |
| | | optionTypes.put("greylisting", null); |
| | | optionTypes.put("htdocsfallback", null); |
| | | optionTypes.put("includes", null); |
| | | optionTypes.put("indexes", null); |
| | | optionTypes.put("multiviews", null); |
| | | optionTypes.put("nonexistiondomainoptionfortesting", null); // TESTCASE |
| | | optionTypes.put("php", null); |
| | | // TODO: besorge Options .... Ende |
| | | // setOptions = null ; |
| | | setOptions = new ListOfStringsProperty() ; |
| | | // TODO Auto-generated constructor stub |
| | | } |
| | | |
| | | @Override |
| | | public Object createFieldComponent(PropertyConfig prop, Object value) { |
| | | // TODO Auto-generated method stub |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public AbstractProperty getValue(PropertyConfig prop, Object component) |
| | | throws HsarwebException { |
| | | return setOptions; |
| | | } |
| | | |
| | | @Override |
| | | public void setReadOnly(boolean readOnly) { |
| | | this.readOnly = readOnly; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isReadOnly() { |
| | | return readOnly; |
| | | } |
| | | |
| | | @Override |
| | | public void setWriteOnce(boolean writeOnce) { |
| | | this.writeOnce = writeOnce; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isWriteOnce() { |
| | | return writeOnce; |
| | | } |
| | | |
| | | class SingleDomainOption { |
| | | private HorizontalLayout targetLine; |
| | | private HorizontalLayout leftPart; |
| | | private HorizontalLayout rightPart; |
| | | private int index; |
| | | private String optionName; |
| | | private String testunusedoptionName; |
| | | private DomainOptionsPropertyFieldFactory owner; |
| | | |
| | | protected SingleDomainOption(DomainOptionsPropertyFieldFactory owner, int key, String optionName, Object optionValue) { |
| | | this.owner = owner; |
| | | this.index = key; |
| | | this.optionName = optionName; |
| | | targetLine = new HorizontalLayout(); |
| | | targetLine.setWidth(480.0f, Sizeable.UNITS_PIXELS); |
| | | leftPart = new HorizontalLayout(); |
| | | leftPart.setWidth(100.0f, Sizeable.UNITS_PIXELS); |
| | | leftPart.setCaption(optionName); |
| | | rightPart = new HorizontalLayout(); |
| | | rightPart.setWidth(380.0f, Sizeable.UNITS_PIXELS); |
| | | // ToDO: Fallunterscheidungen nach Optionsart. Z.Z. nur Boolean. |
| | | } |
| | | |
| | | public String getValue() { |
| | | String value = null; |
| | | if (rightPart.getComponentCount() > 0) { |
| | | Object object = ((AbstractField) rightPart.getComponent(0)).getValue(); |
| | | if (object != null && object instanceof String) { |
| | | value = ((String) object).trim(); |
| | | } |
| | | } |
| | | return value; |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.vaadin.ui.TextField; |
| | | import com.vaadin.ui.VerticalLayout; |
| | | |
| | | import de.hsadmin.web.AbstractProperty; |
| | | import de.hsadmin.web.GenericModule; |
| | | import de.hsadmin.web.HsarwebException; |
| | | import de.hsadmin.web.Module; |
| | | import de.hsadmin.web.StringProperty; |
| | | import de.hsadmin.web.config.PropertyConfig; |
| | | import de.hsadmin.web.config.PropertyFieldFactory; |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public String getValue(PropertyConfig prop, Object component) throws HsarwebException { |
| | | public AbstractProperty getValue(PropertyConfig prop, Object component) throws HsarwebException { |
| | | StringBuffer target = new StringBuffer(); |
| | | boolean insertKomma = false; |
| | | for (Integer key : targets.keySet()) { |
| | |
| | | insertKomma = true; |
| | | } |
| | | } |
| | | return target.toString(); |
| | | return new StringProperty(target.toString()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.vaadin.ui.Form; |
| | | import com.vaadin.ui.Layout; |
| | | |
| | | import de.hsadmin.web.AbstractProperty; |
| | | import de.hsadmin.web.HsarwebException; |
| | | import de.hsadmin.web.MainApplication; |
| | | import de.hsadmin.web.Module; |
| | | import de.hsadmin.web.StringProperty; |
| | | import de.hsadmin.web.config.ModuleConfig; |
| | | import de.hsadmin.web.config.PropertyConfig; |
| | | import de.hsadmin.web.config.PropertyFieldFactory; |
| | |
| | | try { |
| | | MainApplication application = module.getApplication(); |
| | | ModuleConfig config = module.getModuleConfig(); |
| | | Map<String, String> where = new HashMap<String, String>(); |
| | | where.put(findIdKey(), entityId.toString()); |
| | | Map<String, AbstractProperty> where = new HashMap<String, AbstractProperty>(); |
| | | where.put(findIdKey(), new StringProperty(entityId.toString())); |
| | | Object searchResult = application.getRemote().callSearch(config.getRemoteName(), where); |
| | | if (searchResult instanceof Object[]) { |
| | | Map<?, ?> row = (Map<?, ?>) (((Object[]) searchResult)[0]); |
| | |
| | | return idKey; |
| | | } |
| | | |
| | | public void transferToHash(Map<String, String> map, Form form) throws HsarwebException { |
| | | public void transferToHash(Map<String, AbstractProperty> map, Form form) throws HsarwebException { |
| | | Iterator<Component> iterator = form.getLayout().getComponentIterator(); |
| | | Object formData = form.getData(); |
| | | if (formData != null && formData instanceof Long) { |
| | | map.put(findIdKey(), ((Long) formData).toString()); |
| | | map.put(findIdKey(), new StringProperty(((Long) formData).toString())); |
| | | } |
| | | while (iterator.hasNext()) { |
| | | Component component = (Component) iterator.next(); |
| | |
| | | import com.vaadin.ui.PasswordField; |
| | | import com.vaadin.ui.VerticalLayout; |
| | | |
| | | import de.hsadmin.web.AbstractProperty; |
| | | import de.hsadmin.web.HsarwebException; |
| | | import de.hsadmin.web.Module; |
| | | import de.hsadmin.web.StringProperty; |
| | | import de.hsadmin.web.config.ModuleConfig; |
| | | import de.hsadmin.web.config.PropertyConfig; |
| | | import de.hsadmin.web.config.PropertyFieldFactory; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public String getValue(PropertyConfig prop, Object component) throws HsarwebException { |
| | | public AbstractProperty getValue(PropertyConfig prop, Object component) throws HsarwebException { |
| | | if (component instanceof VerticalLayout) { |
| | | VerticalLayout layout = (VerticalLayout) component; |
| | | PasswordField pw1 = (PasswordField) layout.getComponent(0); |
| | | PasswordField pw2 = (PasswordField) layout.getComponent(1); |
| | | if (pw1.getValue().equals(pw2.getValue())) { |
| | | return (String) pw1.getValue(); |
| | | return new StringProperty((String) pw1.getValue()); |
| | | } else { |
| | | throw new HsarwebException("password mismatch"); |
| | | } |
| | |
| | | import com.vaadin.terminal.Sizeable; |
| | | import com.vaadin.ui.Select; |
| | | |
| | | import de.hsadmin.web.AbstractProperty; |
| | | import de.hsadmin.web.HsarwebException; |
| | | import de.hsadmin.web.StringProperty; |
| | | import de.hsadmin.web.config.PropertyConfig; |
| | | import de.hsadmin.web.config.PropertyFieldFactory; |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public String getValue(PropertyConfig prop, Object component) |
| | | public AbstractProperty getValue(PropertyConfig prop, Object component) |
| | | throws HsarwebException { |
| | | if (component instanceof Select) { |
| | | return (String) ((Select) component).getValue(); |
| | | return new StringProperty((String) ((Select) component).getValue()); |
| | | } |
| | | return null; |
| | | } |
| | |
| | | import com.vaadin.ui.Window; |
| | | import com.vaadin.ui.themes.BaseTheme; |
| | | |
| | | import de.hsadmin.web.AbstractProperty; |
| | | import de.hsadmin.web.DeleteAble; |
| | | import de.hsadmin.web.HsarwebException; |
| | | import de.hsadmin.web.MainApplication; |
| | | import de.hsadmin.web.Module; |
| | | import de.hsadmin.web.StringProperty; |
| | | import de.hsadmin.web.UpdateAble; |
| | | import de.hsadmin.web.config.ComponentFactory; |
| | | import de.hsadmin.web.config.LocaleConfig; |
| | |
| | | table.removeAllItems(); |
| | | try { |
| | | ModuleConfig moduleConfig = module.getModuleConfig(); |
| | | Object callSearch = module.getApplication().getRemote().callSearch(moduleConfig.getRemoteName(), new HashMap<String, String>()); |
| | | Object callSearch = module.getApplication().getRemote().callSearch(moduleConfig.getRemoteName(), new HashMap<String, AbstractProperty>()); |
| | | List<PropertyConfig> propertyList = moduleConfig.getPropertyList(); |
| | | if (callSearch instanceof Object[]) { |
| | | for (Object row : ((Object[])callSearch)) { |
| | |
| | | public void buttonClick(ClickEvent event) { |
| | | application.getMainWindow().removeWindow(childWindow); |
| | | try { |
| | | Map<String, String> map = new HashMap<String, String>(); |
| | | Map<String, AbstractProperty> map = new HashMap<String, AbstractProperty>(); |
| | | genericForm.transferToHash(map, form); |
| | | ((UpdateAble) module).updateRow(map); |
| | | loadData(); |
| | |
| | | public void buttonClick(ClickEvent event) { |
| | | application.getMainWindow().removeWindow(childWindow); |
| | | try { |
| | | Map<String, String> map = new HashMap<String, String>(); |
| | | map.put(findIdKey(), ((Long) button.getData()).toString()); |
| | | Map<String, AbstractProperty> map = new HashMap<String, AbstractProperty>(); |
| | | map.put(findIdKey(), new StringProperty(((Long) button.getData()).toString())); |
| | | ((DeleteAble) module).deleteRow(map); |
| | | loadData(); |
| | | } catch (HsarwebException e) { |