Mercurial > hg > ismi-richfaces
comparison src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentRepositoryBean.java @ 125:eee2e0ca4032
updated entry beans to use EditIntents.
author | casties |
---|---|
date | Tue, 31 Jan 2017 18:09:54 +0100 |
parents | 28a0c2726466 |
children | 25bfcc9d757c |
comparison
equal
deleted
inserted
replaced
124:28a0c2726466 | 125:eee2e0ca4032 |
---|---|
5 import org.apache.commons.lang.StringUtils; | 5 import org.apache.commons.lang.StringUtils; |
6 import org.apache.log4j.Logger; | 6 import org.apache.log4j.Logger; |
7 import org.mpi.openmind.repository.bo.Attribute; | 7 import org.mpi.openmind.repository.bo.Attribute; |
8 import org.mpi.openmind.repository.bo.Entity; | 8 import org.mpi.openmind.repository.bo.Entity; |
9 import org.mpi.openmind.repository.bo.Node; | 9 import org.mpi.openmind.repository.bo.Node; |
10 import org.mpi.openmind.repository.services.utils.EditIntent; | |
10 | 11 |
11 public class CurrentRepositoryBean extends CodexEditorTemplate implements Serializable{ | 12 public class CurrentRepositoryBean extends CodexEditorTemplate implements Serializable{ |
12 private static final long serialVersionUID = 2926289436446091260L; | 13 private static final long serialVersionUID = 2926289436446091260L; |
13 | 14 |
14 private static Logger logger = Logger.getLogger(CurrentRepositoryBean.class); | 15 private static Logger logger = Logger.getLogger(CurrentRepositoryBean.class); |
15 | 16 |
16 public static int MAX_PLACES = 100; | 17 public static int MAX_PLACES = 100; |
17 //private Entity repository; | 18 //private Entity repository; |
18 | 19 |
20 /** intent to edit all attributes and relations in the form */ | |
21 public static EditIntent editRepositoryIntent = new EditIntent( | |
22 AbstractISMIBean.REPOSITORY, | |
23 // attributes | |
24 new String[]{"name"}, | |
25 // source relations | |
26 new String[]{"is_in"}, | |
27 // target relations | |
28 new String[]{"is_reference_of"}); | |
29 | |
19 @Override | 30 @Override |
20 public void reset(){ | 31 public void reset(){ |
21 super.reset(); | 32 super.reset(); |
22 this.entity = new Entity(Node.TYPE_ABOX, REPOSITORY, false); | 33 this.entity = new Entity(Node.TYPE_ABOX, REPOSITORY, false); |
23 } | 34 } |
69 this.setSelectedSaveAsNew(false); | 80 this.setSelectedSaveAsNew(false); |
70 return PAGE_EDITOR; | 81 return PAGE_EDITOR; |
71 } | 82 } |
72 | 83 |
73 this.entity = this.updateEntityAttributes(this.entity); | 84 this.entity = this.updateEntityAttributes(this.entity); |
74 | 85 |
75 | |
76 Attribute attName = this.entity.getAttributeByName("name"); | 86 Attribute attName = this.entity.getAttributeByName("name"); |
77 String repositoryName = (attName == null) ? null : attName.getValue(); | 87 String repositoryName = (attName == null) ? null : attName.getValue(); |
78 if(StringUtils.isNotEmpty(repositoryName)){ | 88 if(StringUtils.isNotEmpty(repositoryName)){ |
79 if(!checkUnityRepository(repositoryName, (isSelectedSaveAsNew()) ? null : this.entity.getId(), this.getCityLo().entity)){ | 89 if(!checkUnityRepository(repositoryName, (isSelectedSaveAsNew()) ? null : this.entity.getId(), this.getCityLo().entity)){ |
80 this.renderUnityCheckerDialog(); | 90 this.renderUnityCheckerDialog(); |
92 } | 102 } |
93 | 103 |
94 this.entity.replaceSourceRelation(this.getCityLo().getEntity(), PLACE, is_in); | 104 this.entity.replaceSourceRelation(this.getCityLo().getEntity(), PLACE, is_in); |
95 | 105 |
96 //REFERENCE -> is_reference_of -> THIS | 106 //REFERENCE -> is_reference_of -> THIS |
97 //this.entity = this.prepareReferencesToSave(this.entity); | |
98 this.prepareEndNoteRefs2Save(); | 107 this.prepareEndNoteRefs2Save(); |
99 | 108 |
100 if(isSelectedSaveAsNew()){ | 109 if(isSelectedSaveAsNew()){ |
101 this.entity.removeAllTargetRelations(is_part_of, COLLECTION); | 110 //this.entity.removeAllTargetRelations(is_part_of, COLLECTION); |
102 this.entity = getWrapper().saveEntityAsNew(this.entity, getSessionUser().getEmail()); | 111 //this.entity = getWrapper().saveEntityAsNew(this.entity, getSessionUser().getEmail()); |
103 }else{ | 112 }else{ |
104 this.entity = getWrapper().saveEntity(this.entity, getSessionUser().getEmail(), null); | 113 this.entity = getWrapper().saveEntity(this.entity, getSessionUser().getEmail(), editRepositoryIntent); |
105 } | 114 } |
106 | 115 |
107 this.updateRelatedOW(this.entity, getSessionUser().getEmail()); | 116 this.updateRelatedOW(this.entity, getSessionUser().getEmail()); |
108 getSessionBean().setEditFormCurrentEntId(this.entity.getId()); | 117 getSessionBean().setEditFormCurrentEntId(this.entity.getId()); |
109 | 118 |