comparison src/main/java/de/mpiwg/itgroup/ismi/event/beans/StudyEvent.java @ 134:25bfcc9d757c

effort to re-use more relations when saving entities. new replaceMultipleSourceRelations() and changes to use it. changes for renamed replaceUniqueSourceRelation().
author casties
date Fri, 24 Feb 2017 20:25:33 +0100
parents 28a0c2726466
children
comparison
equal deleted inserted replaced
133:5ccd6e709f95 134:25bfcc9d757c
113 try { 113 try {
114 getAttributes().put("date", this.date.toJSONString()); 114 getAttributes().put("date", this.date.toJSONString());
115 event = updateEntityAttributes(event); 115 event = updateEntityAttributes(event);
116 116
117 // EVENT -> was_studied_by -> PERSON 117 // EVENT -> was_studied_by -> PERSON
118 event.replaceSourceRelation(personLo.entity, PERSON, was_studied_by); 118 event.replaceUniqueSourceRelation(personLo.entity, PERSON, was_studied_by);
119 119
120 // EVENT -> was_advised_by -> PERSON 120 // EVENT -> was_advised_by -> PERSON
121 event.replaceSourceRelation(advisorLo.entity, PERSON, was_advised_by); 121 event.replaceUniqueSourceRelation(advisorLo.entity, PERSON, was_advised_by);
122 122
123 // EVENT -> was_studied_in -> PLACE 123 // EVENT -> was_studied_in -> PLACE
124 replaceAliasSourceRelation(event, placeLo, PLACE, was_studied_in, was_studied_in_as); 124 replaceUniqueAliasSourceRelation(event, placeLo, PLACE, was_studied_in, was_studied_in_as);
125 125
126 // EVENT -> is_a_study_of -> WITNESS 126 // EVENT -> is_a_study_of -> WITNESS
127 if(witness.isLightweight()){ 127 if(witness.isLightweight()){
128 witness = getWrapper().getEntityByIdWithContent(witness.getId()); 128 witness = getWrapper().getEntityByIdWithContent(witness.getId());
129 } 129 }
130 event.replaceSourceRelation(witness, WITNESS, is_a_study_of); 130 event.replaceUniqueSourceRelation(witness, WITNESS, is_a_study_of);
131 131
132 getWrapper().saveEntity(event, getSessionUserName(), null); 132 getWrapper().saveEntity(event, getSessionUserName(), null);
133 133
134 printSuccessSavingEntity(); 134 printSuccessSavingEntity();
135 135