# HG changeset patch # User casties # Date 1478545189 -3600 # Node ID 99f9a55a495778a54a5030406b03acf1c1b514b7 # Parent 71efad4fe975a2ff1652bfc7123f2954e1a6a0fa add alias to place entry form. diff -r 71efad4fe975 -r 99f9a55a4957 src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentCityBean.java --- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentCityBean.java Mon Nov 07 17:04:43 2016 +0100 +++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentCityBean.java Mon Nov 07 19:59:49 2016 +0100 @@ -15,6 +15,7 @@ import org.mpi.openmind.repository.bo.Relation; import de.mpiwg.itgroup.ismi.auxObjects.ListenerObject; +import de.mpiwg.itgroup.ismi.util.guiComponents.EntityList; import de.mpiwg.itgroup.ismi.utils.SelectableObject; @@ -26,8 +27,9 @@ private List suggestedTypes; private List> placesPartOfThis; - private List> peopleLivedIn; - + //private List> peopleLivedIn; + private EntityList aliasList; + public CurrentCityBean() { this.reset(); } @@ -39,7 +41,8 @@ this.suggestedTypes = new ArrayList(); this.placesPartOfThis = new ArrayList>(); - this.peopleLivedIn = new ArrayList>(); + //this.peopleLivedIn = new ArrayList>(); + this.aliasList = new EntityList(ALIAS, "alias", getWrapper(), getUserName()); //setDefinition(getDefinition(PLACE)); setDefObjectClass(PLACE); @@ -92,6 +95,13 @@ this.placesPartOfThis.add(new SelectableObject(place, label)); } + /* + * create list of alias names of this place + */ + for (Entity alias : getWrapper().getSourcesForTargetRelation(city, is_alias_name_of, ALIAS, -1)) { + this.aliasList.add(alias); + } + // load references this.loadEndNoteRefs(); @@ -121,6 +131,7 @@ String cityName = (this.entity.getAttributeByName(name) != null) ? this.entity.getAttributeByName(name).getValue() : ""; if(StringUtils.isNotEmpty(cityName)){ + // check if name is unique if(!checkUnityCity(cityName, (isSelectedSaveAsNew()) ? null : this.entity.getId(), this.getCountryLo().entity)){ this.renderUnityCheckerDialog(); this.setSelectedSaveAsNew(false); @@ -148,6 +159,13 @@ } */ + //ALIAS -> is_alias_name_of -> PERSON + this.entity.removeAllTargetRelationsByName(is_alias_name_of); + for(Entity alias : this.aliasList.getEntities()){ + Entity alias0 = getWrapper().getEntityByIdWithContent(alias.getId()); + new Relation(alias0, this.entity, is_alias_name_of); + } + //REFERENCE -> is_reference_of -> THIS //this.entity = this.prepareReferencesToSave(this.entity); this.prepareEndNoteRefs2Save(); @@ -188,13 +206,13 @@ } } - public void listenerRemovePeopleLivedIn(){ + /* public void listenerRemovePeopleLivedIn(){ for(SelectableObject so : new ArrayList>(this.peopleLivedIn)){ if(so.isSelected()){ this.peopleLivedIn.remove(so); } } - } + } */ public void removeThisCountryAction(ActionEvent event) { if (this.getCountryLo().entity != null) { @@ -223,11 +241,25 @@ this.placesPartOfThis = placesPartOfThis; } - public List> getPeopleLivedIn() { + /* public List> getPeopleLivedIn() { return peopleLivedIn; } public void setPeopleLivedIn(List> peopleLivedIn) { this.peopleLivedIn = peopleLivedIn; - } + } */ + + /** + * @return the aliasList + */ + public EntityList getAliasList() { + return aliasList; + } + + /** + * @param aliasList the aliasList to set + */ + public void setAliasList(EntityList aliasList) { + this.aliasList = aliasList; + } } diff -r 71efad4fe975 -r 99f9a55a4957 src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentPersonBean.java --- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentPersonBean.java Mon Nov 07 17:04:43 2016 +0100 +++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentPersonBean.java Mon Nov 07 19:59:49 2016 +0100 @@ -1,18 +1,15 @@ package de.mpiwg.itgroup.ismi.entry.beans; import java.io.Serializable; -import java.util.Date; import java.util.HashMap; import java.util.Map; -import javax.faces.component.UIComponent; import javax.faces.convert.Converter; import javax.faces.event.ActionEvent; import javax.faces.event.AjaxBehaviorEvent; import javax.faces.event.ValueChangeEvent; import org.apache.log4j.Logger; -import org.mpi.openmind.cache.WrapperService; import org.mpi.openmind.repository.bo.Attribute; import org.mpi.openmind.repository.bo.Entity; import org.mpi.openmind.repository.bo.Node; @@ -20,8 +17,6 @@ import org.mpi.openmind.repository.utils.RomanizationLoC; import org.mpi.openmind.repository.utils.TransliterationUtil; - - /* rich import com.icesoft.faces.async.render.SessionRenderer; import com.icesoft.faces.component.ext.HtmlCommandButton; @@ -252,18 +247,19 @@ this.entity.replaceSourceRelation(deathPlaceLo.entity, PLACE, "died_in"); + //ALIAS -> is_prime_alias_name_of -> PERSON this.entity.removeAllTargetRelationsByName(is_prime_alias_name_of); if (shortNameAlias != null) { shortNameAlias.setObjectClass(ALIAS); shortNameAlias = getWrapper().saveEntity(shortNameAlias, getSessionUser().getEmail()); - Relation aliasRel = new Relation(shortNameAlias, this.entity, is_alias_name_of); + new Relation(shortNameAlias, this.entity, is_alias_name_of); } //ALIAS -> is_alias_name_of -> PERSON this.entity.removeAllTargetRelationsByName(is_alias_name_of); for(Entity alias : this.aliasList.getEntities()){ Entity alias0 = getWrapper().getEntityByIdWithContent(alias.getId()); - Relation aliasRel = new Relation(alias0, this.entity, is_alias_name_of); + new Relation(alias0, this.entity, is_alias_name_of); } // PERSON -> lived_in manyToMany -> PLACE @@ -290,21 +286,21 @@ floruitDate0.getAttributeByName("date").setValue(cal.toJSONString()); } getWrapper().saveAssertion(floruitDate0, getUserName()); - Relation hasFloruitDate = new Relation(this.entity, floruitDate0, has_floruit_date); + new Relation(this.entity, floruitDate0, has_floruit_date); } //PERSON -> student of manyToMany -> PERSON this.entity.removeAllSourceRelationsByName(was_student_of); for(Entity teacher : this.studentOfList.getEntities()){ Entity teacher0 = getWrapper().getEntityByIdWithContent(teacher.getId()); - Relation studentOf = new Relation(this.entity, teacher0, was_student_of); + new Relation(this.entity, teacher0, was_student_of); } //PERSON -> has_role -> ROLE this.entity.removeAllSourceRelationsByName(has_role); for(Entity role : this.roleList.getEntities()){ Entity role0 = getWrapper().getEntityByIdWithContent(role.getId()); - Relation hasRole = new Relation(this.entity, role0, has_role); + new Relation(this.entity, role0, has_role); } //REFERENCE -> is_reference_of -> THIS diff -r 71efad4fe975 -r 99f9a55a4957 src/main/webapp/entry/person.xhtml --- a/src/main/webapp/entry/person.xhtml Mon Nov 07 17:04:43 2016 +0100 +++ b/src/main/webapp/entry/person.xhtml Mon Nov 07 19:59:49 2016 +0100 @@ -159,7 +159,7 @@ value="#{CurrentPerson.livedInPlaces.selections[item.id]}" /> - @@ -199,7 +199,7 @@ value="#{CurrentPerson.floruitList.selections[item.id]}" /> - @@ -221,7 +221,7 @@ value="#{CurrentPerson.aliasList.selections[item.id]}" /> - @@ -246,7 +246,7 @@ value="#{CurrentPerson.roleList.selections[item.id]}" /> - diff -r 71efad4fe975 -r 99f9a55a4957 src/main/webapp/entry/place.xhtml --- a/src/main/webapp/entry/place.xhtml Mon Nov 07 17:04:43 2016 +0100 +++ b/src/main/webapp/entry/place.xhtml Mon Nov 07 19:59:49 2016 +0100 @@ -65,6 +65,32 @@ rendered="#{!empty CurrentCity.placesPartOfThis}"/> + + + + + + + + + + + + + + + + + + + + +