diff src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentPersonBean.java @ 124:28a0c2726466

changed saveEntity() to use new EditIntent. Set up EditIntent for TEXT, PERSON, REFERENCE.
author casties
date Mon, 30 Jan 2017 20:35:36 +0100
parents 4aa8c425685d
children 29d40186dfd7
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentPersonBean.java	Thu Jan 26 19:35:49 2017 +0100
+++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentPersonBean.java	Mon Jan 30 20:35:36 2017 +0100
@@ -15,6 +15,7 @@
 import org.mpi.openmind.repository.bo.Entity;
 import org.mpi.openmind.repository.bo.Node;
 import org.mpi.openmind.repository.bo.Relation;
+import org.mpi.openmind.repository.services.utils.EditIntent;
 import org.mpi.openmind.repository.utils.RomanizationLoC;
 import org.mpi.openmind.repository.utils.TransliterationUtil;
 
@@ -58,6 +59,19 @@
 	private EntityList roleList;
 	private EntityList studentOfList;
 	private EntityList floruitList;
+
+	/** intent to edit all attributes and relations in the form */
+	public static EditIntent editPersonIntent = new EditIntent(
+			PERSON,
+			// attributes
+			new String[]{"name", "name_translit", "birth_date", "birth_date_text", "death_date", "death_date_text",
+					"url", "authority_id", "notes", "notes_old"},
+			// source relations
+			new String[]{"was_born_in", "was_born_in_as", "died_in", "died_in_as", "lived_in", "lived_in_as",
+					"was_student_of", "has_floruit_date", "has_role"},
+			// target relations
+			new String[]{"is_prime_alias_name_of", "is_alias_name_of", "is_reference_of"});
+	
 	
 	@Override
 	public void reset(){
@@ -262,7 +276,7 @@
 			this.entity.removeAllTargetRelationsByName(is_prime_alias_name_of);
 			if (shortNameAlias != null) {
 				shortNameAlias.setObjectClass(ALIAS);
-				shortNameAlias = getWrapper().saveEntity(shortNameAlias, getSessionUser().getEmail());
+				shortNameAlias = getWrapper().saveEntity(shortNameAlias, getSessionUser().getEmail(), null);
 				new Relation(shortNameAlias, this.entity, is_alias_name_of);
 			}
 			
@@ -335,21 +349,16 @@
 			}
 			
 			//REFERENCE -> is_reference_of -> THIS
-			//this.entity = this.prepareReferencesToSave(this.entity);
 			this.prepareEndNoteRefs2Save();
 			
-			this.entity = getWrapper().saveEntity(this.entity, getSessionUser().getEmail());
+			// save entity
+			this.entity = getWrapper().saveEntity(this.entity, getSessionUser().getEmail(), editPersonIntent);
 			this.setEntity(this.entity);
 			this.getCache().setMapDirty(true);
 			this.getAppBean().getBiographyBean().makeDirty();
 			
 			logger.info("Entity saved - Time = " + (System.currentTimeMillis() - start) + ", " + entity);
 			this.printSuccessSavingEntity();
-
-			//getPopup().setRendered(false);
-			
-
-			//setPopupText("CHANGING");
 			
 		} catch (Exception e) {
 			logger.error(e.getMessage(), e);