# HG changeset patch # User casties # Date 1485882594 -3600 # Node ID eee2e0ca40328908ae51da4ec5808cf41ac0087c # Parent 28a0c27264664a16926b5b7a4ae5eb86a47d2db1 updated entry beans to use EditIntents. diff -r 28a0c2726466 -r eee2e0ca4032 src/main/java/de/mpiwg/itgroup/ismi/entry/beans/AbstractISMIBean.java --- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/AbstractISMIBean.java Mon Jan 30 20:35:36 2017 +0100 +++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/AbstractISMIBean.java Tue Jan 31 18:09:54 2017 +0100 @@ -360,7 +360,7 @@ /** * Update the defined attributes of the given entity with the - * attributes of the attributes Map. + * attributes of the attributes Map. * * @return the entity with updated attributes. */ diff -r 28a0c2726466 -r eee2e0ca4032 src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentAliasBean.java --- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentAliasBean.java Mon Jan 30 20:35:36 2017 +0100 +++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentAliasBean.java Tue Jan 31 18:09:54 2017 +0100 @@ -5,6 +5,7 @@ import org.apache.log4j.Logger; import org.mpi.openmind.repository.bo.Entity; import org.mpi.openmind.repository.bo.Node; +import org.mpi.openmind.repository.services.utils.EditIntent; public class CurrentAliasBean extends AbstractISMIBean implements Serializable{ @@ -12,6 +13,16 @@ private static Logger logger = Logger.getLogger(CurrentAliasBean.class); + /** intent to edit all attributes and relations in the form */ + public static EditIntent editAliasIntent = new EditIntent( + AbstractISMIBean.ALIAS, + // attributes + new String[]{"alias", "alias_translit"}, + // source relations + new String[]{}, + // target relations + new String[]{}); + public CurrentAliasBean(){ this.entity = new Entity(Node.TYPE_ABOX, ALIAS, false); setDefObjectClass(ALIAS); @@ -31,7 +42,7 @@ super.save(); try { this.entity = updateEntityAttributes(this.entity); - this.entity = getWrapper().saveEntity(this.entity, getSessionUser().getEmail(), null); + this.entity = getWrapper().saveEntity(this.entity, getSessionUser().getEmail(), editAliasIntent); getAppBean().getSimpleSearchCache().setMapDirty(true); logger.info("Entity saved - Time = " + (System.currentTimeMillis() - start) + ", " + entity); @@ -39,7 +50,6 @@ } catch (Exception e) { logger.error(e.getMessage(), e); - e.printStackTrace(); this.printInternalError(e); } saveEnd(); diff -r 28a0c2726466 -r eee2e0ca4032 src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentCityBean.java --- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentCityBean.java Mon Jan 30 20:35:36 2017 +0100 +++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentCityBean.java Tue Jan 31 18:09:54 2017 +0100 @@ -13,6 +13,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 de.mpiwg.itgroup.ismi.auxObjects.ListenerObject; import de.mpiwg.itgroup.ismi.util.guiComponents.EntityList; @@ -30,6 +31,16 @@ //private List> peopleLivedIn; private EntityList aliasList; + /** intent to edit all attributes and relations in the form */ + public static EditIntent editPlaceIntent = new EditIntent( + AbstractISMIBean.PLACE, + // attributes + new String[]{"name", "type"}, + // source relations + new String[]{"is_part_of"}, + // target relations + new String[]{"is_part_of", "is_alias_name_of"}); + public CurrentCityBean() { this.reset(); } @@ -167,20 +178,13 @@ } //REFERENCE -> is_reference_of -> THIS - //this.entity = this.prepareReferencesToSave(this.entity); this.prepareEndNoteRefs2Save(); - //String lastAction = ""; - if(this.isSelectedSaveAsNew()){ - //this.entity.removeAllTargetRelations(is_in, REPOSITORY); - //this.entity = getWrapper().saveEntityAsNew(this.entity, getSessionUser().getEmail()); + if (this.isSelectedSaveAsNew()) { this.setSelectedSaveAsNew(false); - //lastAction = "Save place as new entity"; - }else{ - this.entity = getWrapper().saveEntity(this.entity, getSessionUser().getEmail(), null); - //lastAction = "Save place"; + } else { + this.entity = getWrapper().saveEntity(this.entity, getSessionUser().getEmail(), editPlaceIntent); } - //setActionInfo(lastAction); this.updateRelatedOW(this.entity, getSessionUser().getEmail()); this.setCurrentId(this.entity.getId().toString()); diff -r 28a0c2726466 -r eee2e0ca4032 src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentCodexBean.java --- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentCodexBean.java Mon Jan 30 20:35:36 2017 +0100 +++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentCodexBean.java Tue Jan 31 18:09:54 2017 +0100 @@ -14,6 +14,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 de.mpiwg.itgroup.ismi.util.guiComponents.Calendar; import de.mpiwg.itgroup.ismi.util.guiComponents.EntityList; @@ -40,6 +41,18 @@ private CodexEditorTemplate referencedCodexTemplate; private Boolean isAlias; + /** intent to edit all attributes and relations in the form */ + public static EditIntent editCodexIntent = new EditIntent( + AbstractISMIBean.CODEX, + // attributes + new String[]{"identifier", "is_alias", "public", "url_digitized_codex", "mpiwg_id", "indexmeta_folder", + "number_of_folios", "dimensions", "binding", "distinguishing_features", "notes", "notes_old", + "notes_on_ownership"}, + // source relations + new String[]{"is_part_of", "is_alias_of", "owned_by", "read_by"}, + // target relations + new String[]{"is_alias_of", "is_reference_of"}); + public CurrentCodexBean() { this.entity = new Entity(Node.TYPE_ABOX, CODEX, false); @@ -242,28 +255,28 @@ this.prepareEndNoteRefs2Save(); if (this.isSelectedSaveAsNew()) { - this.entity = getWrapper().saveEntityAsNew(this.entity,getSessionUser().getEmail()); + //this.entity = getWrapper().saveEntityAsNew(this.entity,getSessionUser().getEmail()); this.setSelectedSaveAsNew(false); } else { - for(Entity owner : this.ownedByPeople.getEntities()){ - if(owner.isLightweight()){ + for (Entity owner : this.ownedByPeople.getEntities()) { + if (owner.isLightweight()) { owner = getWrapper().getEntityByIdWithContent(owner.getId()); } Relation ownerBy = new Relation(this.entity, owner, owned_by); Calendar cal = ownedByPeople.getCalendar(owner.getId()); - if(cal != null){ + if (cal != null) { ownerBy.addAttribute(new Attribute("date", "date", cal.toJSONString())); } } - for(Entity reader : this.readByPeople.getEntities()){ + for (Entity reader : this.readByPeople.getEntities()) { Relation readBy = new Relation(this.entity, reader, "read_by"); Calendar cal = readByPeople.getCalendar(reader.getId()); - if(cal != null){ + if (cal != null) { readBy.addAttribute(new Attribute("date", "date", cal.toJSONString())); } } - - this.entity = getWrapper().saveEntity(this.entity, getSessionUser().getEmail(), null); + + this.entity = getWrapper().saveEntity(this.entity, getSessionUser().getEmail(), editCodexIntent); } this.updateRelatedOW(this.entity, getSessionUser().getEmail()); diff -r 28a0c2726466 -r eee2e0ca4032 src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentCollectionBean.java --- 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()); diff -r 28a0c2726466 -r eee2e0ca4032 src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentDigitalizationBean.java --- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentDigitalizationBean.java Mon Jan 30 20:35:36 2017 +0100 +++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentDigitalizationBean.java Tue Jan 31 18:09:54 2017 +0100 @@ -8,6 +8,7 @@ import org.apache.log4j.Logger; import org.mpi.openmind.repository.bo.Entity; import org.mpi.openmind.repository.bo.Node; +import org.mpi.openmind.repository.services.utils.EditIntent; import org.mpi.openmind.security.bo.User; import de.mpiwg.itgroup.ismi.auxObjects.ListenerObject; @@ -18,6 +19,16 @@ private static Logger logger = Logger.getLogger(CurrentDigitalizationBean.class); + /** intent to edit all attributes and relations in the form */ + public static EditIntent editDigitalizationIntent = new EditIntent( + AbstractISMIBean.DIGITALIZATION, + // attributes + new String[]{"name", "num_files"}, + // source relations + new String[]{"is_digitalization_of"}, + // target relations + new String[]{}); + public CurrentDigitalizationBean(){ super(); @@ -79,7 +90,7 @@ // DIGITALIZATION -> is_digitalization_of -> CODEX this.entity.replaceSourceRelation(getCodexLo().entity, CODEX, is_digitalization_of); - this.entity = getWrapper().saveEntity(this.entity, user.getEmail(), null); + this.entity = getWrapper().saveEntity(this.entity, user.getEmail(), editDigitalizationIntent); this.setEntity(this.entity); @@ -89,7 +100,6 @@ } catch (Exception e) { logger.error(e.getMessage(), e); - e.printStackTrace(); this.printInternalError(e); } saveEnd(); diff -r 28a0c2726466 -r eee2e0ca4032 src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentRepositoryBean.java --- 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()); diff -r 28a0c2726466 -r eee2e0ca4032 src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentRoleBean.java --- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentRoleBean.java Mon Jan 30 20:35:36 2017 +0100 +++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentRoleBean.java Tue Jan 31 18:09:54 2017 +0100 @@ -4,6 +4,7 @@ import org.apache.log4j.Logger; import org.mpi.openmind.repository.bo.Entity; import org.mpi.openmind.repository.bo.Node; +import org.mpi.openmind.repository.services.utils.EditIntent; public class CurrentRoleBean extends AbstractISMIBean{ @@ -13,6 +14,16 @@ private static final long serialVersionUID = -4934098828218979428L; private static Logger logger = Logger.getLogger(CurrentRoleBean.class); + /** intent to edit all attributes and relations in the form */ + public static EditIntent editRoleIntent = new EditIntent( + AbstractISMIBean.ROLE, + // attributes + new String[]{"name"}, + // source relations + new String[]{}, + // target relations + new String[]{}); + public CurrentRoleBean(){ this.entity = new Entity(Node.TYPE_ABOX, ROLE, false); this.setDefObjectClass(ROLE); @@ -44,7 +55,7 @@ if(isConsistent()){ this.entity = updateEntityAttributes(this.entity); - this.entity = getWrapper().saveEntity(this.entity, getUserName(), null); + this.entity = getWrapper().saveEntity(this.entity, getUserName(), editRoleIntent); getAppBean().setRoleListAsDirty(); logger.info("Entity saved - Time = " + (System.currentTimeMillis() - start) + ", " + entity); @@ -53,7 +64,6 @@ } catch (Exception e) { logger.error(e.getMessage(), e); - e.printStackTrace(); this.printInternalError(e); } diff -r 28a0c2726466 -r eee2e0ca4032 src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentSubjectBean.java --- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentSubjectBean.java Mon Jan 30 20:35:36 2017 +0100 +++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentSubjectBean.java Tue Jan 31 18:09:54 2017 +0100 @@ -9,6 +9,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.security.bo.User; @@ -31,6 +32,16 @@ private List suggestedCategories = new ArrayList(); private List suggestedTypes = new ArrayList(); + /** intent to edit all attributes and relations in the form */ + public static EditIntent editSubjectIntent = new EditIntent( + AbstractISMIBean.SUBJECT, + // attributes + new String[]{"name", "type"}, + // source relations + new String[]{"is_part_of"}, + // target relations + new String[]{"is_part_of"}); + public CurrentSubjectBean(){ suggestedTypes.add(new SelectItem(null, "-- choose --")); suggestedTypes.add(new SelectItem(main_subject, main_subject)); @@ -105,10 +116,13 @@ if(getIdMainSubject() != null){ Entity mainCategory = getWrapper().getEntityById(getIdMainSubject()); //replaceSourceRelation(this.entity, mainCategory, SUBJECT, is_part_of); + if (mainCategory.isLightweight()) { + mainCategory = getWrapper().getEntityContent(mainCategory); + } this.entity.replaceSourceRelation(mainCategory, SUBJECT, is_part_of); } - this.entity = getWrapper().saveEntity(this.entity, user.getEmail(), null); + this.entity = getWrapper().saveEntity(this.entity, user.getEmail(), editSubjectIntent); getSessionBean().setEditFormCurrentEntId(this.entity.getId()); logger.info("Entity saved - Time = " + (System.currentTimeMillis() - start) + ", " + entity); @@ -117,7 +131,6 @@ getAppBean().resetSuggestedSubjects(); } catch (Exception e) { logger.error(e.getMessage(), e); - e.printStackTrace(); this.printInternalError(e); } diff -r 28a0c2726466 -r eee2e0ca4032 src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentWitnessBean.java --- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentWitnessBean.java Mon Jan 30 20:35:36 2017 +0100 +++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentWitnessBean.java Tue Jan 31 18:09:54 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.security.bo.User; import de.mpiwg.itgroup.ismi.auxObjects.AliasListenerObject; @@ -99,6 +100,21 @@ private MisidentificationTable misidentTable; + /** intent to edit all attributes and relations in the form */ + public static EditIntent editWitnessIntent = new EditIntent( + AbstractISMIBean.WITNESS, + // attributes + new String[]{"ahlward_no", "creation_date", "table_of_contents", "incipit", "explicit", "colophon", + "folios", "is_autograph", "page_dimensions", "written_area_dimensions", "lines_per_page", + "writing_surface", "page_layout", "script", "other_features", "diagrams_and_illustrations", + "scans", "notes", "notes_old", "notes_on_title_author", "notes_on_collation_and_corrections", + "notes_on_ownership", "source_of_information"}, + // source relations + new String[]{"is_exemplar_of", "is_part_of", "has_author_misidentification", "was_copied_by", + "was_copied_in", "was_copied_in_as", "had_patron", "was_studied_by"}, + // target relations + new String[]{"is_reference_of"}); + public CurrentWitnessBean() { super(); this.entity = new Entity(Node.TYPE_ABOX, WITNESS, false); @@ -257,9 +273,9 @@ // WITNESS -> is_part_of_codex if(this.isSelectedSaveAsNew()){ - this.entity = getWrapper().saveEntityAsNew(this.entity, user.getEmail()); + //this.entity = getWrapper().saveEntityAsNew(this.entity, user.getEmail()); }else{ - this.entity = getWrapper().saveEntity(this.entity, user.getEmail(), null); + this.entity = getWrapper().saveEntity(this.entity, user.getEmail(), editWitnessIntent); } this.setEntity(this.entity); diff -r 28a0c2726466 -r eee2e0ca4032 src/main/java/de/mpiwg/itgroup/ismi/entry/beans/DigiListBean.java --- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/DigiListBean.java Mon Jan 30 20:35:36 2017 +0100 +++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/DigiListBean.java Tue Jan 31 18:09:54 2017 +0100 @@ -6,7 +6,6 @@ import javax.faces.event.ActionEvent; import javax.faces.event.AjaxBehaviorEvent; -import javax.faces.event.ValueChangeEvent; import javax.faces.model.SelectItem; import org.apache.commons.lang.StringUtils; diff -r 28a0c2726466 -r eee2e0ca4032 src/main/webapp/entry/person.xhtml --- a/src/main/webapp/entry/person.xhtml Mon Jan 30 20:35:36 2017 +0100 +++ b/src/main/webapp/entry/person.xhtml Tue Jan 31 18:09:54 2017 +0100 @@ -49,7 +49,33 @@ + size="80" value="#{CurrentPerson.valueShortName}" /> + + + + + + + + + + + + + + + + + + + + + @@ -208,32 +234,6 @@ - - - - - - - - - - - - - - - - - - - - - - + @@ -38,7 +38,7 @@ - +