HSAdmin Backend Domains, E-Mail, Datenbanken
Purodha
2013-02-20 c5c575c095248791d95b604efc439a8a8212d5a8
SelectableValues can now be annotated with kind of data (e.g.
SINGLEVALUE, DOMAINOPTIONS, et al), and these annotations are passed to
remote via moduleprop.search
3 files modified
1 files added
40 ■■■■■ changed files
hsarback/src/de/hsadmin/core/model/DefaultSelectableValues.java 3 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/core/model/KindOfSelectableValue.java 5 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/mods/dom/DomainOptionValues.java 6 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/remote/ModulePropertiesRemote.java 26 ●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/core/model/DefaultSelectableValues.java
@@ -5,6 +5,9 @@
public class DefaultSelectableValues {
    public KindOfSelectableValue getkind() {
        return KindOfSelectableValue.UNSPECIFIED;
    }
        public List<SelectableValue> get() {
            return new ArrayList<SelectableValue>();
        }
hsarback/src/de/hsadmin/core/model/KindOfSelectableValue.java
New file
@@ -0,0 +1,5 @@
package de.hsadmin.core.model;
public enum KindOfSelectableValue {
    UNSPECIFIED , DOMAINOPTIONS, SINGLESTRING
}
hsarback/src/de/hsadmin/mods/dom/DomainOptionValues.java
@@ -5,11 +5,17 @@
import de.hsadmin.core.model.BooleanListValue;
import de.hsadmin.core.model.DefaultSelectableValues;
import de.hsadmin.core.model.KindOfSelectableValue;
import de.hsadmin.core.model.SelectableValue;
public class DomainOptionValues extends DefaultSelectableValues {
    @Override
    public KindOfSelectableValue getkind() {
        return KindOfSelectableValue.DOMAINOPTIONS;
    }
    @Override
    public List<SelectableValue> get() {
        ArrayList<SelectableValue> list = new ArrayList<SelectableValue>();
        list.add(new BooleanListValue("backupmxforexternalmx"));
hsarback/src/de/hsadmin/remote/ModulePropertiesRemote.java
@@ -11,10 +11,12 @@
import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.AnnFieldIO;
import de.hsadmin.core.model.AuthenticationException;
import de.hsadmin.core.model.DefaultSelectableValues;
import de.hsadmin.core.model.HSAdminException;
import de.hsadmin.core.model.ReadWriteAccess;
import de.hsadmin.core.model.SelectableValue;
import de.hsadmin.core.model.Transaction;
import de.hsadmin.core.model.KindOfSelectableValue;
public class ModulePropertiesRemote implements IRemote {
@@ -52,15 +54,29 @@
                                propertyProperties.put("rw", rw.name());
                                String[] referredProps = fieldIO.referredProps();
                                propertyProperties.put("referredProps", referredProps);                        
                //                Class<?> declaringClass = f.getDeclaringClass();
                //                         declaringClass = f.getDeclaringClass();
                                for(String s : referredProps) {                    
                                    String fullPropertyName = fieldName+"."+s;
                                    propertiesList.add(createReferredPropertyInfo(fullPropertyName, f, s));
                                }
                                DefaultSelectableValues selectableValuesInstance = fieldIO.selectableValues().newInstance() ;
                                KindOfSelectableValue kind = selectableValuesInstance.getkind();
                                HashMap<String,Object> kindMap = new HashMap<String,Object>();
                                kindMap.put("kind", kind.name());
                                switch (kind) {
                                    case UNSPECIFIED :
                                        break;
                                    case SINGLESTRING :
                                        propertyProperties.put("selectableValues", kindMap);
                                //        ArrayList<Map<String,String>> selectableValueslist = new ArrayList<Map<String,String>>();
                                //        kindMap.put("values", selectableValueslist);
                                //        List<SelectableValue> selectableValues = selectableValuesInstance.get();
                                        // TODO: Hier fehlt noch was!
                                        break;
                                    case DOMAINOPTIONS :
                                        propertyProperties.put("selectableValues", kindMap);
                                ArrayList<Map<String,Object>> selectableValueslist = new ArrayList<Map<String,Object>>();
                                List<SelectableValue> selectableValues = fieldIO.selectableValues().newInstance().get();
                                propertyProperties.put("selectableValues", selectableValueslist);
                                        kindMap.put("values", selectableValueslist);
                                        List<SelectableValue> selectableValues = selectableValuesInstance.get();
                                  for( SelectableValue s : selectableValues) {                    
                                    String SelectableValueName = s.getName();            
                                    Object SelectableValues = s.getValues();
@@ -68,6 +84,8 @@
                                    m.put(SelectableValueName, SelectableValues); 
                                    selectableValueslist.add(m);
                                }
                                        break;
                                }
                                addCommonPropertyInfo(propertyProperties, f);
                                propertiesList.add(propertyProperties);
                            }