comparison src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentWitnessBean.java @ 124:28a0c2726466

changed saveEntity() to use new EditIntent. Set up EditIntent for TEXT, PERSON, REFERENCE.
author casties
date Mon, 30 Jan 2017 20:35:36 +0100
parents fb3cb7d70f66
children eee2e0ca4032
comparison
equal deleted inserted replaced
123:32ce1f93ad33 124:28a0c2726466
257 257
258 // WITNESS -> is_part_of_codex 258 // WITNESS -> is_part_of_codex
259 if(this.isSelectedSaveAsNew()){ 259 if(this.isSelectedSaveAsNew()){
260 this.entity = getWrapper().saveEntityAsNew(this.entity, user.getEmail()); 260 this.entity = getWrapper().saveEntityAsNew(this.entity, user.getEmail());
261 }else{ 261 }else{
262 this.entity = getWrapper().saveEntity(this.entity, user.getEmail()); 262 this.entity = getWrapper().saveEntity(this.entity, user.getEmail(), null);
263 } 263 }
264 this.setEntity(this.entity); 264 this.setEntity(this.entity);
265 265
266 logger.info("Entity saved - Time = " + (System.currentTimeMillis() - start) + ", " + entity); 266 logger.info("Entity saved - Time = " + (System.currentTimeMillis() - start) + ", " + entity);
267 this.printSuccessSavingEntity(); 267 this.printSuccessSavingEntity();
297 } 297 }
298 298
299 if(alias == null){ 299 if(alias == null){
300 alias = new Entity(Node.TYPE_ABOX, ALIAS, false); 300 alias = new Entity(Node.TYPE_ABOX, ALIAS, false);
301 alias.addAttribute(new Attribute(ALIAS, "text", valueTextWritten)); 301 alias.addAttribute(new Attribute(ALIAS, "text", valueTextWritten));
302 alias = getWrapper().saveEntity(alias, user.getEmail()); 302 alias = getWrapper().saveEntity(alias, user.getEmail(), null);
303 new Relation(alias, this.titleLo.getEntity(), "is_alias_title_of"); 303 new Relation(alias, this.titleLo.getEntity(), "is_alias_title_of");
304 alias = getWrapper().saveEntity(alias, user.getEmail()); 304 alias = getWrapper().saveEntity(alias, user.getEmail(), null);
305 } 305 }
306 if(alias.isLightweight()){ 306 if(alias.isLightweight()){
307 alias = getWrapper().getEntityByIdWithContent(alias.getId()); 307 alias = getWrapper().getEntityByIdWithContent(alias.getId());
308 } 308 }
309 this.entity.replaceSourceRelation(alias, ALIAS, rel_has_title_written_as); 309 this.entity.replaceSourceRelation(alias, ALIAS, rel_has_title_written_as);
326 } 326 }
327 327
328 if(alias == null){ 328 if(alias == null){
329 alias = new Entity(Node.TYPE_ABOX, ALIAS, false); 329 alias = new Entity(Node.TYPE_ABOX, ALIAS, false);
330 alias.addAttribute(new Attribute(ALIAS, "text", valueAuthorWritten)); 330 alias.addAttribute(new Attribute(ALIAS, "text", valueAuthorWritten));
331 alias = getWrapper().saveEntity(alias, user.getEmail()); 331 alias = getWrapper().saveEntity(alias, user.getEmail(), null);
332 new Relation(alias, this.authorLo.getEntity(), "is_alias_name_of"); 332 new Relation(alias, this.authorLo.getEntity(), "is_alias_name_of");
333 alias = getWrapper().saveEntity(alias, user.getEmail()); 333 alias = getWrapper().saveEntity(alias, user.getEmail(), null);
334 } 334 }
335 if(alias.isLightweight()){ 335 if(alias.isLightweight()){
336 alias = getWrapper().getEntityByIdWithContent(alias.getId()); 336 alias = getWrapper().getEntityByIdWithContent(alias.getId());
337 } 337 }
338 this.entity.replaceSourceRelation(alias, ALIAS, rel_has_author_written_as); 338 this.entity.replaceSourceRelation(alias, ALIAS, rel_has_author_written_as);
907 } 907 }
908 908
909 //if the Collection Status == OK && the Codex.identifier != null 909 //if the Collection Status == OK && the Codex.identifier != null
910 Entity newCodex = new Entity(Node.TYPE_ABOX, CODEX, false); 910 Entity newCodex = new Entity(Node.TYPE_ABOX, CODEX, false);
911 newCodex.addAttribute(new Attribute("identifier", TEXT, identifier)); 911 newCodex.addAttribute(new Attribute("identifier", TEXT, identifier));
912 getWrapper().saveEntity(newCodex, user); 912 getWrapper().saveEntity(newCodex, user, null);
913 Relation isPartOf = new Relation(newCodex, getCollectionLo().getEntity(), is_part_of); 913 Relation isPartOf = new Relation(newCodex, getCollectionLo().getEntity(), is_part_of);
914 getWrapper().saveRelationAsNode(isPartOf, user); 914 getWrapper().saveRelationAsNode(isPartOf, user);
915 getCodexLo().setEntityAndAttributeName(newCodex, "identifier"); 915 getCodexLo().setEntityAndAttributeName(newCodex, "identifier");
916 916
917 } catch (Exception e) { 917 } catch (Exception e) {