diff src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentRepositoryBean.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/CurrentRepositoryBean.java	Mon Jan 30 20:35:36 2017 +0100
+++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentRepositoryBean.java	Tue Jan 31 18:09:54 2017 +0100
@@ -7,6 +7,7 @@
 import org.mpi.openmind.repository.bo.Attribute;
 import org.mpi.openmind.repository.bo.Entity;
 import org.mpi.openmind.repository.bo.Node;
+import org.mpi.openmind.repository.services.utils.EditIntent;
 
 public class CurrentRepositoryBean extends CodexEditorTemplate  implements Serializable{
 	private static final long serialVersionUID = 2926289436446091260L;
@@ -16,6 +17,16 @@
 	public static int MAX_PLACES = 100;
 	//private Entity repository;	
 	
+	/** intent to edit all attributes and relations in the form */
+	public static EditIntent editRepositoryIntent = new EditIntent(
+			AbstractISMIBean.REPOSITORY,
+			// attributes
+			new String[]{"name"},
+			// source relations
+			new String[]{"is_in"},
+			// target relations
+			new String[]{"is_reference_of"});
+
 	@Override
 	public void reset(){
 		super.reset();
@@ -71,8 +82,7 @@
 			}
 			
 			this.entity = this.updateEntityAttributes(this.entity);
-			
-			
+						
 			Attribute attName = this.entity.getAttributeByName("name");
 			String repositoryName = (attName == null) ? null : attName.getValue();
 			if(StringUtils.isNotEmpty(repositoryName)){
@@ -94,14 +104,13 @@
 			this.entity.replaceSourceRelation(this.getCityLo().getEntity(), PLACE, is_in);
 			
 			//REFERENCE -> is_reference_of -> THIS
-			//this.entity = this.prepareReferencesToSave(this.entity);
 			this.prepareEndNoteRefs2Save();
 			
 			if(isSelectedSaveAsNew()){
-				this.entity.removeAllTargetRelations(is_part_of, COLLECTION);
-				this.entity = getWrapper().saveEntityAsNew(this.entity, getSessionUser().getEmail());
+				//this.entity.removeAllTargetRelations(is_part_of, COLLECTION);
+				//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(), editRepositoryIntent);
 			}
 			
 			this.updateRelatedOW(this.entity, getSessionUser().getEmail());