diff src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentCollectionBean.java @ 125:eee2e0ca4032

updated entry beans to use EditIntents.
author casties
date Tue, 31 Jan 2017 18:09:54 +0100
parents 28a0c2726466
children 25bfcc9d757c
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentCollectionBean.java	Mon Jan 30 20:35:36 2017 +0100
+++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentCollectionBean.java	Tue Jan 31 18:09:54 2017 +0100
@@ -1,17 +1,13 @@
 package de.mpiwg.itgroup.ismi.entry.beans;
 
 import java.io.Serializable;
-import java.util.HashMap;
-
-import javax.faces.event.ActionEvent;
 
 import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
 import org.mpi.openmind.repository.bo.Attribute;
 import org.mpi.openmind.repository.bo.Entity;
 import org.mpi.openmind.repository.bo.Node;
-
-import de.mpiwg.itgroup.ismi.util.guiComponents.StatusImage;
+import org.mpi.openmind.repository.services.utils.EditIntent;
 
 public class CurrentCollectionBean extends CodexEditorTemplate implements
 		Serializable {
@@ -25,7 +21,16 @@
 	protected Boolean restrictCities = true;
 	private Boolean restrictRepositories = true;
 
-	// private Entity collection;
+	/** intent to edit all attributes and relations in the form */
+	public static EditIntent editCollectionIntent = new EditIntent(
+			AbstractISMIBean.COLLECTION,
+			// attributes
+			new String[]{"name"},
+			// source relations
+			new String[]{"is_part_of"},
+			// target relations
+			new String[]{"is_reference_of"});
+
 
 	@Override
 	public void reset() {
@@ -128,10 +133,6 @@
 				return "";
 			}
 
-			// this.entity.removeSourceRelation(is_part_of
-			// ,this.getRepositoryLo().entity);
-			// this.replaceSourceRelation(this.entity,
-			// this.getRepositoryLo().entity, "REPOSITORY", "is_part_of");
 			if (this.getRepositoryLo().entity != null
 					&& this.getRepositoryLo().entity.isLightweight()) {
 				this.getRepositoryLo().entity = getWrapper()
@@ -142,16 +143,14 @@
 					REPOSITORY, is_part_of);
 
 			// REFERENCE -> is_reference_of -> THIS
-			// this.entity = this.prepareReferencesToSave(this.entity);
 			this.prepareEndNoteRefs2Save();
 
 			if (isSelectedSaveAsNew()) {
-				this.entity.removeAllTargetRelations(is_part_of, CODEX);
-				this.entity = getWrapper().saveEntityAsNew(this.entity,
-						getSessionUser().getEmail());
+				//this.entity.removeAllTargetRelations(is_part_of, CODEX);
+				//this.entity = getWrapper().saveEntityAsNew(this.entity,
+				//		getSessionUser().getEmail());
 			} else {
-				this.entity = getWrapper().saveEntity(this.entity,
-						getSessionUser().getEmail(), null);
+				this.entity = getWrapper().saveEntity(this.entity, getSessionUser().getEmail(), editCollectionIntent);
 			}
 
 			this.updateRelatedOW(this.entity, getSessionUser().getEmail());