comparison src/main/java/de/mpiwg/itgroup/ismi/entry/beans/AbstractISMIBean.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 32ce1f93ad33
children eee2e0ca4032
comparison
equal deleted inserted replaced
123:32ce1f93ad33 124:28a0c2726466
296 //REFERENCE -> is_reference_of -> WITNESS 296 //REFERENCE -> is_reference_of -> WITNESS
297 this.entity.removeAllTargetRelationsByName(rel_is_reference_of); 297 this.entity.removeAllTargetRelationsByName(rel_is_reference_of);
298 for (SelectableObject<Reference> so : this.endNoteRefTable.list) { 298 for (SelectableObject<Reference> so : this.endNoteRefTable.list) {
299 Reference ref = so.getObj(); 299 Reference ref = so.getObj();
300 Entity entRef = ref.getEnt(); 300 Entity entRef = ref.getEnt();
301 getWrapper().saveEntity(entRef, getUserName()); 301 getWrapper().saveEntity(entRef, getUserName(), Reference.editReferenceIntent);
302 //entity can be no persistent, therefore the assignment of the relation should be done after the save 302 //entity can be no persistent, therefore the assignment of the relation should be done after the save
303 entRef.addSourceRelation(rel_is_reference_of, entity); 303 entRef.addSourceRelation(rel_is_reference_of, entity);
304 //new Relation(entRef, entity, rel_is_reference_of); 304 //new Relation(entRef, entity, rel_is_reference_of);
305 } 305 }
306 } 306 }
901 List<Entity> nodeList = new ArrayList<Entity>(); 901 List<Entity> nodeList = new ArrayList<Entity>();
902 902
903 /* 903 /*
904 * run updates depending on type 904 * run updates depending on type
905 */ 905 */
906 if (entity.getObjectClass().equals(PLACE)) { 906 String oc = entity.getObjectClass();
907 if (oc.equals(PLACE)) {
907 this.generateOW4City(entity, nodeList, user); 908 this.generateOW4City(entity, nodeList, user);
908 getWrapper().saveEntityListAsNodeWithoutContent(nodeList, user); 909 getWrapper().saveEntityListAsNodeWithoutContent(nodeList, user);
909 910
910 } else if (entity.getObjectClass().equals(REPOSITORY)) { 911 } else if (oc.equals(REPOSITORY)) {
911 this.generateOW4Repository(entity, nodeList, new HashMap<String, String>(), user); 912 this.generateOW4Repository(entity, nodeList, new HashMap<String, String>(), user);
912 getWrapper().saveEntityListAsNodeWithoutContent(nodeList, user); 913 getWrapper().saveEntityListAsNodeWithoutContent(nodeList, user);
913 914
914 } else if (entity.getObjectClass().equals(COLLECTION)) { 915 } else if (oc.equals(COLLECTION)) {
915 this.generateOW4Collection(entity, nodeList, new HashMap<String, String>(), user); 916 this.generateOW4Collection(entity, nodeList, new HashMap<String, String>(), user);
916 getWrapper().saveEntityListAsNodeWithoutContent(nodeList, user); 917 getWrapper().saveEntityListAsNodeWithoutContent(nodeList, user);
917 918
918 } else if (entity.getObjectClass().equals(CODEX)) { 919 } else if (oc.equals(CODEX)) {
919 this.generateOW4Codex(entity, nodeList, new HashMap<String, String>(), user); 920 this.generateOW4Codex(entity, nodeList, new HashMap<String, String>(), user);
920 getWrapper().saveEntityListAsNodeWithoutContent(nodeList, user); 921 getWrapper().saveEntityListAsNodeWithoutContent(nodeList, user);
921 922
922 } else if (entity.getObjectClass().equals(TEXT)) { 923 } else if (oc.equals(TEXT)) {
923 generateOW4Text(entity, user); 924 generateOW4Text(entity, user);
924 } 925 }
925 // TODO PERSON and TEXT
926 } 926 }
927 927
928 private void generateOW4City(Entity city, List<Entity> nodeList, String user){ 928 private void generateOW4City(Entity city, List<Entity> nodeList, String user){
929 Map<String, String> map = new HashMap<String, String>(); 929 Map<String, String> map = new HashMap<String, String>();
930 map.put(PLACE, city.getOwnValue()); 930 map.put(PLACE, city.getOwnValue());
1008 nodeList.add(witness); 1008 nodeList.add(witness);
1009 } 1009 }
1010 } 1010 }
1011 1011
1012 private void generateOW4Text(Entity text, String user) throws Exception{ 1012 private void generateOW4Text(Entity text, String user) throws Exception{
1013 // FIXME: these loops seem to be wrong :-(
1013 List<Entity> witnessList = getWrapper().getSourcesForTargetRelation(text, "is_exemplar_of", WITNESS, -1); 1014 List<Entity> witnessList = getWrapper().getSourcesForTargetRelation(text, "is_exemplar_of", WITNESS, -1);
1014 List<Entity> listToSave = new ArrayList<Entity>(); 1015 List<Entity> listToSave = new ArrayList<Entity>();
1015 for(Entity witness : witnessList){ 1016 for(Entity witness : witnessList){
1016 List<Entity> list = getWrapper().getTargetsForSourceRelation(witness, "is_part_of", "CODEX", 1); 1017 List<Entity> list = getWrapper().getTargetsForSourceRelation(witness, "is_part_of", "CODEX", 1);
1017 if(list.size() > 0){ 1018 if(list.size() > 0){