Mercurial > hg > ismi-richfaces
changeset 213:38c13c8e9b78
change transfer event from witness to codex.
author | casties |
---|---|
date | Tue, 03 Dec 2019 19:08:31 +0100 |
parents | 310f512f66af |
children | 02bdc92bd594 |
files | src/main/java/de/mpiwg/itgroup/ismi/event/beans/TransferEvent.java src/main/resources/own-value.cfg.xml src/main/webapp/events/transferEvent.xhtml |
diffstat | 3 files changed, 168 insertions(+), 34 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/itgroup/ismi/event/beans/TransferEvent.java Mon Nov 04 15:45:56 2019 +0100 +++ b/src/main/java/de/mpiwg/itgroup/ismi/event/beans/TransferEvent.java Tue Dec 03 19:08:31 2019 +0100 @@ -15,6 +15,7 @@ import de.mpiwg.itgroup.ismi.auxObjects.AliasListenerObject; import de.mpiwg.itgroup.ismi.auxObjects.ListenerObject; import de.mpiwg.itgroup.ismi.auxObjects.lo.EventTextLO; +import de.mpiwg.itgroup.ismi.entry.beans.CodexEditorTemplate; import de.mpiwg.itgroup.ismi.util.guiComponents.Calendar; public class TransferEvent extends AbstractEvent implements Serializable{ @@ -32,6 +33,8 @@ private AliasListenerObject placeNewLocationLo; private List<SelectItem> suggestedTransferOptions = new ArrayList<SelectItem>(); + + private CodexEditorTemplate codexEditor; public TransferEvent(Entity event) { super(event); @@ -45,6 +48,7 @@ @Override public void setEvent(Entity ev){ + if (codexEditor == null) codexEditor = new CodexEditorTemplate(); reset(); event = ev; if(event != null && event.isPersistent()){ @@ -76,14 +80,17 @@ // EVENT -> has_new_location_as -> ALIAS placeNewLocationLo.setEntityAndAttribute(target); } else if (rel.getOwnValue().equals(is_a_transfer_of)) { - // EVENT study_of WITNESS - // WITNESS is_exemplar_of TEXT - this.witness = target; + // EVENT is_a_transfer_of CODEX + Entity codex = target; + if (codex != null && codex.isPersistent()) { + setCodex(codex); + } + /*this.witness = target; if (witness != null && witness.isPersistent()) { witnessId = witness.getId(); this.textLo.setEntityAndAttribute(getTextOfWitness(witness)); refreshWitnesses(textLo.entity); - } + } */ } else if (rel.getOwnValue().equals(was_transferred_in)) { this.placeLo.setEntityAndAttributeIfEmpty(target); } else if (rel.getOwnValue().equals(was_transferred_in_as)) { @@ -96,6 +103,7 @@ @Override public void reset(){ super.reset(); + if (codexEditor != null) codexEditor.reset(); this.defObjectClass = OC; if (personFromLo != null) { @@ -130,6 +138,18 @@ } + public void setCodex(Entity codex){ + this.codexEditor.getCodexLo().setEntityAndAttributeName(codex, "identifier"); + + if(this.codexEditor.getCodexLo().entity != null && this.codexEditor.getCodexLo().entity.isPersistent()){ + + List<Entity> list = getWrapper().getTargetsForSourceRelation(codex, is_part_of, COLLECTION, 1); + if(list.size() > 0){ + this.codexEditor.setCollection(list.get(0)); + } + } + } + public void listenerRefreshTransferOptions(ActionEvent event){ this.refreshTransferOptions(); } @@ -162,11 +182,12 @@ getAttributes().put("date", this.date.toJSONString()); event = updateEntityAttributes(event); - // EVENT -> was_studied_by -> WITNESS - if (witness.isLightweight()) { - this.witness = getWrapper().getEntityByIdWithContent(witness.getId()); + // EVENT -> is_a_transfer_of -> CODEX + Entity codex = codexEditor.getCodexLo().getEntity(); + if (codex.isLightweight()) { + codex = getWrapper().getEntityByIdWithContent(codex.getId()); } - event.replaceUniqueSourceRelation(witness, WITNESS, is_a_transfer_of); + event.replaceUniqueSourceRelation(codex, CODEX, is_a_transfer_of); // EVENT -> was_transferred_from -> PERSON event.replaceUniqueSourceRelation(personFromLo.entity, PERSON, was_transferred_from); @@ -197,7 +218,7 @@ public boolean checkConsistency(){ //TODO - if(this.witness == null || this.textLo.entity == null ){ + if (codexEditor.getCodexLo().getEntity() == null) { return false; } return true; @@ -246,4 +267,12 @@ this.placeNewLocationLo = placeNewLocationLo; } + public CodexEditorTemplate getCodexEditor() { + return codexEditor; + } + + public void setCodexEditor(CodexEditorTemplate codexEditor) { + this.codexEditor = codexEditor; + } + }
--- a/src/main/resources/own-value.cfg.xml Mon Nov 04 15:45:56 2019 +0100 +++ b/src/main/resources/own-value.cfg.xml Tue Dec 03 19:08:31 2019 +0100 @@ -103,6 +103,26 @@ </source-relation> </own-value-rule> + <own-value-rule id="eventTransfer_codex_collection"> + <source-relation name="is_a_transfer_of" substring="false"> + <target object-class="CODEX"> + <source-relation name="is_part_of" substring="false"> + <target object-class="COLLECTION"> + <attribute name="name" end-node="true"/> + </target> + </source-relation> + </target> + </source-relation> + </own-value-rule> + + <own-value-rule id="eventTransfer_codex_id"> + <source-relation name="is_a_transfer_of" substring="false"> + <target object-class="CODEX"> + <attribute name="identifier" end-node="true"/> + </target> + </source-relation> + </own-value-rule> + <own-value-rule id="eventStudy_witness"> <source-relation name="is_a_study_of" substring="false"> <target object-class="WITNESS"> @@ -344,8 +364,9 @@ </print-rule> <print-rule for="TRANSFER_EVENT"> - <formatstr value="Transfer of %eventTransfer_witness%"/> - <entry own-value-rule="eventTransfer_witness"/> + <formatstr value="Transfer of %eventTransfer_codex_collection%_%eventTransfer_codex_id%"/> + <entry own-value-rule="eventTransfer_codex_collection"/> + <entry own-value-rule="eventTransfer_codex_id"/> </print-rule> <print-rule for="MISATTRIBUTION">
--- a/src/main/webapp/events/transferEvent.xhtml Mon Nov 04 15:45:56 2019 +0100 +++ b/src/main/webapp/events/transferEvent.xhtml Tue Dec 03 19:08:31 2019 +0100 @@ -22,29 +22,113 @@ <h:outputLabel value="Own value" /> <h:outputLabel value="#{Session.transferEventForm.event.ownValue}" /> - <h:outputLabel value="Text"/> - <h:panelGrid columns="1"> - <ismi:autocomplete lo="#{Session.transferEventForm.textLo}" /> - - <a4j:outputPanel ajaxRendered="true"> - <h:selectOneMenu - rendered="#{Session.transferEventForm.textLo.statusImage.ok}" - value="#{Session.transferEventForm.witnessId}" - valueChangeListener="#{Session.transferEventForm.listenerChangeWitness}"> - <f:selectItems value="#{Session.transferEventForm.witnessList}" /> - <a4j:ajax event="change" render="selectedWitness1" /> - </h:selectOneMenu> - - <h:panelGrid id="selectedWitness1" style="width: 500px;" columns="1" - rendered="#{Session.transferEventForm.witness != null}"> - <h:outputLabel value="Witness:" /> - <h:outputLabel - value="#{Session.transferEventForm.witness.ownValue} [ID=#{Session.transferEventForm.witness.id}]" /> - </h:panelGrid> - <h:outputLabel rendered="#{Session.transferEventForm.witness != null}" /> - </a4j:outputPanel> - - </h:panelGrid> + <h:outputText value="Codex" styleClass="titlePanel"/> + <h:panelGrid columns="4" styleClass="createPanel" + columnClasses="createPanelFirstColumn" id="digiCodexPanel"> + + <h:outputLabel value="Country" /> + <ismi:autocomplete lo="#{Session.transferEventForm.codexEditor.countryLo}" /> + <h:outputText /> + <h:panelGrid> + <h:commandButton alt="edit" image="#{ApplicationBean1.editImage}" + rendered="#{!empty Session.transferEventForm.codexEditor.countryLo.entity.id}" + actionListener="#{Session.transferEventForm.codexEditor.editThisCountryAction}" /> + </h:panelGrid> + + <h:outputLabel value="Place/City" /> + <ismi:autocomplete lo="#{Session.transferEventForm.codexEditor.cityLo}" /> + <h:panelGrid> + <h:selectOneMenu + rendered="#{!empty Session.transferEventForm.codexEditor.citiesInCurrentCountry}" + valueChangeListener="#{Session.transferEventForm.codexEditor.inCurrentCountryListener}"> + <f:selectItems value="#{Session.transferEventForm.codexEditor.citiesInCurrentCountry}" /> + <a4j:ajax event="change" render="digiCodexPanel" /> + </h:selectOneMenu> + </h:panelGrid> + <h:panelGrid> + <h:commandButton alt="edit" image="#{ApplicationBean1.editImage}" + rendered="#{!empty Session.transferEventForm.codexEditor.cityLo.entity.id}" + actionListener="#{Session.transferEventForm.codexEditor.editThisCityAction}" /> + </h:panelGrid> + + + <h:outputLabel value="Repository" /> + <ismi:autocomplete lo="#{Session.transferEventForm.codexEditor.repositoryLo}" /> + <h:panelGrid> + <h:selectOneMenu partialSubmit="true" + rendered="#{!empty Session.transferEventForm.codexEditor.repositoriesInCurrentCity}" + valueChangeListener="#{Session.transferEventForm.codexEditor.inCurrentCityListener}"> + <f:selectItems value="#{Session.transferEventForm.codexEditor.repositoriesInCurrentCity}" /> + <a4j:ajax event="change" render="digiCodexPanel" /> + </h:selectOneMenu> + <h:outputText + rendered="#{empty Session.transferEventForm.codexEditor.repositoriesInCurrentCity}" /> + </h:panelGrid> + <h:panelGrid> + <h:commandButton alt="edit" image="#{ApplicationBean1.editImage}" + rendered="#{!empty Session.transferEventForm.codexEditor.repositoryLo.entity.id}" + actionListener="#{Session.transferEventForm.codexEditor.editThisRepositoryAction}" /> + </h:panelGrid> + + + <h:outputLabel value="Collection" /> + <ismi:autocomplete lo="#{Session.transferEventForm.codexEditor.collectionLo}" /> + <h:panelGrid> + <h:selectOneMenu + rendered="#{!empty Session.transferEventForm.codexEditor.collectionsInCurrentRepository}" + valueChangeListener="#{Session.transferEventForm.codexEditor.inCurrentRepositoryListener}"> + <f:selectItems + value="#{Session.transferEventForm.codexEditor.collectionsInCurrentRepository}" /> + <a4j:ajax event="change" render="digiCodexPanel" /> + </h:selectOneMenu> + </h:panelGrid> + <h:panelGrid> + <h:commandButton alt="edit" image="#{ApplicationBean1.editImage}" + rendered="#{!empty Session.transferEventForm.codexEditor.collectionLo.entity.id}" + actionListener="#{Session.transferEventForm.codexEditor.editThisCollectionAction}" /> + </h:panelGrid> + + <h:outputLabel value="Shelf Mark / Identifier" /> + <h:panelGroup> + <h:outputText + rendered="#{!empty Session.transferEventForm.codexEditor.codexLo.attribute.ownValue}" + value="#{Session.transferEventForm.codexEditor.codexLo.term}" + style="font-style:normal; + font-size:15px; + font-weight:bold; + font-family:sans-serif;" /> + </h:panelGroup> + <h:panelGrid> + <h:selectOneMenu + rendered="#{!empty Session.transferEventForm.codexEditor.shelfMarksInCurrentCollection}" + valueChangeListener="#{Session.transferEventForm.codexEditor.identifierChangedListener}"> + <f:selectItems + value="#{Session.transferEventForm.codexEditor.shelfMarksInCurrentCollection}" /> + <a4j:ajax event="change" render="digiCodexPanel" /> + </h:selectOneMenu> + </h:panelGrid> + <h:panelGrid> + <h:commandButton alt="edit" image="#{ApplicationBean1.editImage}" + rendered="#{!empty Session.transferEventForm.codexEditor.codexLo.entity.ownValue}" + actionListener="#{Session.transferEventForm.codexEditor.editThisCodexAction}" /> + </h:panelGrid> + + + <h:outputText /> + <h:commandButton + actionListener="#{Session.transferEventForm.codexEditor.checkConsistencyFromCountryToCodex}" + value="Check Consistency From Country To Codex" /> + <h:outputText /> + <h:outputText /> + + <h:outputText /> + <h:commandButton + actionListener="#{Session.transferEventForm.codexEditor.unsetCodex}" + value="Remove Codex" /> + <h:outputText /> + <h:outputText /> + + </h:panelGrid> <h:outputLabel value="From"/>