changeset 92:be377d5f9cc4

more comments and cleanup.
author casties
date Thu, 13 Oct 2016 19:03:03 +0200
parents d172201d24ad
children 27bf167d09f1
files src/main/java/de/mpiwg/itgroup/ismi/entry/beans/AbstractISMIBean.java
diffstat 1 files changed, 29 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- 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<String, String>();
-		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<String, String>();
+        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);