diff options
Diffstat (limited to 'src/com/ibm/ServerWizard2/model')
-rw-r--r-- | src/com/ibm/ServerWizard2/model/Attribute.java | 9 | ||||
-rw-r--r-- | src/com/ibm/ServerWizard2/model/SystemModel.java | 28 | ||||
-rw-r--r-- | src/com/ibm/ServerWizard2/model/Target.java | 22 |
3 files changed, 39 insertions, 20 deletions
diff --git a/src/com/ibm/ServerWizard2/model/Attribute.java b/src/com/ibm/ServerWizard2/model/Attribute.java index 17b346c..b0eaecb 100644 --- a/src/com/ibm/ServerWizard2/model/Attribute.java +++ b/src/com/ibm/ServerWizard2/model/Attribute.java @@ -7,6 +7,7 @@ import org.w3c.dom.Node; public class Attribute implements java.io.Serializable { private static final long serialVersionUID = 1L; + public String show = ""; public String name = ""; public String group = ""; public AttributeValue value; @@ -31,6 +32,7 @@ public class Attribute implements java.io.Serializable { public Attribute(Attribute a) { this.name = a.name; + this.show = a.show; this.desc = a.desc; this.group = a.group; this.persistency = a.persistency; @@ -123,12 +125,11 @@ public class Attribute implements java.io.Serializable { if (SystemModel.isElementDefined(attribute,"writeable")) { writeable=true; } - if (SystemModel.isElementDefined(attribute,"serverwizHide") || - name.equals("MODEL") || name.equals("TYPE") || name.equals("CLASS")) { + if (name.equals("MODEL") || name.equals("TYPE") || name.equals("CLASS")) { hide=true; } - if (SystemModel.isElementDefined(attribute,"serverwizReadonly")) { - readonly=true; + if (SystemModel.isElementDefined(attribute,"serverwizShow")) { + show = SystemModel.getElement(attribute, "serverwizShow"); } Node simpleType = attribute.getElementsByTagName("simpleType").item(0); if (simpleType!=null) { diff --git a/src/com/ibm/ServerWizard2/model/SystemModel.java b/src/com/ibm/ServerWizard2/model/SystemModel.java index 9038239..2c160ec 100644 --- a/src/com/ibm/ServerWizard2/model/SystemModel.java +++ b/src/com/ibm/ServerWizard2/model/SystemModel.java @@ -48,6 +48,7 @@ public class SystemModel { private HashMap<String, Attribute> attributes = new HashMap<String, Attribute>(); private TreeMap<String, Vector<String>> attributeGroups = new TreeMap<String, Vector<String>>(); private TreeMap<String, Errata> errata = new TreeMap<String, Errata>(); + private TreeMap<String, Boolean> attributeFilters = new TreeMap<String, Boolean>(); // List of targets in current system private Vector<Target> targetList = new Vector<Target>(); @@ -68,7 +69,11 @@ public class SystemModel { public Vector<Target> getBusTypes() { return busTypes; } + public TreeMap<String,Boolean> getAttributeFilters() { + return this.attributeFilters; + } + public Target getTarget(String t) { return targetLookup.get(t); } @@ -525,11 +530,11 @@ public class SystemModel { * Returns a vector of attributes located in the target and global settings * associated with a particular target instance */ - public Vector<Field> getAttributesAndGlobals(Target targetInstance, String path, Boolean showGlobalSettings) { + public Vector<Field> getAttributesAndGlobals(Target targetInstance, String path, Boolean showGlobalSettings, String filter) { Vector<Field> attributes = new Vector<Field>(); for (Map.Entry<String, Attribute> entry : targetInstance.getAttributes().entrySet()) { Attribute attribute = entry.getValue(); - if (!attribute.isHidden()) { + if (attribute.show.equals(filter) || filter.isEmpty()) { if (attribute.isGlobal() && showGlobalSettings) { if (!path.isEmpty()) { Field field = getGlobalSetting(path, attribute.name); @@ -666,10 +671,12 @@ public class SystemModel { } grp.add(a.name); } - if (a.getValue().getType().equals("enumeration")) { a.getValue().setEnumerator(enumerations.get(a.value.getFields().get(0).name)); } + if (!a.show.isEmpty()) { + this.attributeFilters.put(a.show,true); + } } } @@ -841,13 +848,16 @@ public class SystemModel { ///////////////////////////////////////////////////////////////// // Utility static methods public static String getElement(Element a, String e) { - Node n = a.getElementsByTagName(e).item(0); - if (n != null) { - Node cn = n.getChildNodes().item(0); - if (cn == null) { - return ""; + NodeList nl = a.getChildNodes(); + for (int i=0;i<nl.getLength();i++){ + Node n = nl.item(i); + if (n.getNodeName().equals(e)) { + Node cn = n.getChildNodes().item(0); + if (cn == null) { + return ""; + } + return cn.getNodeValue(); } - return cn.getNodeValue(); } return ""; } diff --git a/src/com/ibm/ServerWizard2/model/Target.java b/src/com/ibm/ServerWizard2/model/Target.java index 2641380..5691062 100644 --- a/src/com/ibm/ServerWizard2/model/Target.java +++ b/src/com/ibm/ServerWizard2/model/Target.java @@ -350,18 +350,26 @@ public class Target implements Comparable<Target>, java.io.Serializable { parentType.add(e.getChildNodes().item(0).getNodeValue()); } NodeList attributeList = target.getElementsByTagName("attribute"); + boolean aerror = false; for (int i = 0; i < attributeList.getLength(); ++i) { String attrId = SystemModel.getElement((Element) attributeList.item(i), "id"); Attribute attributeLookup = attrMap.get(attrId); if (attributeLookup == null) { - throw new NullPointerException("Invalid attribute id: " + attrId + "(" + type + ")"); - } - Attribute a = new Attribute(attributeLookup); - if (a.value==null) { - throw new NullPointerException("Unknown attribute value type: " + attrId + "(" + type + ")"); + aerror = true; + System.out.println("Invalid attribute id: " + attrId + "(" + type + ")"); + } else { + Attribute a = new Attribute(attributeLookup); + if (a.value==null) { + aerror = true; + System.out.println("Unknown attribute value type: " + attrId + "(" + type + ")"); + } else { + attributes.put(a.name, a); + a.value.readInstanceXML((Element) attributeList.item(i)); + } } - attributes.put(a.name, a); - a.value.readInstanceXML((Element) attributeList.item(i)); + } + if (aerror == true) { + throw new NullPointerException("Attribute import error"); } } |