# HG changeset patch # User casties # Date 1476378183 -7200 # Node ID be377d5f9cc4b925dce41bf9d4bd27084aad2b13 # Parent d172201d24ad7f6fd43aac6b1b30974e1cae4927 more comments and cleanup. diff -r d172201d24ad -r be377d5f9cc4 src/main/java/de/mpiwg/itgroup/ismi/entry/beans/AbstractISMIBean.java --- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/AbstractISMIBean.java Wed Oct 12 20:50:30 2016 +0200 +++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/AbstractISMIBean.java Thu Oct 13 19:03:03 2016 +0200 @@ -176,6 +176,10 @@ return false; } + /** + * Clear the bean by setting a new empty entity. + * @return + */ public String clearAction(){ System.out.println("clearAction"); this.entity = new Entity(Node.TYPE_ABOX, this.defObjectClass, false); @@ -183,6 +187,10 @@ return PAGE_EDITOR; } + /** + * Reload the bean using the entity with currentId. + * @return + */ public String actionReloadEntity() { Long id = null; try { @@ -297,22 +305,27 @@ return calendar; } - protected void loadAttributes(Entity entity) { - attributes = new HashMap(); - if (entity != null) { - for (Attribute defAtt : getWrapper().getDefAttributes(this.defObjectClass)) { - Attribute originalAtt = entity.getAttributeByName(defAtt - .getOwnValue()); - String attValue = (originalAtt != null) ? originalAtt - .getOwnValue() : ""; - attributes.put(defAtt.getOwnValue(), attValue); - } - } else { - for (Attribute defAtt : getWrapper().getDefAttributes(this.defObjectClass)) { - attributes.put(defAtt.getOwnValue(), ""); - } - } - } + /** + * Load all (defined) attributes of the entity into this.attributes. + * + * Creates new empty attributes if entity=null. + * + * @param entity + */ + protected void loadAttributes(Entity entity) { + attributes = new HashMap(); + if (entity != null) { + for (Attribute defAtt : getWrapper().getDefAttributes(this.defObjectClass)) { + Attribute originalAtt = entity.getAttributeByName(defAtt.getOwnValue()); + String attValue = (originalAtt != null) ? originalAtt.getOwnValue() : ""; + attributes.put(defAtt.getOwnValue(), attValue); + } + } else { + for (Attribute defAtt : getWrapper().getDefAttributes(this.defObjectClass)) { + attributes.put(defAtt.getOwnValue(), ""); + } + } + } public void reset(){ this.setSelectedSaveAsNew(false);