changeset 106:71efad4fe975

small cleanups.
author casties
date Mon, 07 Nov 2016 17:04:43 +0100
parents e27603a39e70
children 99f9a55a4957
files src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CodexEditorTemplate.java src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentCityBean.java src/main/java/de/mpiwg/itgroup/ismi/entry/beans/UnityChecker.java
diffstat 3 files changed, 49 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CodexEditorTemplate.java	Fri Nov 04 18:10:40 2016 +0100
+++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CodexEditorTemplate.java	Mon Nov 07 17:04:43 2016 +0100
@@ -33,9 +33,6 @@
  */
 public class CodexEditorTemplate extends UnityChecker {
 
-	/**
-	 * 
-	 */
 	private static final long serialVersionUID = 7580021280544772497L;
 	private static Logger logger = Logger.getLogger(CodexEditorTemplate.class);
 	public static int MAX_CODICES = 1000;
@@ -360,22 +357,21 @@
 	}
 	
 	/**
-	 * Restrict the list for the select menu, to the place selected
+	 * Set the list of cities for the select menu, by the given country.
 	 * 
 	 * @param country
 	 */
-	protected void restrictByCountry(Entity country) {
-		
-		this.setCitiesInCurrentCountry(new ArrayList<SelectItem>());
-		
-		for (Entity src : getWrapper().getSourcesForTargetRelation(country, is_part_of, PLACE, MAX_PLACES)) {
-			getCitiesInCurrentCountry().add(new SelectItem(String.valueOf(src
-					.getId()), src.getOwnValue()));
-		}
-	}
+    protected void restrictByCountry(Entity country) {
+
+        this.setCitiesInCurrentCountry(new ArrayList<SelectItem>());
+
+        for (Entity src : getWrapper().getSourcesForTargetRelation(country, is_part_of, PLACE, MAX_PLACES)) {
+            getCitiesInCurrentCountry().add(new SelectItem(String.valueOf(src.getId()), src.getOwnValue()));
+        }
+    }
 	
 	/**
-	 * Restrict all list for the select menu, to the place selected
+	 * Set the list of repositories for the select menu, by the given city.
 	 * 
 	 * @param place
 	 */
@@ -383,26 +379,31 @@
 		
 		this.setRepositoriesInCurrentCity(new ArrayList<SelectItem>());
 		
-		for (Entity src : getWrapper().getSourcesForTargetRelation(place, is_in, "REPOSITORY",MAX_REPOSITORIES)) {
-			this.getRepositoriesInCurrentCity().add(new SelectItem(String.valueOf(src
-					.getId()), src.getOwnValue()));
-		}
+        for (Entity src : getWrapper().getSourcesForTargetRelation(place, is_in, "REPOSITORY", MAX_REPOSITORIES)) {
+            this.getRepositoriesInCurrentCity().add(new SelectItem(String.valueOf(src.getId()), src.getOwnValue()));
+        }
 	}
 	
 	/**
-	 * Restrict all list for the select menu, to the place selected
+	 * Set the list of collections for the select menu, by the given repository.
 	 * 
 	 * @param repository
 	 */
-	public void restrictByRepository(Entity repository) {
-	
-		this.setCollectionsInCurrentRepository(new ArrayList<SelectItem>());
-		for (Entity src : getWrapper().getSourcesForTargetRelation(repository, is_part_of, COLLECTION, MAX_COLLECTIONS)) {
-			this.getCollectionsInCurrentRepository().add(new SelectItem(String
-					.valueOf(src.getId()), src.getOwnValue()));
-		}
+    public void restrictByRepository(Entity repository) {
+
+        this.setCollectionsInCurrentRepository(new ArrayList<SelectItem>());
+        for (Entity src : getWrapper().getSourcesForTargetRelation(repository, is_part_of, COLLECTION,
+                MAX_COLLECTIONS)) {
+            this.getCollectionsInCurrentRepository()
+                    .add(new SelectItem(String.valueOf(src.getId()), src.getOwnValue()));
+        }
 	}
 	
+	/**
+	 * Set the list of shelf marks for the select menu, by the given collection.
+	 * 
+	 * @param collection
+	 */
 	protected void restrictByCollection(Entity collection) {
 		this.setShelfMarksInCurrentCollection(restrictShelfMarks(collection));
 	}
--- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentCityBean.java	Fri Nov 04 18:10:40 2016 +0100
+++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentCityBean.java	Mon Nov 07 17:04:43 2016 +0100
@@ -76,7 +76,7 @@
                 this.setCountry(list.get(0));
                 // part_of more than one place
                 if (list.size() > 1) {
-                    addErrorMsg("Ontological inconsistency. This place 'is part of' " + list.size() + " other places.");
+                    addErrorMsg("Inconsistency: this place 'is part of' " + list.size() + " other places!");
                     addErrorMsg("List:");
                     for (Entity place : list) {
                         addErrorMsg(place.getOwnValue() + " [" + place.getId() + "]");
@@ -101,6 +101,9 @@
         }
     }
 	
+	/* (non-Javadoc)
+	 * @see de.mpiwg.itgroup.ismi.entry.beans.AbstractISMIBean#save()
+	 */
 	@Override
 	public String save(){
 		super.save();
@@ -125,7 +128,7 @@
 				}
 			}else{
 				this.addErrorMsg("This place has not been saved, because its name was empty.");
-				this.addErrorMsg("You have to enter a name.");
+				this.addErrorMsg("Please enter a name.");
 				return "SAVE_ERROR";
 			}
 			
--- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/UnityChecker.java	Fri Nov 04 18:10:40 2016 +0100
+++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/UnityChecker.java	Mon Nov 07 17:04:43 2016 +0100
@@ -4,11 +4,14 @@
 import org.mpi.openmind.repository.bo.Attribute;
 import org.mpi.openmind.repository.bo.Entity;
 
+/**
+ * Class to check uniqueness of Entities.
+ * 
+ * @author jurzua
+ *
+ */
 public class UnityChecker extends AbstractISMIBean{
 	
-	/**
-	 * 
-	 */
 	private static final long serialVersionUID = -5727416233789954800L;
 	private Entity cloneEntity;
 	private String unityCheckerMsg;
@@ -20,6 +23,17 @@
 		this.renderUnityCheckerDialog = false;
 	}
 
+	/**
+	 * Return if the name for an entity is unique.
+	 * 
+	 * @param unityName
+	 * @param id
+	 * @param objectClass
+	 * @param target
+	 * @param relationName
+	 * @param attName
+	 * @return
+	 */
 	private boolean checkUnity(String unityName, Long id, String objectClass, Entity target, String relationName, String attName){
 		this.cloneEntity = null;
 		unityName = unityName.toLowerCase();