# HG changeset patch # User casties # Date 1575396511 -3600 # Node ID 38c13c8e9b7878213c326fb91d967225de2a2a1a # Parent 310f512f66afd3e6e802f7a252606208a3440620 change transfer event from witness to codex. diff -r 310f512f66af -r 38c13c8e9b78 src/main/java/de/mpiwg/itgroup/ismi/event/beans/TransferEvent.java --- 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 suggestedTransferOptions = new ArrayList(); + + 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 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; + } + } diff -r 310f512f66af -r 38c13c8e9b78 src/main/resources/own-value.cfg.xml --- 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 @@ + + + + + + + + + + + + + + + + + + + + @@ -344,8 +364,9 @@ - - + + + diff -r 310f512f66af -r 38c13c8e9b78 src/main/webapp/events/transferEvent.xhtml --- 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 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +