# HG changeset patch # User casties # Date 1481314707 -3600 # Node ID 22a18bfc66b08c04f0712e69d3ad53889a37b319 # Parent e5d4443a1bc518f0decaacb68ce1050b0dd6d52c new completion that uses ALIASes: AbstractListenerObject. was_copied_in in WITNESS form can use PLACE aliases now. some cleanup. diff -r e5d4443a1bc5 -r 22a18bfc66b0 src/main/java/de/mpiwg/itgroup/ismi/auxObjects/AbstractListenerObject.java --- a/src/main/java/de/mpiwg/itgroup/ismi/auxObjects/AbstractListenerObject.java Thu Dec 08 16:05:18 2016 +0100 +++ b/src/main/java/de/mpiwg/itgroup/ismi/auxObjects/AbstractListenerObject.java Fri Dec 09 21:18:27 2016 +0100 @@ -15,10 +15,11 @@ import de.mpiwg.itgroup.ismi.entry.beans.ApplicationBean; import de.mpiwg.itgroup.ismi.util.guiComponents.StatusImage; -public abstract class AbstractListenerObject extends AbstractBean{ +public abstract class AbstractListenerObject extends AbstractBean { private static final long serialVersionUID = -7874914085766225119L; - private static int MAX_SUGGEST = 25; + + protected static int MAX_SUGGEST = 25; public List suggestedItems = new ArrayList(); public transient StatusImage statusImage = new StatusImage(); @@ -26,83 +27,69 @@ public Entity entity = new Entity(); public String entityInfo; - protected void changeListener( - ValueChangeEvent event, - String suggestType, - String suggestAttributeName) { + protected void changeListener(ValueChangeEvent event, String suggestType, String suggestAttributeName) { - changeListener( - event, - suggestType, - suggestAttributeName, - null, - null); - } + changeListener(event, suggestType, suggestAttributeName, null, null); + } - protected void changeListener( - ValueChangeEvent event, - String suggestType, - String suggestAttributeName, - String restrictingAttributeName, - String restrictingAttributeValue) { - - try { - if (event.getNewValue() == null) { - return; - }else if(StringUtils.isEmpty(event.getNewValue().toString()) && (event.getOldValue() == null || StringUtils.isEmpty(event.getOldValue().toString()))){ - //if the old and new value are empty, then return - return; - } - if (event.getNewValue().equals(event.getOldValue())) { - return; - } + protected void changeListener(ValueChangeEvent event, String suggestType, String suggestAttributeName, + String restrictingAttributeName, String restrictingAttributeValue) { - String ownvalue = (String) event.getNewValue(); + try { + if (event.getNewValue() == null) { + return; + } else if (StringUtils.isEmpty(event.getNewValue().toString()) + && (event.getOldValue() == null || StringUtils.isEmpty(event.getOldValue().toString()))) { + // if the old and new value are empty, then return + return; + } + if (event.getNewValue().equals(event.getOldValue())) { + return; + } + + String ownvalue = (String) event.getNewValue(); + + if (StringUtils.isEmpty(ownvalue)) + statusImage.setStatus(StatusImage.STATUS_UNSET); + else + statusImage.setStatus(StatusImage.STATUS_FALSE); - if(StringUtils.isEmpty(ownvalue)) - statusImage.setStatus(StatusImage.STATUS_UNSET); - else - statusImage.setStatus(StatusImage.STATUS_FALSE); - - this.entity = null; - // setze erst mal den Eigenwert auf das eingebene. - Attribute at = new Attribute(); - at.setOwnValue(ownvalue); - attribute = at; - for (SelectItem item : this.suggestedItems) { - if (StringUtils.isNotEmpty(item.getLabel()) && - item.getLabel().equals(ownvalue)) { - //System.out.println("item.getValue()= " + item.getValue()); - this.attribute = (Attribute) item.getValue(); - Entity element = getWrapper().getEntityById( - this.attribute.getSourceId()); + this.entity = null; + // setze erst mal den Eigenwert auf das eingebene. + Attribute at = new Attribute(); + at.setOwnValue(ownvalue); + attribute = at; + for (SelectItem item : this.suggestedItems) { + if (StringUtils.isNotEmpty(item.getLabel()) && item.getLabel().equals(ownvalue)) { + // System.out.println("item.getValue()= " + + // item.getValue()); + this.attribute = (Attribute) item.getValue(); + Entity element = getWrapper().getEntityById(this.attribute.getSourceId()); - if (element != null) { - if(element.isLightweight()){ - element = getWrapper().getEntityByIdWithContent(element.getId()); - } - entity = element; - statusImage.setStatus(StatusImage.STATUS_OK); - } - break; - } + if (element != null) { + if (element.isLightweight()) { + element = getWrapper().getEntityByIdWithContent(element.getId()); + } + entity = element; + statusImage.setStatus(StatusImage.STATUS_OK); + } + break; + } - } + } - if (restrictingAttributeName == null) { - suggestedItems = this.updateSuggestedItems(event, - suggestType, suggestAttributeName); - } else { - suggestedItems = this.updateSuggestedItems(suggestType, - suggestAttributeName, event.getNewValue().toString(), - restrictingAttributeName, restrictingAttributeValue); - } + if (restrictingAttributeName == null) { + suggestedItems = this.updateSuggestedItems(event, suggestType, suggestAttributeName); + } else { + suggestedItems = this.updateSuggestedItems(suggestType, suggestAttributeName, + event.getNewValue().toString(), restrictingAttributeName, restrictingAttributeValue); + } - } catch (Exception e) { - e.printStackTrace(); - } - return; - } + } catch (Exception e) { + e.printStackTrace(); + } + return; + } protected List updateSuggestedItems(String objClass, String firstName, String firstValue, String secondName, @@ -122,14 +109,29 @@ return suggestedItems; } + /** + * Returns a List of Items by searching the value of event in the Attribute attName in all Entities with objClass. + * + * @param event + * @param objClass + * @param attName + * @return + */ protected List updateSuggestedItems(ValueChangeEvent event, String objClass, String attName) { return updateSuggestedItems((String) event.getNewValue(), objClass, attName); } - protected List updateSuggestedItems(String searchWord, - String objClass, String attName) { + /** + * Returns a List of SelectItems by searching searchWord in the Attribute attName in all Entities with objClass. + * + * @param searchWord + * @param objClass + * @param attName + * @return + */ + protected List updateSuggestedItems(String searchWord, String objClass, String attName) { List attList = getWrapper().getAttributesByDefByAttName(objClass, attName, searchWord.toString(), MAX_SUGGEST); diff -r e5d4443a1bc5 -r 22a18bfc66b0 src/main/java/de/mpiwg/itgroup/ismi/auxObjects/AliasListenerObject.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/de/mpiwg/itgroup/ismi/auxObjects/AliasListenerObject.java Fri Dec 09 21:18:27 2016 +0100 @@ -0,0 +1,96 @@ +package de.mpiwg.itgroup.ismi.auxObjects; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import javax.faces.model.SelectItem; + +import org.mpi.openmind.repository.bo.Attribute; +import org.mpi.openmind.repository.bo.Entity; + +/** + * ListenerObject that searches in Entity Attributes and ALIASes with a given Relation. + * + * @author casties + * + */ +public class AliasListenerObject extends ListenerObject { + + private static final long serialVersionUID = 2072530246758155955L; + + public String aliasRelName; + + /** + * @param classObj + * @param attName + * @param aliasRelName + */ + public AliasListenerObject(String classObj, String attName, String aliasRelName) { + super(classObj, attName); + this.aliasRelName = aliasRelName; + } + + /* (non-Javadoc) + * @see de.mpiwg.itgroup.ismi.auxObjects.AbstractListenerObject#updateSuggestedItems(java.lang.String, java.lang.String, java.lang.String) + */ + @Override + protected List updateSuggestedItems(String searchWord, String objClass, String attName) { + + // find matching entity attributes + List attList = getWrapper().getAttributesByDefByAttName(objClass, attName, searchWord.toString(), MAX_SUGGEST); + + // find all matching aliases + List aliasAtts = getWrapper().getAttributesByDefByAttName("ALIAS", "alias", searchWord.toString(), 0); + // filter related aliases + int aliasCnt = 0; + for (Attribute att : aliasAtts) { + Long aliasId = att.getSourceId(); + // find the Entities with the correct Relation + List ents = getWrapper().getTargetsForSourceRelation(aliasId, aliasRelName, objClass, 1); + if (!ents.isEmpty()) { + // ALIAS is related to Entity + attList.add(att); + aliasCnt += 1; + if (aliasCnt > MAX_SUGGEST) { + break; + } + } + } + if (aliasCnt > 0) { + // re-sort with added aliases + Collections.sort(attList); + } + + List suggestedItems = new ArrayList(); + if (attList == null) + return suggestedItems; + + for (Attribute att : attList) { + String label = att.getOwnValue(); + if (att.getSourceObjectClass().equals("ALIAS")) { + label += " [ALIAS " + att.getSourceId() + "]"; + } else { + label += " [" + att.getSourceId() + "]"; + } + SelectItem item = new SelectItem(att, label, "description: " + att); + suggestedItems.add(item); + } + return suggestedItems; + } + + /** + * @return the aliasRelName + */ + public String getAliasRelName() { + return aliasRelName; + } + + /** + * @param aliasRelName the aliasRelName to set + */ + public void setAliasRelName(String aliasRelName) { + this.aliasRelName = aliasRelName; + } + +} diff -r e5d4443a1bc5 -r 22a18bfc66b0 src/main/java/de/mpiwg/itgroup/ismi/auxObjects/ListenerObject.java --- a/src/main/java/de/mpiwg/itgroup/ismi/auxObjects/ListenerObject.java Thu Dec 08 16:05:18 2016 +0100 +++ b/src/main/java/de/mpiwg/itgroup/ismi/auxObjects/ListenerObject.java Fri Dec 09 21:18:27 2016 +0100 @@ -8,14 +8,16 @@ import javax.faces.model.SelectItem; 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 de.mpiwg.itgroup.ismi.entry.beans.AbstractISMIBean; import de.mpiwg.itgroup.ismi.util.guiComponents.StatusImage; -public class ListenerObject extends AbstractListenerObject{ +public class ListenerObject extends AbstractListenerObject { private static final long serialVersionUID = 9156066826135642525L; + protected static Logger logger = Logger.getLogger(ListenerObject.class); public String classObj; public String attName; @@ -32,22 +34,22 @@ /** * When the term is changed in the inputtext, - * this method will be called to change teh suggestion list. + * this method will be called to change the suggestion list. * @param event */ public void valueChangeMethod(ValueChangeEvent event) { this.entityInfo = null; changeListener(event, classObj, attName); + /* if(classObj.equals("PERSON")){ - /* if(authorLo != null && authorLo.entity != null && authorLo.entity.isPersistent()){ this.authorInfo = "ID = " + authorLo.getEntity().getId(); Attribute attArabicName = getTargetAttribute(authorLo.entity, "name_translit"); if(attArabicName != null) this.authorInfo += ", Arabic Name = " + attArabicName.getOwnValue(); } - */ } + */ } public void actionListenerSelect(ActionEvent event){ @@ -60,7 +62,7 @@ Entity ent = getWrapper().getEntityById(att.getSourceId()); if(ent != null){ - this.setEntityAndAttribute0(ent); + this.setEntityAndAttribute(ent); } } } @@ -144,7 +146,7 @@ return statusImage.getStatus(); } - public void setEntityAndAttribute0(Entity ent){ + public void setEntityAndAttribute(Entity ent){ this.setEntity(ent); if(ent != null && ent.isPersistent()){ this.attribute = getWrapper().getAttributeByName(ent.getId(), this.attName); @@ -156,9 +158,9 @@ } } - public void setEntityAndAttribute(Entity ent, String attName){ + public void setEntityAndAttributeName(Entity ent, String attName){ this.attName = attName; - this.setEntityAndAttribute0(ent); + this.setEntityAndAttribute(ent); } public boolean equalsTermEntity(){ diff -r e5d4443a1bc5 -r 22a18bfc66b0 src/main/java/de/mpiwg/itgroup/ismi/entry/beans/AbstractISMIBean.java --- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/AbstractISMIBean.java Thu Dec 08 16:05:18 2016 +0100 +++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/AbstractISMIBean.java Fri Dec 09 21:18:27 2016 +0100 @@ -743,7 +743,7 @@ lo.attribute.getSourceId()); }else{ //oder ein paar wert / id// = (Attribute) item.getValue(); element = getWrapper().getEntityById(Long.valueOf((String) item.getValue())); - lo.setEntityAndAttribute(element, suggestAttributeName); + lo.setEntityAndAttributeName(element, suggestAttributeName); } if (element != null) { if(element.isLightweight()){ @@ -759,7 +759,7 @@ //juc *** List ents = getWrapper().getLightweightConceptsByAttribute(null, suggestType, suggestAttributeName, ownvalue, 1, false); List ents = getWrapper().getEntitiesByAtt(suggestType, suggestAttributeName, ownvalue, 1, false); if (ents.size()==1){ - lo.setEntityAndAttribute(ents.get(0),suggestAttributeName); + lo.setEntityAndAttributeName(ents.get(0),suggestAttributeName); lo.statusImage.setStatus("ok"); } diff -r e5d4443a1bc5 -r 22a18bfc66b0 src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CodexEditorTemplate.java --- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CodexEditorTemplate.java Thu Dec 08 16:05:18 2016 +0100 +++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CodexEditorTemplate.java Fri Dec 09 21:18:27 2016 +0100 @@ -80,12 +80,12 @@ * @param country */ public void setCountry(Entity country){ - this.getCountryLo().setEntityAndAttribute0(country); + this.getCountryLo().setEntityAndAttribute(country); this.restrictByCountry(country); } public void setCity(Entity city) { - this.getCityLo().setEntityAndAttribute0(city); + this.getCityLo().setEntityAndAttribute(city); this.restrictByCity(city); List list = getWrapper().getTargetsForSourceRelation(city, is_part_of, PLACE, 1); @@ -96,7 +96,7 @@ } public void setRepository(Entity repository) { - this.getRepositoryLo().setEntityAndAttribute0(repository); + this.getRepositoryLo().setEntityAndAttribute(repository); this.restrictByRepository(repository); List list = getWrapper().getTargetsForSourceRelation(repository, is_in, PLACE, 5); @@ -107,7 +107,7 @@ } public void setCollection(Entity collection) { - this.getCollectionLo().setEntityAndAttribute0(collection); + this.getCollectionLo().setEntityAndAttribute(collection); this.restrictByCollection(collection); List repoList = getWrapper().getTargetsForSourceRelation(collection, is_part_of, REPOSITORY, 1); @@ -222,7 +222,7 @@ if(ent != null){ String ct = ent.getObjectClass(); if (ct.equals(CODEX)) { - this.getCodexLo().setEntityAndAttribute0(ent); + this.getCodexLo().setEntityAndAttribute(ent); Attribute identifier = getWrapper().getAttributeByName(ent.getId(), "identifier"); if(identifier != null){ diff -r e5d4443a1bc5 -r 22a18bfc66b0 src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentCodexBean.java --- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentCodexBean.java Thu Dec 08 16:05:18 2016 +0100 +++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentCodexBean.java Fri Dec 09 21:18:27 2016 +0100 @@ -165,7 +165,7 @@ } public void setReferencedCodex(Entity codex){ - this.referencedCodexTemplate.getCodexLo().setEntityAndAttribute(codex, "identifier"); + this.referencedCodexTemplate.getCodexLo().setEntityAndAttributeName(codex, "identifier"); if(this.referencedCodexTemplate.getCodexLo().entity != null && this.referencedCodexTemplate.getCodexLo().entity.isPersistent()){ diff -r e5d4443a1bc5 -r 22a18bfc66b0 src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentDigitalizationBean.java --- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentDigitalizationBean.java Thu Dec 08 16:05:18 2016 +0100 +++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentDigitalizationBean.java Fri Dec 09 21:18:27 2016 +0100 @@ -52,7 +52,7 @@ public void setCodex(Entity codex){ - this.getCodexLo().setEntityAndAttribute(codex, "identifier"); + this.getCodexLo().setEntityAndAttributeName(codex, "identifier"); if(this.getCodexLo().entity != null && this.getCodexLo().entity.isPersistent()){ diff -r e5d4443a1bc5 -r 22a18bfc66b0 src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentPersonBean.java --- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentPersonBean.java Thu Dec 08 16:05:18 2016 +0100 +++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentPersonBean.java Fri Dec 09 21:18:27 2016 +0100 @@ -183,7 +183,7 @@ for (Relation rel : this.entity.getSourceRelations()) { Entity target = getWrapper().getEntityById(rel.getTargetId()); if (rel.getOwnValue().equals("was_born_in")) { - this.birthPlaceLo.setEntityAndAttribute0(target); + this.birthPlaceLo.setEntityAndAttribute(target); //this.personWasBornInName = (target == null) ? "" : target.getOwnValue(); } else if (rel.getOwnValue().equals(lived_in)) { this.livedInPlaces.add(target, rel.getAttributeByName("date")); @@ -192,7 +192,7 @@ } else if (rel.getOwnValue().equals(has_role)) { this.roleList.add(target); } else if (rel.getOwnValue().equals("died_in")) { - this.deathPlaceLo.setEntityAndAttribute0(target); + this.deathPlaceLo.setEntityAndAttribute(target); } else if (rel.getOwnValue().equals("has_floruit_date")) { Attribute calAtt = getWrapper().getAttributeByName(target.getId(), "date"); this.floruitList.add(target, calAtt); diff -r e5d4443a1bc5 -r 22a18bfc66b0 src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentTextBean.java --- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentTextBean.java Thu Dec 08 16:05:18 2016 +0100 +++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentTextBean.java Fri Dec 09 21:18:27 2016 +0100 @@ -254,19 +254,19 @@ } else if (relName.equals("is_commentary_on")) { target = getTargetRelation(rel); - this.commentaryLo.setEntityAndAttribute0(target); + this.commentaryLo.setEntityAndAttribute(target); } else if (relName.equals("is_translation_of")) { target = getTargetRelation(rel); - this.translationLo.setEntityAndAttribute0(target); + this.translationLo.setEntityAndAttribute(target); } else if (relName.equals("is_version_of")) { target = getTargetRelation(rel); - this.versionLo.setEntityAndAttribute0(target); + this.versionLo.setEntityAndAttribute(target); } else if (relName.equals("was_created_by")) { target = getTargetRelation(rel); - this.authorLo.setEntityAndAttribute0(target); + this.authorLo.setEntityAndAttribute(target); if (this.authorLo.attribute != null) { this.textAuthorNameTranslit = this.authorLo.attribute.getValue(); @@ -274,11 +274,11 @@ } else if (relName.equals("was_dedicated_to")) { target = getTargetRelation(rel); - this.dedicatedPersonLo.setEntityAndAttribute0(target); + this.dedicatedPersonLo.setEntityAndAttribute(target); } else if (relName.equals("was_created_in")) { target = getTargetRelation(rel); - this.placeLo.setEntityAndAttribute0(target); + this.placeLo.setEntityAndAttribute(target); } else if (relName.equals("has_author_misattribution")) { target = getTargetRelation(rel); @@ -358,13 +358,13 @@ Entity ent = getWrapper().getEntityById(idTextSelected); if(ent != null){ if (VERSION_CALLER.equals(this.searchCaller)) { - this.versionLo.setEntityAndAttribute0(ent); + this.versionLo.setEntityAndAttribute(ent); } else if (COMMENTARY_CALLER.equals(this.searchCaller)) { - this.commentaryLo.setEntityAndAttribute0(ent); + this.commentaryLo.setEntityAndAttribute(ent); } else if (TRANSLATION_CALLER.equals(this.searchCaller)) { - this.translationLo.setEntityAndAttribute0(ent); + this.translationLo.setEntityAndAttribute(ent); } this.searchTextDialogRendered = false; } @@ -473,7 +473,7 @@ Entity selectedPerson = getWrapper().getEntityById(selectedPersonId); if(selectedPerson != null){ if(this.personType.equals(PERSON_TYPE_CREATED_BY)){ - this.authorLo.setEntityAndAttribute0(selectedPerson); + this.authorLo.setEntityAndAttribute(selectedPerson); this.authorLo.entityInfo = "ID = " + authorLo.getEntity().getId(); Attribute attArabicName = getTargetAttribute(selectedPerson, "name"); @@ -486,7 +486,7 @@ this.textAuthorNameTranslit = this.authorLo.attribute.getValue(); } }else if(this.personType.equals(PERSON_TYPE_DEDICATED_TO)){ - this.dedicatedPersonLo.setEntityAndAttribute0(selectedPerson); + this.dedicatedPersonLo.setEntityAndAttribute(selectedPerson); } } } diff -r e5d4443a1bc5 -r 22a18bfc66b0 src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentWitnessBean.java --- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentWitnessBean.java Thu Dec 08 16:05:18 2016 +0100 +++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentWitnessBean.java Fri Dec 09 21:18:27 2016 +0100 @@ -17,6 +17,7 @@ import org.mpi.openmind.repository.bo.Relation; import org.mpi.openmind.security.bo.User; +import de.mpiwg.itgroup.ismi.auxObjects.AliasListenerObject; import de.mpiwg.itgroup.ismi.auxObjects.ListenerObject; import de.mpiwg.itgroup.ismi.auxObjects.lo.WitnessAuthorLO; import de.mpiwg.itgroup.ismi.auxObjects.lo.WitnessTextLO; @@ -71,7 +72,7 @@ private ListenerObject copyistLo = new ListenerObject(PERSON, name_translit); // WITENSS -> was_copied_at -> PLACE - private ListenerObject copyPlaceLo = new ListenerObject(PLACE, name); + private ListenerObject copyPlaceLo = new AliasListenerObject(PLACE, name, "is_alias_name_of"); // WITNESS -> xx -> PERSON private ListenerObject patronageLo = new ListenerObject(PERSON, name_translit); @@ -209,8 +210,21 @@ // WITENSS -> was_copied_by -> PERSON this.entity.replaceSourceRelation(this.copyistLo.entity, PERSON, rel_was_copied_by); - //WITENSS -> was_copied_in -> PLACE - this.entity.replaceSourceRelation(this.copyPlaceLo.entity, PLACE, "was_copied_in"); + // WITNESS -> was_copied_in -> PLACE + Entity copyPlace = this.copyPlaceLo.entity; + if (copyPlace != null && copyPlace.getObjectClass().equals(PLACE)) { + // regular PLACE + this.entity.replaceSourceRelation(copyPlace, PLACE, "was_copied_in"); + } else if (copyPlace != null && copyPlace.getObjectClass().equals("ALIAS")) { + // WITNESS -> was_copied_in_as -> ALIAS + this.entity.replaceSourceRelation(copyPlace, "ALIAS", "was_copied_in_as"); + // ALIAS -> is_alias_name_of -> PLACE + List places = getWrapper().getTargetsForSourceRelation(copyPlace, "is_alias_name_of", "PLACE", 1); + if (! places.isEmpty()) { + // WITNESS -> was_copied_in -> PLACE + this.entity.replaceSourceRelation(places.get(0), PLACE, "was_copied_in"); + } + } //REFERENCE -> is_reference_of -> WITNESS //this.entity = this.prepareReferencesToSave(this.entity); @@ -356,7 +370,7 @@ List targets = getWrapper().getTargetsForSourceRelation(titleLo.getEntity(), rel_was_created_by, PERSON, 1); if(targets.size() > 0){ - this.authorLo.setEntityAndAttribute0(targets.get(0)); + this.authorLo.setEntityAndAttribute(targets.get(0)); }else{ this.authorLo.reset(); @@ -453,12 +467,10 @@ for (Relation rel : witness.getSourceRelations()) { Entity target = null; if (rel.getOwnValue().equals(is_exemplar_of)) { - // WITNESS -> is_exemplar_of -> TEXT target = getTargetRelation(rel); - titleLo.setEntityAndAttribute0(target); + titleLo.setEntityAndAttribute(target); this.updateTitle(); - } else if (rel.getOwnValue().equals(is_possible_exemplar_of)) { // WITNESS -> is_possible_exemplar_of -> TEXT target = getTargetRelation(rel); @@ -469,18 +481,25 @@ } else if (rel.getOwnValue().equals(rel_was_copied_by)) { // WITENSS -> was_copied_by -> PERSON target = getTargetRelation(rel); - copyistLo.setEntityAndAttribute0(target); + copyistLo.setEntityAndAttribute(target); } else if (rel.getOwnValue().equals("was_copied_in")) { // WITENSS -> was_copied_in -> PLACE target = getTargetRelation(rel); - copyPlaceLo.setEntityAndAttribute0(target); + // don't use place if there is an alias + if (copyPlaceLo.getEntity().getObjectClass() == null) { + copyPlaceLo.setEntityAndAttribute(target); + } + } else if (rel.getOwnValue().equals("was_copied_in_as")) { + // WITENSS -> was_copied_in_as -> ALIAS + target = getTargetRelation(rel); + copyPlaceLo.setEntityAndAttribute(target); } else if (rel.getOwnValue().equals(rel_had_patron)) { // WITNESS -> had_patron -> PERSON target = getTargetRelation(rel); - patronageLo.setEntityAndAttribute(target, name_translit); + patronageLo.setEntityAndAttributeName(target, name_translit); } else if (rel.getOwnValue().equals(is_part_of)) { - // WITNESS -> had_patron -> PERSON - if(rel.getTargetObjectClass().equals(CODEX)){ + // WITNESS -> is_part_of -> CODEX + if (rel.getTargetObjectClass().equals(CODEX)) { target = getTargetRelation(rel); this.setCodex(target); } @@ -514,7 +533,7 @@ * @param codex */ public void setCodex(Entity codex){ - this.getCodexLo().setEntityAndAttribute(codex, "identifier"); + this.getCodexLo().setEntityAndAttributeName(codex, "identifier"); if(this.getCodexLo().entity != null && this.getCodexLo().entity.isPersistent()){ @@ -684,7 +703,7 @@ if(this.selectedTitleId != null){ Entity title = getWrapper().getEntityById(this.selectedTitleId); if(title != null){ - this.titleLo.setEntityAndAttribute0(title); + this.titleLo.setEntityAndAttribute(title); this.updateTitle(); setSelectTitleRendered(false); } @@ -771,11 +790,11 @@ Entity selectedPerson = getWrapper().getEntityByIdWithContent(selectedPersonId); if(selectedPerson != null){ if (role.equals("Copyist")) { - copyistLo.setEntityAndAttribute0(selectedPerson); + copyistLo.setEntityAndAttribute(selectedPerson); } else if (role.equals("Patron")) { - patronageLo.setEntityAndAttribute0(selectedPerson); + patronageLo.setEntityAndAttribute(selectedPerson); } else if (role.equals("Author")) { - authorLo.setEntityAndAttribute0(selectedPerson); + authorLo.setEntityAndAttribute(selectedPerson); this.updateAuthor(); } setSelectPersonRendered(false); @@ -879,7 +898,7 @@ //juc Attribute att = getWrapper().getAttributeByName(possibleCodex, "identifier"); Attribute att = getWrapper().getAttributeByName(possibleCodex.getId(), "identifier"); if(att != null && identifier.equals(att.getValue())){ - getCodexLo().setEntityAndAttribute(possibleCodex, "identifier"); + getCodexLo().setEntityAndAttributeName(possibleCodex, "identifier"); return true; } } @@ -892,7 +911,7 @@ getWrapper().saveEntity(newCodex, user); Relation isPartOf = new Relation(newCodex, getCollectionLo().getEntity(), is_part_of); getWrapper().saveRelationAsNode(isPartOf, user); - getCodexLo().setEntityAndAttribute(newCodex, "identifier"); + getCodexLo().setEntityAndAttributeName(newCodex, "identifier"); } catch (Exception e) { logger.error(e.getMessage(), e); diff -r e5d4443a1bc5 -r 22a18bfc66b0 src/main/java/de/mpiwg/itgroup/ismi/event/beans/CopyEvent.java --- a/src/main/java/de/mpiwg/itgroup/ismi/event/beans/CopyEvent.java Thu Dec 08 16:05:18 2016 +0100 +++ b/src/main/java/de/mpiwg/itgroup/ismi/event/beans/CopyEvent.java Fri Dec 09 21:18:27 2016 +0100 @@ -47,20 +47,20 @@ if (rel.getOwnValue().equals(was_copied_for)) { //EVENT was_copied_for PERSON target = getTargetRelation(rel); - personCopiedForLo.setEntityAndAttribute0(target); + personCopiedForLo.setEntityAndAttribute(target); }else if (rel.getOwnValue().equals(has_person_copying_text)) { //EVENT has_person_copying_text PERSON target = getTargetRelation(rel); - personCopyingTextLo.setEntityAndAttribute0(target); + personCopyingTextLo.setEntityAndAttribute(target); } else if (rel.getOwnValue().equals(was_copied_in)) { target = getTargetRelation(rel); if(target.getObjectClass().equals(PLACE)){ //EVENT was_copied_in PLACE - placeLo.setEntityAndAttribute0(target); + placeLo.setEntityAndAttribute(target); }else if(target.getObjectClass().equals(REPOSITORY)){ //EVENT was_copied_in REPOSITORY - repositoryLo.setEntityAndAttribute0(target); + repositoryLo.setEntityAndAttribute(target); } } else if (rel.getOwnValue().equals(is_a_copy_of)) { //EVENT is_a_copy_of WITNESS @@ -68,7 +68,7 @@ this.witness = getTargetRelation(rel); if(witness != null && witness.isPersistent()){ witnessId = witness.getId(); - this.textLo.setEntityAndAttribute0( getTextOfWitness(witness)); + this.textLo.setEntityAndAttribute( getTextOfWitness(witness)); refreshWitnesses(textLo.entity); } } diff -r e5d4443a1bc5 -r 22a18bfc66b0 src/main/java/de/mpiwg/itgroup/ismi/event/beans/StudyEvent.java --- a/src/main/java/de/mpiwg/itgroup/ismi/event/beans/StudyEvent.java Thu Dec 08 16:05:18 2016 +0100 +++ b/src/main/java/de/mpiwg/itgroup/ismi/event/beans/StudyEvent.java Fri Dec 09 21:18:27 2016 +0100 @@ -74,20 +74,20 @@ if (rel.getOwnValue().equals(was_studied_by)) { //EVENT was_studied_by PERSON target = getTargetRelation(rel); - personLo.setEntityAndAttribute0(target); + personLo.setEntityAndAttribute(target); }else if (rel.getOwnValue().equals(was_advised_by)) { //EVENT was_advised_by PERSON target = getTargetRelation(rel); - advisorLo.setEntityAndAttribute0(target); + advisorLo.setEntityAndAttribute(target); } else if (rel.getOwnValue().equals(was_studied_in)) { target = getTargetRelation(rel); if(target.getObjectClass().equals(PLACE)){ //EVENT was_studied_in PLACE - placeLo.setEntityAndAttribute0(target); + placeLo.setEntityAndAttribute(target); }else if(target.getObjectClass().equals(REPOSITORY)){ //EVENT was_studied_in REPOSITORY - repositoryLo.setEntityAndAttribute0(target); + repositoryLo.setEntityAndAttribute(target); } } else if (rel.getOwnValue().equals(is_a_study_of)) { //EVENT study_of WITNESS @@ -95,7 +95,7 @@ this.witness = getTargetRelation(rel); if(witness != null && witness.isPersistent()){ witnessId = witness.getId(); - this.textLo.setEntityAndAttribute0( getTextOfWitness(witness)); + this.textLo.setEntityAndAttribute( getTextOfWitness(witness)); refreshWitnesses(textLo.entity); } } diff -r e5d4443a1bc5 -r 22a18bfc66b0 src/main/java/de/mpiwg/itgroup/ismi/event/beans/TransferEvent.java --- a/src/main/java/de/mpiwg/itgroup/ismi/event/beans/TransferEvent.java Thu Dec 08 16:05:18 2016 +0100 +++ b/src/main/java/de/mpiwg/itgroup/ismi/event/beans/TransferEvent.java Fri Dec 09 21:18:27 2016 +0100 @@ -68,10 +68,10 @@ // EVENT -> was_transferred_from -> PERSON/REPOSITORY target = getTargetRelation(rel); if(target.getObjectClass().equals(PERSON)){ - personFromLo.setEntityAndAttribute0(target); + personFromLo.setEntityAndAttribute(target); selectedPersonFrom = true; }else{ - repositoryFromLo.setEntityAndAttribute0(target); + repositoryFromLo.setEntityAndAttribute(target); selectedPersonFrom = false; } @@ -79,30 +79,30 @@ // EVENT -> was_transferred_to -> PERSON/REPOSITORY target = getTargetRelation(rel); if(target.getObjectClass().equals(PERSON)){ - personToLo.setEntityAndAttribute0(target); + personToLo.setEntityAndAttribute(target); selectedPersonTo = true; }else{ - repositoryToLo.setEntityAndAttribute0(target); + repositoryToLo.setEntityAndAttribute(target); selectedPersonTo = false; } } else if (rel.getOwnValue().equals(has_original_location)) { // EVENT -> has_original_location -> PLACE/REPOSITORY target = getTargetRelation(rel); if(target.getObjectClass().equals(PLACE)){ - placeOriginalLocationLo.setEntityAndAttribute0(target); + placeOriginalLocationLo.setEntityAndAttribute(target); selectedPlaceOriginalLocation = true; }else{ - repositoryOriginalLocationLo.setEntityAndAttribute0(target); + repositoryOriginalLocationLo.setEntityAndAttribute(target); selectedPlaceOriginalLocation = false; } } else if (rel.getOwnValue().equals(has_new_location)) { // EVENT -> has_new_location -> PLACE/REPOSITORY target = getTargetRelation(rel); if(target.getObjectClass().equals(PLACE)){ - placeNewLocationLo.setEntityAndAttribute0(target); + placeNewLocationLo.setEntityAndAttribute(target); selectedPlaceNewLocation = true; }else{ - repositoryNewLocationLo.setEntityAndAttribute0(target); + repositoryNewLocationLo.setEntityAndAttribute(target); selectedPlaceNewLocation = false; } } else if (rel.getOwnValue().equals(is_a_transfer_of)) { @@ -111,12 +111,12 @@ this.witness = getTargetRelation(rel); if(witness != null && witness.isPersistent()){ witnessId = witness.getId(); - this.textLo.setEntityAndAttribute0( getTextOfWitness(witness)); + this.textLo.setEntityAndAttribute( getTextOfWitness(witness)); refreshWitnesses(textLo.entity); } } else if (rel.getOwnValue().equals(was_transferred_in)) { target = getTargetRelation(rel); - this.placeLo.setEntityAndAttribute0(target); + this.placeLo.setEntityAndAttribute(target); } } } diff -r e5d4443a1bc5 -r 22a18bfc66b0 src/main/webapp/defs/defEditor.xhtml --- a/src/main/webapp/defs/defEditor.xhtml Thu Dec 08 16:05:18 2016 +0100 +++ b/src/main/webapp/defs/defEditor.xhtml Fri Dec 09 21:18:27 2016 +0100 @@ -102,7 +102,7 @@ - @@ -162,7 +162,7 @@ - @@ -222,7 +222,7 @@ - diff -r e5d4443a1bc5 -r 22a18bfc66b0 src/main/webapp/entry/place.xhtml --- a/src/main/webapp/entry/place.xhtml Thu Dec 08 16:05:18 2016 +0100 +++ b/src/main/webapp/entry/place.xhtml Fri Dec 09 21:18:27 2016 +0100 @@ -27,10 +27,9 @@ - + - + diff -r e5d4443a1bc5 -r 22a18bfc66b0 src/main/webapp/entry/witness.xhtml --- a/src/main/webapp/entry/witness.xhtml Thu Dec 08 16:05:18 2016 +0100 +++ b/src/main/webapp/entry/witness.xhtml Fri Dec 09 21:18:27 2016 +0100 @@ -53,7 +53,7 @@ action="#{CurrentWitness.showOtherTextsByAuthorAction}" /> - + @@ -237,7 +237,7 @@ action="#{CurrentWitness.showAllCopyistsAction}" /> - + @@ -245,7 +245,7 @@ - +