# HG changeset patch # User casties # Date 1476122315 -7200 # Node ID a142159f09c13d303008d0e86c4f071ee93c1097 # Parent 8d93f3a0108fa6c4838b316fa76f4684705a13d0 working on better place editing. diff -r 8d93f3a0108f -r a142159f09c1 src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentCityBean.java --- a/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentCityBean.java Thu Oct 06 19:03:56 2016 +0200 +++ b/src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentCityBean.java Mon Oct 10 19:58:35 2016 +0200 @@ -4,18 +4,21 @@ import java.util.ArrayList; import java.util.List; +import javax.faces.event.ActionEvent; 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 org.mpi.openmind.repository.bo.Node; import org.mpi.openmind.repository.bo.Relation; +import de.mpiwg.itgroup.ismi.auxObjects.ListenerObject; import de.mpiwg.itgroup.ismi.utils.SelectableObject; -public class CurrentCityBean extends CodexEditorTemplate implements Serializable{ +public class CurrentCityBean extends CodexEditorTemplate implements Serializable { private static final long serialVersionUID = -8609055286714729597L; private static Logger logger = Logger.getLogger(CurrentCityBean.class); @@ -41,7 +44,13 @@ //setDefinition(getDefinition(PLACE)); setDefObjectClass(PLACE); + // old types String[] types = new String[]{"city","institution", "city_part", "region"}; + // get new types from definition + Attribute typeAtt = getWrapper().getDefAttributeByOwnValue(PLACE, "type"); + if (typeAtt != null) { + types = typeAtt.getPossibleValuesList().toArray(types); + } fillList(suggestedTypes, types); registerChecker(getCountryLo(), "Country not valid!"); @@ -127,11 +136,13 @@ Relation isPartOf = new Relation(place, this.entity, is_part_of); } + /* this.entity.removeAllTargetRelationsByName(lived_in); for(SelectableObject so : this.peopleLivedIn){ Entity person = getWrapper().getEntityByIdWithContent(so.getObj().getId()); Relation livedIn = new Relation(person, this.entity, lived_in); } + */ //REFERENCE -> is_reference_of -> THIS //this.entity = this.prepareReferencesToSave(this.entity); @@ -139,8 +150,8 @@ //String lastAction = ""; if(this.isSelectedSaveAsNew()){ - this.entity.removeAllTargetRelations(is_in, REPOSITORY); - this.entity = getWrapper().saveEntityAsNew(this.entity, getSessionUser().getEmail()); + //this.entity.removeAllTargetRelations(is_in, REPOSITORY); + //this.entity = getWrapper().saveEntityAsNew(this.entity, getSessionUser().getEmail()); this.setSelectedSaveAsNew(false); //lastAction = "Save place as new entity"; }else{ @@ -182,6 +193,14 @@ } } + public void removeThisCountryAction(ActionEvent event) { + if (this.getCountryLo().entity != null) { + this.setCountryLo(new ListenerObject()); + } + } + + + public String saveAsNewEntity(){ this.setSelectedSaveAsNew(true); return save(); diff -r 8d93f3a0108f -r a142159f09c1 src/main/webapp/entry/place.xhtml --- a/src/main/webapp/entry/place.xhtml Thu Oct 06 19:03:56 2016 +0200 +++ b/src/main/webapp/entry/place.xhtml Mon Oct 10 19:58:35 2016 +0200 @@ -11,10 +11,10 @@ - - @@ -22,26 +22,29 @@ - - - - - - - + - + - + + + + + + + + @@ -61,37 +64,7 @@ render="placePartOfThisPanel" rendered="#{!empty CurrentCity.placesPartOfThis}"/> - - - - - - - - - - - - - - - - - - - - - - - @@ -105,7 +78,7 @@ onclick="#{ApplicationBean1.JSConfirmationCleanForm}" /> + value="Place already exists - not saved!" />