Mercurial > hg > ismi-richfaces
changeset 107:99f9a55a4957
add alias to place entry form.
author | casties |
---|---|
date | Mon, 07 Nov 2016 19:59:49 +0100 |
parents | 71efad4fe975 |
children | c03527c428f5 |
files | src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentCityBean.java src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentPersonBean.java src/main/webapp/entry/person.xhtml src/main/webapp/entry/place.xhtml |
diffstat | 4 files changed, 75 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- 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<SelectItem> suggestedTypes; private List<SelectableObject<Entity>> placesPartOfThis; - private List<SelectableObject<Entity>> peopleLivedIn; - + //private List<SelectableObject<Entity>> peopleLivedIn; + private EntityList aliasList; + public CurrentCityBean() { this.reset(); } @@ -39,7 +41,8 @@ this.suggestedTypes = new ArrayList<SelectItem>(); this.placesPartOfThis = new ArrayList<SelectableObject<Entity>>(); - this.peopleLivedIn = new ArrayList<SelectableObject<Entity>>(); + //this.peopleLivedIn = new ArrayList<SelectableObject<Entity>>(); + this.aliasList = new EntityList(ALIAS, "alias", getWrapper(), getUserName()); //setDefinition(getDefinition(PLACE)); setDefObjectClass(PLACE); @@ -92,6 +95,13 @@ this.placesPartOfThis.add(new SelectableObject<Entity>(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<Entity> so : new ArrayList<SelectableObject<Entity>>(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<SelectableObject<Entity>> getPeopleLivedIn() { + /* public List<SelectableObject<Entity>> getPeopleLivedIn() { return peopleLivedIn; } public void setPeopleLivedIn(List<SelectableObject<Entity>> 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; + } }
--- 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
--- 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]}" /> </h:column> </rich:dataTable> - <a4j:commandButton value="Remove Selection" + <a4j:commandButton value="Remove Selected" actionListener="#{CurrentPerson.livedInPlaces.listenerRemoveSelection}" rendered="#{!empty CurrentPerson.livedInPlaces.entities}" render="livedInEventPanel" /> @@ -199,7 +199,7 @@ value="#{CurrentPerson.floruitList.selections[item.id]}" /> </h:column> </h:dataTable> - <h:commandButton value="Remove Selection" + <h:commandButton value="Remove Selected" actionListener="#{CurrentPerson.floruitList.listenerRemoveSelection}" rendered="#{!empty CurrentPerson.floruitList.entities}" /> </h:panelGrid> @@ -221,7 +221,7 @@ value="#{CurrentPerson.aliasList.selections[item.id]}" /> </h:column> </h:dataTable> - <h:commandButton value="Remove Selection" + <h:commandButton value="Remove Selected" actionListener="#{CurrentPerson.aliasList.listenerRemoveSelection}" rendered="#{!empty CurrentPerson.aliasList.entities}" /> </h:panelGrid> @@ -246,7 +246,7 @@ value="#{CurrentPerson.roleList.selections[item.id]}" /> </h:column> </h:dataTable> - <h:commandButton value="Remove Selection" + <h:commandButton value="Remove Selected" rendered="#{!empty CurrentPerson.roleList.entities}" actionListener="#{CurrentPerson.roleList.listenerRemoveSelection}" />
--- 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}"/> </h:panelGrid> + <h:outputText value="Aliases" /> + <h:panelGrid columns="1"> + <h:panelGrid columns="2"> + <h:dataTable value="#{CurrentCity.aliasList.entities}" var="item" + rendered="#{!empty CurrentCity.aliasList.entities}"> + <h:column> + <h:outputText value="#{item.ownValue}" /> + </h:column> + <h:column> + <h:selectBooleanCheckbox + value="#{CurrentCity.aliasList.selections[item.id]}" /> + </h:column> + </h:dataTable> + <h:commandButton value="Remove Selected" + actionListener="#{CurrentCity.aliasList.listenerRemoveSelection}" + rendered="#{!empty CurrentCity.aliasList.entities}" /> + </h:panelGrid> + + <h:panelGrid columns="2"> + <h:inputText value="#{CurrentCity.aliasList.input}" /> + <h:commandButton value="CREATE" + actionListener="#{CurrentCity.aliasList.listenerCreate}" /> + </h:panelGrid> + </h:panelGrid> + <h:outputText /> + </h:panelGrid> <ismi:refWidget entityForm="#{CurrentCity}" />