annotate src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentTextBean.java @ 105:e27603a39e70

small cleanups.
author casties
date Fri, 04 Nov 2016 18:10:40 +0100
parents d172201d24ad
children 9adcab5143a3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
jurzua
parents:
diff changeset
1 package de.mpiwg.itgroup.ismi.entry.beans;
jurzua
parents:
diff changeset
2
jurzua
parents:
diff changeset
3 import java.io.Serializable;
jurzua
parents:
diff changeset
4 import java.util.ArrayList;
jurzua
parents:
diff changeset
5 import java.util.HashMap;
jurzua
parents:
diff changeset
6 import java.util.List;
jurzua
parents:
diff changeset
7 import java.util.Map;
jurzua
parents:
diff changeset
8
jurzua
parents:
diff changeset
9 import javax.faces.event.ActionEvent;
jurzua
parents:
diff changeset
10 import javax.faces.event.AjaxBehaviorEvent;
jurzua
parents:
diff changeset
11 import javax.faces.event.ValueChangeEvent;
jurzua
parents:
diff changeset
12 import javax.faces.model.SelectItem;
jurzua
parents:
diff changeset
13
jurzua
parents:
diff changeset
14 import org.apache.commons.lang.StringUtils;
jurzua
parents:
diff changeset
15 import org.apache.log4j.Logger;
jurzua
parents:
diff changeset
16 import org.mpi.openmind.repository.bo.Attribute;
jurzua
parents:
diff changeset
17 import org.mpi.openmind.repository.bo.Entity;
jurzua
parents:
diff changeset
18 import org.mpi.openmind.repository.bo.Node;
jurzua
parents:
diff changeset
19 import org.mpi.openmind.repository.bo.Relation;
jurzua
parents:
diff changeset
20 import org.mpi.openmind.repository.utils.NormalizerUtils;
jurzua
parents:
diff changeset
21 import org.mpi.openmind.repository.utils.RomanizationLoC;
jurzua
parents:
diff changeset
22 import org.mpi.openmind.repository.utils.TransliterationUtil;
jurzua
parents:
diff changeset
23 import org.mpi.openmind.security.bo.User;
jurzua
parents:
diff changeset
24
jurzua
parents:
diff changeset
25 import de.mpiwg.itgroup.ismi.auxObjects.ListenerObject;
jurzua
parents:
diff changeset
26 import de.mpiwg.itgroup.ismi.util.guiComponents.Calendar;
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
27 import de.mpiwg.itgroup.ismi.util.guiComponents.Misattribution;
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
28 import de.mpiwg.itgroup.ismi.util.guiComponents.MisattributionTable;
1
jurzua
parents:
diff changeset
29 import de.mpiwg.itgroup.ismi.util.guiComponents.EntityList;
jurzua
parents:
diff changeset
30
90
72b877076f43 small cleanup.
casties
parents: 60
diff changeset
31 public class CurrentTextBean extends AbstractISMIBean implements Serializable{
1
jurzua
parents:
diff changeset
32 private static final long serialVersionUID = 1017399812886455381L;
jurzua
parents:
diff changeset
33
jurzua
parents:
diff changeset
34 private static Logger logger = Logger.getLogger(CurrentTextBean.class);
jurzua
parents:
diff changeset
35
jurzua
parents:
diff changeset
36 private String valueShortTitle;
jurzua
parents:
diff changeset
37 private Entity shortTitleAlias; // is now an alias of type "prime"
jurzua
parents:
diff changeset
38 private String romanizedTitle;
jurzua
parents:
diff changeset
39 private String romanizedPrimaAlias;
jurzua
parents:
diff changeset
40
jurzua
parents:
diff changeset
41 private String valueTranslitTitle;
jurzua
parents:
diff changeset
42 private Entity translitTitleAlias; // is now an alias of type "prime"
jurzua
parents:
diff changeset
43
jurzua
parents:
diff changeset
44 private ListenerObject authorLo = new ListenerObject(PERSON, "name_translit");
jurzua
parents:
diff changeset
45 //private String authorInfo;
jurzua
parents:
diff changeset
46
jurzua
parents:
diff changeset
47 private ListenerObject placeLo = new ListenerObject(PLACE, "name");
jurzua
parents:
diff changeset
48
jurzua
parents:
diff changeset
49 private ListenerObject dedicatedPersonLo = new ListenerObject(PERSON, "name_translit");
jurzua
parents:
diff changeset
50
jurzua
parents:
diff changeset
51 private ListenerObject commentaryLo = new ListenerObject(TEXT, "full_title_translit");
jurzua
parents:
diff changeset
52
jurzua
parents:
diff changeset
53 private ListenerObject translationLo = new ListenerObject(TEXT, "full_title_translit");
jurzua
parents:
diff changeset
54
jurzua
parents:
diff changeset
55 private ListenerObject versionLo = new ListenerObject(TEXT, "full_title_translit");
jurzua
parents:
diff changeset
56
jurzua
parents:
diff changeset
57 private static String PERSON_TYPE_CREATED_BY = "created_by";
jurzua
parents:
diff changeset
58 private static String PERSON_TYPE_DEDICATED_TO = "dedicated_to";
jurzua
parents:
diff changeset
59 private String personType;
jurzua
parents:
diff changeset
60
jurzua
parents:
diff changeset
61 private Attribute attTitleAlias = new Attribute();
jurzua
parents:
diff changeset
62 private Map<Long, Boolean> deletedTitleAliases = new HashMap<Long, Boolean>();
jurzua
parents:
diff changeset
63 private String newTitleAlias;
jurzua
parents:
diff changeset
64
jurzua
parents:
diff changeset
65 private Attribute attIncipitAlias = new Attribute();
jurzua
parents:
diff changeset
66 private Map<Long, Boolean> deletedIncipitAliases = new HashMap<Long, Boolean>();
jurzua
parents:
diff changeset
67 private String newIncipitAlias;
jurzua
parents:
diff changeset
68
jurzua
parents:
diff changeset
69 private Attribute attExplicitAlias = new Attribute();
jurzua
parents:
diff changeset
70 private Map<Long, Boolean> deletedExplicitAliases = new HashMap<Long, Boolean>();
jurzua
parents:
diff changeset
71 private String newExplicitAlias;
jurzua
parents:
diff changeset
72
jurzua
parents:
diff changeset
73 private Long idSubject;
jurzua
parents:
diff changeset
74 private Entity subject;
jurzua
parents:
diff changeset
75
jurzua
parents:
diff changeset
76 public static String main_subject = "main_subject";
jurzua
parents:
diff changeset
77 public static String sub_subject = "sub_subject";
jurzua
parents:
diff changeset
78 public static String type = "type";
jurzua
parents:
diff changeset
79 public static String NO_SUBJECT = "NO_SUBJECT";
jurzua
parents:
diff changeset
80
jurzua
parents:
diff changeset
81 private boolean searchTextDialogRendered = false;
jurzua
parents:
diff changeset
82 private String stringTitle;
jurzua
parents:
diff changeset
83 private String stringAuthor;
jurzua
parents:
diff changeset
84 private List<SelectItem> textsFound = new ArrayList<SelectItem>();
jurzua
parents:
diff changeset
85
jurzua
parents:
diff changeset
86 private Long idTextSelected;
jurzua
parents:
diff changeset
87
jurzua
parents:
diff changeset
88 private String COMMENTARY_CALLER = "Commentary";
jurzua
parents:
diff changeset
89 private String TRANSLATION_CALLER = "Translation";
jurzua
parents:
diff changeset
90 private String VERSION_CALLER = "Version";
jurzua
parents:
diff changeset
91
jurzua
parents:
diff changeset
92 private String searchCaller;
jurzua
parents:
diff changeset
93
jurzua
parents:
diff changeset
94 private transient Calendar creationDate;
jurzua
parents:
diff changeset
95
jurzua
parents:
diff changeset
96 private String textAuthorName;
jurzua
parents:
diff changeset
97 private String textAuthorNameTranslit;
jurzua
parents:
diff changeset
98
jurzua
parents:
diff changeset
99 private Boolean selectPersonRendered = false;
jurzua
parents:
diff changeset
100 private List<SelectItem> personList = new ArrayList<SelectItem>();
jurzua
parents:
diff changeset
101 private Long selectedPersonId;
jurzua
parents:
diff changeset
102 private boolean restrictedByRole = false;
jurzua
parents:
diff changeset
103
jurzua
parents:
diff changeset
104 private EntityList aliasList;
jurzua
parents:
diff changeset
105 private EntityList incipitAliasList;
jurzua
parents:
diff changeset
106 private EntityList explicitAliasList;
jurzua
parents:
diff changeset
107
jurzua
parents:
diff changeset
108 //private MisattributionDataTable misattDataTable;
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
109 private transient MisattributionTable misattTable;
1
jurzua
parents:
diff changeset
110
jurzua
parents:
diff changeset
111 public CurrentTextBean() {
jurzua
parents:
diff changeset
112 this.reset();
jurzua
parents:
diff changeset
113 }
jurzua
parents:
diff changeset
114
jurzua
parents:
diff changeset
115 @Override
jurzua
parents:
diff changeset
116 public void reset(){
jurzua
parents:
diff changeset
117 super.reset();
jurzua
parents:
diff changeset
118 this.entity = new Entity(Node.TYPE_ABOX, TEXT, false);
jurzua
parents:
diff changeset
119 setDefObjectClass(TEXT);
jurzua
parents:
diff changeset
120
jurzua
parents:
diff changeset
121 this.aliasList = new EntityList(ALIAS, "alias", getWrapper(), getUserName());
jurzua
parents:
diff changeset
122 this.incipitAliasList = new EntityList(ALIAS, "alias", getWrapper(), getUserName());
jurzua
parents:
diff changeset
123 this.explicitAliasList = new EntityList(ALIAS, "alias", getWrapper(), getUserName());
jurzua
parents:
diff changeset
124 //this.misattDataTable = new MisattributionDataTable(PERSON, "name_translit");
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
125 this.misattTable = new MisattributionTable();
1
jurzua
parents:
diff changeset
126
jurzua
parents:
diff changeset
127 this.selectPersonRendered = false;
jurzua
parents:
diff changeset
128 this.selectedPersonId = null;
jurzua
parents:
diff changeset
129 this.personList = new ArrayList<SelectItem>();
jurzua
parents:
diff changeset
130 this.restrictedByRole = false;
jurzua
parents:
diff changeset
131
jurzua
parents:
diff changeset
132 this.textAuthorName = new String();
jurzua
parents:
diff changeset
133 this.textAuthorNameTranslit = new String();
jurzua
parents:
diff changeset
134
jurzua
parents:
diff changeset
135 this.valueShortTitle = null;
jurzua
parents:
diff changeset
136 this.shortTitleAlias = null; // is now an alias of type "prime"
jurzua
parents:
diff changeset
137
jurzua
parents:
diff changeset
138 this.valueTranslitTitle = null;
jurzua
parents:
diff changeset
139 this.translitTitleAlias = null; // is now an alias of type "prime"
jurzua
parents:
diff changeset
140
jurzua
parents:
diff changeset
141 //this.authorLo = new ListenerObject();
jurzua
parents:
diff changeset
142 this.authorLo.reset();
jurzua
parents:
diff changeset
143 //this.authorInfo = null;
jurzua
parents:
diff changeset
144
jurzua
parents:
diff changeset
145 //this.placeLo = new ListenerObject();
jurzua
parents:
diff changeset
146 this.placeLo.reset();
jurzua
parents:
diff changeset
147
jurzua
parents:
diff changeset
148 this.dedicatedPersonLo.reset();
jurzua
parents:
diff changeset
149
jurzua
parents:
diff changeset
150 this.commentaryLo.reset();
jurzua
parents:
diff changeset
151
jurzua
parents:
diff changeset
152 this.translationLo.reset();
jurzua
parents:
diff changeset
153
jurzua
parents:
diff changeset
154 this.versionLo.reset();
jurzua
parents:
diff changeset
155
jurzua
parents:
diff changeset
156 this.attTitleAlias = new Attribute();
jurzua
parents:
diff changeset
157 this.deletedTitleAliases = new HashMap<Long, Boolean>();
jurzua
parents:
diff changeset
158 this.newTitleAlias = null;
jurzua
parents:
diff changeset
159
jurzua
parents:
diff changeset
160 this.attIncipitAlias = new Attribute();
jurzua
parents:
diff changeset
161 this.deletedIncipitAliases = new HashMap<Long, Boolean>();
jurzua
parents:
diff changeset
162 this.newIncipitAlias = null;
jurzua
parents:
diff changeset
163
jurzua
parents:
diff changeset
164 this.attExplicitAlias = new Attribute();
jurzua
parents:
diff changeset
165 this.deletedExplicitAliases = new HashMap<Long, Boolean>();
jurzua
parents:
diff changeset
166 this.newExplicitAlias = null;
jurzua
parents:
diff changeset
167
jurzua
parents:
diff changeset
168 this.idSubject = null;
jurzua
parents:
diff changeset
169 this.subject = null;
jurzua
parents:
diff changeset
170
jurzua
parents:
diff changeset
171 this.creationDate = new Calendar();
jurzua
parents:
diff changeset
172
jurzua
parents:
diff changeset
173
jurzua
parents:
diff changeset
174 registerChecker(authorLo, "Creator is not valid!");
jurzua
parents:
diff changeset
175 registerChecker(placeLo, "Place is not valid!");
jurzua
parents:
diff changeset
176 registerChecker(dedicatedPersonLo, "Place is not valid!");
jurzua
parents:
diff changeset
177 registerChecker(commentaryLo, "Commentary is not valid!");
jurzua
parents:
diff changeset
178 registerChecker(translationLo, "Translation is not valid!");
jurzua
parents:
diff changeset
179 registerChecker(versionLo, "Version is not valid!");
jurzua
parents:
diff changeset
180
jurzua
parents:
diff changeset
181 //getPopup().setRendered(false);
jurzua
parents:
diff changeset
182 }
jurzua
parents:
diff changeset
183
jurzua
parents:
diff changeset
184 public List<SelectItem> getPersonList() {
jurzua
parents:
diff changeset
185 return personList;
jurzua
parents:
diff changeset
186 }
jurzua
parents:
diff changeset
187
jurzua
parents:
diff changeset
188 public void setPersonList(List<SelectItem> personList) {
jurzua
parents:
diff changeset
189 this.personList = personList;
jurzua
parents:
diff changeset
190 }
jurzua
parents:
diff changeset
191
jurzua
parents:
diff changeset
192 public Boolean getSelectPersonRendered() {
jurzua
parents:
diff changeset
193 return selectPersonRendered;
jurzua
parents:
diff changeset
194 }
jurzua
parents:
diff changeset
195
jurzua
parents:
diff changeset
196 public void setSelectPersonRendered(Boolean selectPersonRendered) {
jurzua
parents:
diff changeset
197 this.selectPersonRendered = selectPersonRendered;
jurzua
parents:
diff changeset
198 }
jurzua
parents:
diff changeset
199
jurzua
parents:
diff changeset
200 /**
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
201 * Set entity and process attributes and relations.
1
jurzua
parents:
diff changeset
202 *
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
203 * Source Relations:
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
204 * TEXT is_commentary_on TEXT,
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
205 * TEXT is_translation_of TEXT,
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
206 * TEXT is_version_of TEXT,
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
207 * TEXT was_created_by PERSON,
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
208 * TEXT was_created_in PLACE,
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
209 * TEXT was_dedicated_to PERSON,
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
210 * TEXT has_subject SUBJECT
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
211 *
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
212 * Target Relations:
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
213 * ALIAS is_alias_title_of TEXT,
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
214 * ALIAS is_alias_incipit_of TEXT
1
jurzua
parents:
diff changeset
215 *
jurzua
parents:
diff changeset
216 * @param text
jurzua
parents:
diff changeset
217 */
jurzua
parents:
diff changeset
218 @Override
jurzua
parents:
diff changeset
219 public void setEntity(Entity text) {
jurzua
parents:
diff changeset
220 this.reset();
jurzua
parents:
diff changeset
221 this.entity = text;
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
222 if (this.entity.isPersistent()) {
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
223 // set id
1
jurzua
parents:
diff changeset
224 setCurrentId(this.entity.getId().toString());
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
225
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
226 // load content
1
jurzua
parents:
diff changeset
227 if (text.isLightweight()) {
jurzua
parents:
diff changeset
228 this.entity = getWrapper().getEntityContent(this.entity);
jurzua
parents:
diff changeset
229 this.entity.setLightweight(false);
jurzua
parents:
diff changeset
230 }
jurzua
parents:
diff changeset
231
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
232 // set creation date
1
jurzua
parents:
diff changeset
233 Attribute attCreationDate = this.entity.getAttributeByName("creation_date");
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
234 if(attCreationDate != null && StringUtils.isNotEmpty(attCreationDate.getOwnValue())) {
1
jurzua
parents:
diff changeset
235 this.creationDate = new Calendar(attCreationDate.getOwnValue());
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
236 } else {
1
jurzua
parents:
diff changeset
237 this.creationDate = new Calendar();
jurzua
parents:
diff changeset
238 }
jurzua
parents:
diff changeset
239
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
240 /*
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
241 * set attributes
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
242 */
1
jurzua
parents:
diff changeset
243 this.loadAttributes(this.entity);//, getDefinition(this.entity));
jurzua
parents:
diff changeset
244
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
245 /*
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
246 * set source relations
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
247 */
1
jurzua
parents:
diff changeset
248 for (Relation rel : text.getSourceRelations()) {
jurzua
parents:
diff changeset
249 Entity target = null;
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
250 String relName = rel.getOwnValue();
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
251 if(relName.equals(has_subject)) {
1
jurzua
parents:
diff changeset
252 this.subject = getTargetRelation(rel);
jurzua
parents:
diff changeset
253 this.idSubject = subject.getId();
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
254
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
255 } else if (relName.equals("is_commentary_on")) {
1
jurzua
parents:
diff changeset
256 target = getTargetRelation(rel);
jurzua
parents:
diff changeset
257 this.commentaryLo.setEntityAndAttribute0(target);
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
258
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
259 } else if (relName.equals("is_translation_of")) {
1
jurzua
parents:
diff changeset
260 target = getTargetRelation(rel);
jurzua
parents:
diff changeset
261 this.translationLo.setEntityAndAttribute0(target);
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
262
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
263 } else if (relName.equals("is_version_of")) {
1
jurzua
parents:
diff changeset
264 target = getTargetRelation(rel);
jurzua
parents:
diff changeset
265 this.versionLo.setEntityAndAttribute0(target);
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
266
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
267 } else if (relName.equals("was_created_by")) {
1
jurzua
parents:
diff changeset
268 target = getTargetRelation(rel);
jurzua
parents:
diff changeset
269 this.authorLo.setEntityAndAttribute0(target);
jurzua
parents:
diff changeset
270
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
271 if (this.authorLo.attribute != null) {
1
jurzua
parents:
diff changeset
272 this.textAuthorNameTranslit = this.authorLo.attribute.getValue();
jurzua
parents:
diff changeset
273 }
jurzua
parents:
diff changeset
274
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
275 } else if (relName.equals("was_dedicated_to")) {
1
jurzua
parents:
diff changeset
276 target = getTargetRelation(rel);
jurzua
parents:
diff changeset
277 this.dedicatedPersonLo.setEntityAndAttribute0(target);
jurzua
parents:
diff changeset
278
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
279 } else if (relName.equals("was_created_in")) {
1
jurzua
parents:
diff changeset
280 target = getTargetRelation(rel);
jurzua
parents:
diff changeset
281 this.placeLo.setEntityAndAttribute0(target);
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
282
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
283 } else if (relName.equals("has_author_misattribution")) {
1
jurzua
parents:
diff changeset
284 target = getTargetRelation(rel);
jurzua
parents:
diff changeset
285 this.misattTable.load(target);
jurzua
parents:
diff changeset
286 }
jurzua
parents:
diff changeset
287 }
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
288
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
289 /*
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
290 * set target relations
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
291 */
1
jurzua
parents:
diff changeset
292 for (Relation rel : text.getTargetRelations()) {
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
293 String relName = rel.getOwnValue();
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
294 if (relName.equals("is_alias_title_of")) {
1
jurzua
parents:
diff changeset
295 Entity alias = getWrapper().getEntityByIdWithContent(rel.getSourceId());
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
296 this.aliasList.add(alias);
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
297
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
298 } else if (relName.equals("is_alias_incipit_of")) {
1
jurzua
parents:
diff changeset
299 Entity alias = getWrapper().getEntityByIdWithContent(rel.getSourceId());
jurzua
parents:
diff changeset
300 this.incipitAliasList.add(alias);
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
301
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
302 } else if (relName.equals("is_alias_explicit_of")) {
1
jurzua
parents:
diff changeset
303 Entity alias = getWrapper().getEntityByIdWithContent(rel.getSourceId());
jurzua
parents:
diff changeset
304 this.explicitAliasList.add(alias);
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
305
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
306 } else if (relName.equals("is_prime_alias_title_of")) {
1
jurzua
parents:
diff changeset
307 Entity alias = getWrapper().getEntityByIdWithContent(rel.getSourceId());
jurzua
parents:
diff changeset
308 this.shortTitleAlias = alias;
jurzua
parents:
diff changeset
309 this.valueShortTitle = alias.getAttributeByName("alias").getValue();
jurzua
parents:
diff changeset
310 }
9
jurzua
parents: 1
diff changeset
311 }
jurzua
parents: 1
diff changeset
312
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
313 /*
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
314 * set references
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
315 */
1
jurzua
parents:
diff changeset
316 this.loadEndNoteRefs();
jurzua
parents:
diff changeset
317 this.displayUrl = generateDisplayUrl(authorLo.entity, text, null, getAppBean().getRoot());
jurzua
parents:
diff changeset
318 }
jurzua
parents:
diff changeset
319 }
jurzua
parents:
diff changeset
320
jurzua
parents:
diff changeset
321 public String translitTitleAction() {
jurzua
parents:
diff changeset
322 String pn = getAttributes().get("full_title");
jurzua
parents:
diff changeset
323
jurzua
parents:
diff changeset
324 String translit = TransliterationUtil.getTransliteration(pn);
jurzua
parents:
diff changeset
325 getAttributes().put("full_title_translit", translit);
jurzua
parents:
diff changeset
326
jurzua
parents:
diff changeset
327 return "translit";
jurzua
parents:
diff changeset
328
jurzua
parents:
diff changeset
329 }
jurzua
parents:
diff changeset
330
jurzua
parents:
diff changeset
331 public void showSearchTextCommentaryDialog(ActionEvent event) {
jurzua
parents:
diff changeset
332 this.setSearchTextDialogRendered(true);
jurzua
parents:
diff changeset
333 this.searchCaller = COMMENTARY_CALLER;
jurzua
parents:
diff changeset
334 }
jurzua
parents:
diff changeset
335
jurzua
parents:
diff changeset
336 public void showSearchTextTranslationDialog(ActionEvent event) {
jurzua
parents:
diff changeset
337 this.setSearchTextDialogRendered(true);
jurzua
parents:
diff changeset
338 this.searchCaller = TRANSLATION_CALLER;
jurzua
parents:
diff changeset
339 }
jurzua
parents:
diff changeset
340
jurzua
parents:
diff changeset
341 public void showSearchTextVersionDialog(ActionEvent event) {
jurzua
parents:
diff changeset
342 this.setSearchTextDialogRendered(true);
jurzua
parents:
diff changeset
343 this.searchCaller = VERSION_CALLER;
jurzua
parents:
diff changeset
344 }
jurzua
parents:
diff changeset
345
jurzua
parents:
diff changeset
346 public void closeSearchTextDialog(ActionEvent event) {
jurzua
parents:
diff changeset
347 this.setSearchTextDialogRendered(false);
jurzua
parents:
diff changeset
348 }
jurzua
parents:
diff changeset
349
jurzua
parents:
diff changeset
350 public void resetSearchText(ActionEvent event) {
jurzua
parents:
diff changeset
351 this.textsFound = new ArrayList<SelectItem>();
jurzua
parents:
diff changeset
352 this.stringAuthor = "";
jurzua
parents:
diff changeset
353 this.stringTitle = "";
jurzua
parents:
diff changeset
354 }
jurzua
parents:
diff changeset
355
jurzua
parents:
diff changeset
356 public void takeVersion(ActionEvent event) {
jurzua
parents:
diff changeset
357 if(this.idTextSelected != null){
jurzua
parents:
diff changeset
358 Entity ent = getWrapper().getEntityById(idTextSelected);
jurzua
parents:
diff changeset
359 if(ent != null){
jurzua
parents:
diff changeset
360 if (VERSION_CALLER.equals(this.searchCaller)) {
jurzua
parents:
diff changeset
361 this.versionLo.setEntityAndAttribute0(ent);
jurzua
parents:
diff changeset
362
jurzua
parents:
diff changeset
363 } else if (COMMENTARY_CALLER.equals(this.searchCaller)) {
jurzua
parents:
diff changeset
364 this.commentaryLo.setEntityAndAttribute0(ent);
jurzua
parents:
diff changeset
365
jurzua
parents:
diff changeset
366 } else if (TRANSLATION_CALLER.equals(this.searchCaller)) {
jurzua
parents:
diff changeset
367 this.translationLo.setEntityAndAttribute0(ent);
jurzua
parents:
diff changeset
368 }
jurzua
parents:
diff changeset
369 this.searchTextDialogRendered = false;
jurzua
parents:
diff changeset
370 }
jurzua
parents:
diff changeset
371 }
jurzua
parents:
diff changeset
372 }
jurzua
parents:
diff changeset
373
jurzua
parents:
diff changeset
374 public String getStringTitle() {
jurzua
parents:
diff changeset
375 return stringTitle;
jurzua
parents:
diff changeset
376 }
jurzua
parents:
diff changeset
377
jurzua
parents:
diff changeset
378 public void setStringTitle(String stringTitle) {
jurzua
parents:
diff changeset
379 this.stringTitle = stringTitle;
jurzua
parents:
diff changeset
380 }
jurzua
parents:
diff changeset
381
jurzua
parents:
diff changeset
382 public String getStringAuthor() {
jurzua
parents:
diff changeset
383 return stringAuthor;
jurzua
parents:
diff changeset
384 }
jurzua
parents:
diff changeset
385
jurzua
parents:
diff changeset
386 public void setStringAuthor(String stringAuthor) {
jurzua
parents:
diff changeset
387 this.stringAuthor = stringAuthor;
jurzua
parents:
diff changeset
388 }
jurzua
parents:
diff changeset
389
jurzua
parents:
diff changeset
390 public void searchText(ActionEvent event) {
jurzua
parents:
diff changeset
391 this.textsFound = new ArrayList<SelectItem>();
jurzua
parents:
diff changeset
392
jurzua
parents:
diff changeset
393 if(StringUtils.isNotEmpty(stringTitle)){
jurzua
parents:
diff changeset
394 if (StringUtils.isNotEmpty(this.stringAuthor)) {
jurzua
parents:
diff changeset
395 String termAuthor = NormalizerUtils.normalize(stringAuthor);
jurzua
parents:
diff changeset
396 for(Entity title : getWrapper().getEntitiesByAtt(TEXT, "full_title_translit", stringTitle, -1, true)){
jurzua
parents:
diff changeset
397 for(Entity author :
jurzua
parents:
diff changeset
398 getWrapper().getTargetsForSourceRelation(title, "was_created_by", PERSON, -1)){
jurzua
parents:
diff changeset
399 String authorOW = (StringUtils.isNotEmpty(author.getNormalizedOwnValue())) ? author.getNormalizedOwnValue() : "";
jurzua
parents:
diff changeset
400 if(authorOW.contains(termAuthor)){
jurzua
parents:
diff changeset
401 this.textsFound.add(
jurzua
parents:
diff changeset
402 new SelectItem(title.getId(), "Title [" + title.getId() + "]: " + title.getOwnValue()
jurzua
parents:
diff changeset
403 + " - Author: " + author.getOwnValue()));
jurzua
parents:
diff changeset
404 }
jurzua
parents:
diff changeset
405 }
jurzua
parents:
diff changeset
406 }
jurzua
parents:
diff changeset
407 }else{
jurzua
parents:
diff changeset
408 for(Entity title : getWrapper().getEntitiesByAtt(TEXT, "full_title_translit", stringTitle, -1, true)){
jurzua
parents:
diff changeset
409 this.textsFound.add(
jurzua
parents:
diff changeset
410 new SelectItem(title.getId(), "Title: " + title.getOwnValue()));
jurzua
parents:
diff changeset
411 }
jurzua
parents:
diff changeset
412 }
jurzua
parents:
diff changeset
413 }else if (StringUtils.isNotEmpty(this.stringAuthor)) {
jurzua
parents:
diff changeset
414 String termAuthor = NormalizerUtils.normalize(stringAuthor);
jurzua
parents:
diff changeset
415 for(Entity author : getCache().getPersonListByRole("Author")){
jurzua
parents:
diff changeset
416 String authorOW = (StringUtils.isNotEmpty(author.getNormalizedOwnValue())) ? author.getNormalizedOwnValue() : "";
jurzua
parents:
diff changeset
417 if(authorOW.contains(termAuthor)){
jurzua
parents:
diff changeset
418 for(Entity title :
jurzua
parents:
diff changeset
419 getWrapper().getSourcesForTargetRelation(author, "was_created_by", TEXT, -1)){
jurzua
parents:
diff changeset
420 this.textsFound.add(
jurzua
parents:
diff changeset
421 new SelectItem(title.getId(), "Author[" + author.getId() + "]: " + author.getOwnValue()
jurzua
parents:
diff changeset
422 + " - Title: " + title.getOwnValue()));
jurzua
parents:
diff changeset
423 }
jurzua
parents:
diff changeset
424 }
jurzua
parents:
diff changeset
425 }
jurzua
parents:
diff changeset
426 }
jurzua
parents:
diff changeset
427 }
jurzua
parents:
diff changeset
428
jurzua
parents:
diff changeset
429 public void restrictedByRoleChange(ValueChangeEvent event) {
jurzua
parents:
diff changeset
430 if (event.getNewValue().equals(event.getOldValue()))
jurzua
parents:
diff changeset
431 return;
jurzua
parents:
diff changeset
432 Boolean val = (Boolean) event.getNewValue();
jurzua
parents:
diff changeset
433 this.setRestrictedByRole(val);
jurzua
parents:
diff changeset
434 this.updatePersonList();
jurzua
parents:
diff changeset
435 }
jurzua
parents:
diff changeset
436
jurzua
parents:
diff changeset
437 public void listenerRomanizeTitleTranslit(AjaxBehaviorEvent event){
jurzua
parents:
diff changeset
438 if(getAttributes().get("full_title_translit") != null)
jurzua
parents:
diff changeset
439 this.romanizedTitle = RomanizationLoC.convert(getAttributes().get("full_title_translit"));
jurzua
parents:
diff changeset
440 }
jurzua
parents:
diff changeset
441
jurzua
parents:
diff changeset
442 public void listenerRomanizePrimaAlias(AjaxBehaviorEvent event){
jurzua
parents:
diff changeset
443 if(valueShortTitle != null){
jurzua
parents:
diff changeset
444 this.romanizedPrimaAlias = RomanizationLoC.convert(valueShortTitle);
jurzua
parents:
diff changeset
445 }
jurzua
parents:
diff changeset
446 }
jurzua
parents:
diff changeset
447
jurzua
parents:
diff changeset
448 public void listenerShowAllAuthors(ActionEvent event) {
jurzua
parents:
diff changeset
449 this.setPersonType(PERSON_TYPE_CREATED_BY);
jurzua
parents:
diff changeset
450 this.updatePersonList();
jurzua
parents:
diff changeset
451 }
jurzua
parents:
diff changeset
452
jurzua
parents:
diff changeset
453 public void listenerShowAllDedicatedToPersons(ActionEvent event) {
jurzua
parents:
diff changeset
454 this.setPersonType(PERSON_TYPE_DEDICATED_TO);
jurzua
parents:
diff changeset
455 this.updatePersonList();
jurzua
parents:
diff changeset
456 }
jurzua
parents:
diff changeset
457
jurzua
parents:
diff changeset
458 private void updatePersonList(){
jurzua
parents:
diff changeset
459 if (!restrictedByRole)
jurzua
parents:
diff changeset
460 this.personList = getCache().getAllPersons();
jurzua
parents:
diff changeset
461 else {
jurzua
parents:
diff changeset
462 this.personList = getCache().getPersonsByRole("Author");
jurzua
parents:
diff changeset
463 }
jurzua
parents:
diff changeset
464 this.selectPersonRendered = true;
jurzua
parents:
diff changeset
465 }
jurzua
parents:
diff changeset
466
jurzua
parents:
diff changeset
467 public void listenerPersonCancel(ActionEvent event) {
jurzua
parents:
diff changeset
468 this.selectPersonRendered = false;
jurzua
parents:
diff changeset
469 }
jurzua
parents:
diff changeset
470
jurzua
parents:
diff changeset
471 public void listenerSelectPerson(ActionEvent event){
jurzua
parents:
diff changeset
472 if(this.selectedPersonId != null){
jurzua
parents:
diff changeset
473 Entity selectedPerson = getWrapper().getEntityById(selectedPersonId);
jurzua
parents:
diff changeset
474 if(selectedPerson != null){
jurzua
parents:
diff changeset
475 if(this.personType.equals(PERSON_TYPE_CREATED_BY)){
jurzua
parents:
diff changeset
476 this.authorLo.setEntityAndAttribute0(selectedPerson);
jurzua
parents:
diff changeset
477 this.authorLo.entityInfo = "ID = " + authorLo.getEntity().getId();
jurzua
parents:
diff changeset
478
jurzua
parents:
diff changeset
479 Attribute attArabicName = getTargetAttribute(selectedPerson, "name");
jurzua
parents:
diff changeset
480 if(attArabicName != null){
jurzua
parents:
diff changeset
481 this.authorLo.entityInfo += ", Arabic Name = " + attArabicName.getOwnValue();
jurzua
parents:
diff changeset
482 this.textAuthorName = attArabicName.getValue();
jurzua
parents:
diff changeset
483 }
jurzua
parents:
diff changeset
484
jurzua
parents:
diff changeset
485 if(this.authorLo.attribute != null){
jurzua
parents:
diff changeset
486 this.textAuthorNameTranslit = this.authorLo.attribute.getValue();
jurzua
parents:
diff changeset
487 }
jurzua
parents:
diff changeset
488 }else if(this.personType.equals(PERSON_TYPE_DEDICATED_TO)){
jurzua
parents:
diff changeset
489 this.dedicatedPersonLo.setEntityAndAttribute0(selectedPerson);
jurzua
parents:
diff changeset
490 }
jurzua
parents:
diff changeset
491 }
jurzua
parents:
diff changeset
492 }
jurzua
parents:
diff changeset
493 this.setSelectPersonRendered(false);
jurzua
parents:
diff changeset
494 }
jurzua
parents:
diff changeset
495
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
496 /**
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
497 * Check mandatory parts.
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
498 *
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
499 * In this case the author has to be set.
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
500 *
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
501 * @return
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
502 */
1
jurzua
parents:
diff changeset
503 public boolean mandatoryEntriesOK(){
jurzua
parents:
diff changeset
504 boolean ok = true;
jurzua
parents:
diff changeset
505 if(this.authorLo.entity == null || !this.authorLo.entity.isPersistent()){
jurzua
parents:
diff changeset
506 addGeneralMsg("<Created by> is a mandatory entry. If you do not know the author of this text, you should select the person <ANONYMOUS>.");
jurzua
parents:
diff changeset
507 ok = false;
jurzua
parents:
diff changeset
508 }
jurzua
parents:
diff changeset
509 return ok;
jurzua
parents:
diff changeset
510 }
jurzua
parents:
diff changeset
511
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
512 /* (non-Javadoc)
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
513 * @see de.mpiwg.itgroup.ismi.entry.beans.AbstractISMIBean#save()
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
514 */
1
jurzua
parents:
diff changeset
515 @Override
jurzua
parents:
diff changeset
516 public String save() {
jurzua
parents:
diff changeset
517 super.save();
jurzua
parents:
diff changeset
518 try {
jurzua
parents:
diff changeset
519
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
520 /*
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
521 * check input
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
522 */
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
523 if (!mandatoryEntriesOK()) {
1
jurzua
parents:
diff changeset
524 addGeneralMsg("The entity could not be saved.");
jurzua
parents:
diff changeset
525 return PAGE_EDITOR;
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
526 }
1
jurzua
parents:
diff changeset
527 CheckResults cr = getCheckResults();
jurzua
parents:
diff changeset
528 if (cr.hasErrors) {
jurzua
parents:
diff changeset
529 getSessionBean().setErrorMessages(cr);
jurzua
parents:
diff changeset
530 getSessionBean().setDisplayError(true);
jurzua
parents:
diff changeset
531 return PAGE_EDITOR;
jurzua
parents:
diff changeset
532 }
jurzua
parents:
diff changeset
533
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
534 User user = getSessionUser();
1
jurzua
parents:
diff changeset
535
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
536 // add creation date
1
jurzua
parents:
diff changeset
537 getAttributes().put("creation_date", this.creationDate.toJSONString());
jurzua
parents:
diff changeset
538
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
539 // update all attributes
1
jurzua
parents:
diff changeset
540 this.entity = updateEntityAttributes(this.entity);
jurzua
parents:
diff changeset
541
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
542 /*
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
543 * set relations
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
544 */
1
jurzua
parents:
diff changeset
545 this.entity.replaceSourceRelation(commentaryLo.entity, TEXT, "is_commentary_on");
jurzua
parents:
diff changeset
546
jurzua
parents:
diff changeset
547 this.entity.replaceSourceRelation(translationLo.entity, TEXT, "is_translation_of");
jurzua
parents:
diff changeset
548
jurzua
parents:
diff changeset
549 this.entity.replaceSourceRelation(versionLo.entity, TEXT, "is_version_of");
jurzua
parents:
diff changeset
550
jurzua
parents:
diff changeset
551 this.entity.replaceSourceRelation(authorLo.entity, PERSON, "was_created_by");
jurzua
parents:
diff changeset
552
jurzua
parents:
diff changeset
553 this.entity.replaceSourceRelation(dedicatedPersonLo.entity, PERSON, "was_dedicated_to");
jurzua
parents:
diff changeset
554
jurzua
parents:
diff changeset
555 this.entity.replaceSourceRelation(placeLo.entity, PLACE, "was_created_in");
jurzua
parents:
diff changeset
556
jurzua
parents:
diff changeset
557 this.entity.removeAllSourceRelations(has_subject, SUBJECT);
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
558 if (getIdSubject() != null) {
1
jurzua
parents:
diff changeset
559 this.subject = getWrapper().getEntityByIdWithContent(getIdSubject());
jurzua
parents:
diff changeset
560 this.entity.replaceSourceRelation(subject, SUBJECT, has_subject);
jurzua
parents:
diff changeset
561 }
jurzua
parents:
diff changeset
562
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
563 /*
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
564 * set short title (is_prime_alias_title_of)
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
565 */
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
566 if (!StringUtils.isEmpty(valueShortTitle)) {
1
jurzua
parents:
diff changeset
567 this.entity.removeAllTargetRelations("is_prime_alias_title_of", ALIAS);
jurzua
parents:
diff changeset
568
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
569 if (this.shortTitleAlias == null) {
1
jurzua
parents:
diff changeset
570 //1)create alias, 2) update value of alias3) save alias, and 4) add to this text.
jurzua
parents:
diff changeset
571 shortTitleAlias = new Entity(Node.TYPE_ABOX, ALIAS, false);
jurzua
parents:
diff changeset
572 shortTitleAlias.addAttribute(new Attribute("alias", "text", this.valueShortTitle));
jurzua
parents:
diff changeset
573 getWrapper().saveEntity(shortTitleAlias, getUserName());
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
574 } else {
1
jurzua
parents:
diff changeset
575 //1) update value, 2) re-save alias
jurzua
parents:
diff changeset
576 this.shortTitleAlias.getAttributeByName("alias").setOwnValue(this.valueShortTitle);
jurzua
parents:
diff changeset
577 this.shortTitleAlias.removeAllSourceRelations("is_prime_alias_title_of", TEXT);
jurzua
parents:
diff changeset
578 getWrapper().saveEntity(shortTitleAlias, getUserName());
jurzua
parents:
diff changeset
579 }
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
580 new Relation(shortTitleAlias, this.entity, "is_prime_alias_title_of");
1
jurzua
parents:
diff changeset
581 }
jurzua
parents:
diff changeset
582
jurzua
parents:
diff changeset
583 /*
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
584 * set alias title (ALIAS -> is_alias_title_of -> TEXT)
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
585 */
1
jurzua
parents:
diff changeset
586 this.entity.removeAllTargetRelationsByName("is_alias_title_of");
jurzua
parents:
diff changeset
587 for(Entity alias : this.aliasList.getEntities()){
jurzua
parents:
diff changeset
588 Entity alias0 = getWrapper().getEntityByIdWithContent(alias.getId());
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
589 new Relation(alias0, this.entity, "is_alias_title_of");
1
jurzua
parents:
diff changeset
590 }
jurzua
parents:
diff changeset
591
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
592 /*
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
593 * set alias incipit
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
594 */
1
jurzua
parents:
diff changeset
595 this.entity.removeAllTargetRelationsByName("is_alias_incipit_of");
jurzua
parents:
diff changeset
596 for(Entity alias : this.incipitAliasList.getEntities()){
jurzua
parents:
diff changeset
597 Entity alias0 = getWrapper().getEntityByIdWithContent(alias.getId());
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
598 new Relation(alias0, this.entity, "is_alias_incipit_of");
1
jurzua
parents:
diff changeset
599 }
jurzua
parents:
diff changeset
600
jurzua
parents:
diff changeset
601 /*
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
602 * save alias explicit
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
603 */
1
jurzua
parents:
diff changeset
604 this.entity.removeAllTargetRelationsByName("is_alias_explicit_of");
jurzua
parents:
diff changeset
605 for(Entity alias : this.explicitAliasList.getEntities()){
jurzua
parents:
diff changeset
606 Entity alias0 = getWrapper().getEntityByIdWithContent(alias.getId());
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
607 new Relation(alias0, this.entity, "is_alias_explicit_of");
1
jurzua
parents:
diff changeset
608 }
jurzua
parents:
diff changeset
609
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
610 // set references
1
jurzua
parents:
diff changeset
611 this.prepareEndNoteRefs2Save();
jurzua
parents:
diff changeset
612
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
613 /*
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
614 * set misattribution
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
615 */
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
616 this.entity.removeAllSourceRelations(Misattribution.HAS_AUTHOR_MISATT, Misattribution.MISATT);
1
jurzua
parents:
diff changeset
617
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
618 /*
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
619 * save entity
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
620 */
1
jurzua
parents:
diff changeset
621 this.entity = getWrapper().saveEntity(this.entity, user.getEmail());
jurzua
parents:
diff changeset
622 this.getAppBean().setAllTextsAsDirty();
jurzua
parents:
diff changeset
623 getAppBean().getSimpleSearchCache().setMapDirty(true);
jurzua
parents:
diff changeset
624
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
625 /*
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
626 * save misattributions
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
627 */
1
jurzua
parents:
diff changeset
628 this.entity = this.misattTable.saveMisattributions(this.entity);
jurzua
parents:
diff changeset
629
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
630 // re-set entity
1
jurzua
parents:
diff changeset
631 this.setEntity(this.entity);
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
632
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
633 // update related own values
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
634 this.updateRelatedOW(this.entity, getSessionUser().getEmail());
1
jurzua
parents:
diff changeset
635
jurzua
parents:
diff changeset
636 logger.info("Entity saved - Time = " + (System.currentTimeMillis() - start) + ", " + entity);
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
637
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
638 // print success
1
jurzua
parents:
diff changeset
639 this.printSuccessSavingEntity();
jurzua
parents:
diff changeset
640
jurzua
parents:
diff changeset
641 } catch (Exception e) {
jurzua
parents:
diff changeset
642 logger.error(e.getMessage(), e);
jurzua
parents:
diff changeset
643 this.printInternalError(e);
jurzua
parents:
diff changeset
644 }
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
645
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
646 // end saving
1
jurzua
parents:
diff changeset
647 saveEnd();
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
648 // stay on edit page
1
jurzua
parents:
diff changeset
649 return PAGE_EDITOR;
jurzua
parents:
diff changeset
650 }
jurzua
parents:
diff changeset
651
jurzua
parents:
diff changeset
652 public EntityList getIncipitAliasList() {
jurzua
parents:
diff changeset
653 return incipitAliasList;
jurzua
parents:
diff changeset
654 }
jurzua
parents:
diff changeset
655
jurzua
parents:
diff changeset
656 public void setIncipitAliasList(EntityList incipitAliasList) {
jurzua
parents:
diff changeset
657 this.incipitAliasList = incipitAliasList;
jurzua
parents:
diff changeset
658 }
jurzua
parents:
diff changeset
659
jurzua
parents:
diff changeset
660 public Attribute getAttTitleAlias() {
jurzua
parents:
diff changeset
661 return attTitleAlias;
jurzua
parents:
diff changeset
662 }
jurzua
parents:
diff changeset
663
jurzua
parents:
diff changeset
664 public void setAttTitleAlias(Attribute attTitleAlias) {
jurzua
parents:
diff changeset
665 this.attTitleAlias = attTitleAlias;
jurzua
parents:
diff changeset
666 }
jurzua
parents:
diff changeset
667
jurzua
parents:
diff changeset
668 public Attribute getAttIncipitAlias() {
jurzua
parents:
diff changeset
669 return attIncipitAlias;
jurzua
parents:
diff changeset
670 }
jurzua
parents:
diff changeset
671
jurzua
parents:
diff changeset
672 public void setAttIncipitAlias(Attribute attIncipitAlias) {
jurzua
parents:
diff changeset
673 this.attIncipitAlias = attIncipitAlias;
jurzua
parents:
diff changeset
674 }
jurzua
parents:
diff changeset
675
jurzua
parents:
diff changeset
676 public Attribute getAttExplicitAlias() {
jurzua
parents:
diff changeset
677 return attExplicitAlias;
jurzua
parents:
diff changeset
678 }
jurzua
parents:
diff changeset
679
jurzua
parents:
diff changeset
680 public void setAttExplicitAlias(Attribute attExplicitAlias) {
jurzua
parents:
diff changeset
681 this.attExplicitAlias = attExplicitAlias;
jurzua
parents:
diff changeset
682 }
jurzua
parents:
diff changeset
683
jurzua
parents:
diff changeset
684 public String getValueShortTitle() {
jurzua
parents:
diff changeset
685 return valueShortTitle;
jurzua
parents:
diff changeset
686 }
jurzua
parents:
diff changeset
687
jurzua
parents:
diff changeset
688 public void setValueShortTitle(String valueShortTitle) {
jurzua
parents:
diff changeset
689 this.valueShortTitle = valueShortTitle;
jurzua
parents:
diff changeset
690 }
jurzua
parents:
diff changeset
691
jurzua
parents:
diff changeset
692 public Entity getShortTitleAlias() {
jurzua
parents:
diff changeset
693 return shortTitleAlias;
jurzua
parents:
diff changeset
694 }
jurzua
parents:
diff changeset
695
jurzua
parents:
diff changeset
696 public void setShortTitleAlias(Entity shortTitleAlias) {
jurzua
parents:
diff changeset
697 this.shortTitleAlias = shortTitleAlias;
jurzua
parents:
diff changeset
698 }
jurzua
parents:
diff changeset
699
jurzua
parents:
diff changeset
700 public String getValueTranslitTitle() {
jurzua
parents:
diff changeset
701 return valueTranslitTitle;
jurzua
parents:
diff changeset
702 }
jurzua
parents:
diff changeset
703
jurzua
parents:
diff changeset
704 public void setValueTranslitTitle(String valueTranslitTitle) {
jurzua
parents:
diff changeset
705 this.valueTranslitTitle = valueTranslitTitle;
jurzua
parents:
diff changeset
706 }
jurzua
parents:
diff changeset
707
jurzua
parents:
diff changeset
708 public Entity getTranslitTitleAlias() {
jurzua
parents:
diff changeset
709 return translitTitleAlias;
jurzua
parents:
diff changeset
710 }
jurzua
parents:
diff changeset
711
jurzua
parents:
diff changeset
712 public void setTranslitTitleAlias(Entity translitTitleAlias) {
jurzua
parents:
diff changeset
713 this.translitTitleAlias = translitTitleAlias;
jurzua
parents:
diff changeset
714 }
jurzua
parents:
diff changeset
715
jurzua
parents:
diff changeset
716 public void setNewTitleAlias(String newAlias) {
jurzua
parents:
diff changeset
717 this.newTitleAlias = newAlias;
jurzua
parents:
diff changeset
718 }
jurzua
parents:
diff changeset
719
jurzua
parents:
diff changeset
720 public String getNewTitleAlias() {
jurzua
parents:
diff changeset
721 return newTitleAlias;
jurzua
parents:
diff changeset
722 }
jurzua
parents:
diff changeset
723
jurzua
parents:
diff changeset
724 public Map<Long, Boolean> getDeletedIncipitAliases() {
jurzua
parents:
diff changeset
725 return deletedIncipitAliases;
jurzua
parents:
diff changeset
726 }
jurzua
parents:
diff changeset
727
jurzua
parents:
diff changeset
728 public void setDeletedIncipitAliases(
jurzua
parents:
diff changeset
729 Map<Long, Boolean> deletedIncipitAliases) {
jurzua
parents:
diff changeset
730 this.deletedIncipitAliases = deletedIncipitAliases;
jurzua
parents:
diff changeset
731 }
jurzua
parents:
diff changeset
732
jurzua
parents:
diff changeset
733 public Map<Long, Boolean> getDeletedExplicitAliases() {
jurzua
parents:
diff changeset
734 return deletedExplicitAliases;
jurzua
parents:
diff changeset
735 }
jurzua
parents:
diff changeset
736
jurzua
parents:
diff changeset
737 public void setDeletedExplicitAliases(
jurzua
parents:
diff changeset
738 Map<Long, Boolean> deletedExplicitAliases) {
jurzua
parents:
diff changeset
739 this.deletedExplicitAliases = deletedExplicitAliases;
jurzua
parents:
diff changeset
740 }
jurzua
parents:
diff changeset
741
jurzua
parents:
diff changeset
742 public String getNewIncipitAlias() {
jurzua
parents:
diff changeset
743 return newIncipitAlias;
jurzua
parents:
diff changeset
744 }
jurzua
parents:
diff changeset
745
jurzua
parents:
diff changeset
746 public void setNewIncipitAlias(String newIncipitAlias) {
jurzua
parents:
diff changeset
747 this.newIncipitAlias = newIncipitAlias;
jurzua
parents:
diff changeset
748 }
jurzua
parents:
diff changeset
749
jurzua
parents:
diff changeset
750 public String getNewExplicitAlias() {
jurzua
parents:
diff changeset
751 return newExplicitAlias;
jurzua
parents:
diff changeset
752 }
jurzua
parents:
diff changeset
753
jurzua
parents:
diff changeset
754 public void setNewExplicitAlias(String newExplicitAlias) {
jurzua
parents:
diff changeset
755 this.newExplicitAlias = newExplicitAlias;
jurzua
parents:
diff changeset
756 }
jurzua
parents:
diff changeset
757
jurzua
parents:
diff changeset
758 public Map<Long, Boolean> getDeletedTitleAliases() {
jurzua
parents:
diff changeset
759 return deletedTitleAliases;
jurzua
parents:
diff changeset
760 }
jurzua
parents:
diff changeset
761
jurzua
parents:
diff changeset
762 public void setDeletedTitleAliases(Map<Long, Boolean> deletedTitleAliases) {
jurzua
parents:
diff changeset
763 this.deletedTitleAliases = deletedTitleAliases;
jurzua
parents:
diff changeset
764 }
jurzua
parents:
diff changeset
765
jurzua
parents:
diff changeset
766 public boolean isSearchTextDialogRendered() {
jurzua
parents:
diff changeset
767 return searchTextDialogRendered;
jurzua
parents:
diff changeset
768 }
jurzua
parents:
diff changeset
769
jurzua
parents:
diff changeset
770 public void setSearchTextDialogRendered(boolean searchTextDialogRendered) {
jurzua
parents:
diff changeset
771 this.searchTextDialogRendered = searchTextDialogRendered;
jurzua
parents:
diff changeset
772 }
jurzua
parents:
diff changeset
773
jurzua
parents:
diff changeset
774 public void setTextsFound(List<SelectItem> textsFound) {
jurzua
parents:
diff changeset
775 this.textsFound = textsFound;
jurzua
parents:
diff changeset
776 }
jurzua
parents:
diff changeset
777
jurzua
parents:
diff changeset
778 public List<SelectItem> getTextsFound() {
jurzua
parents:
diff changeset
779 return textsFound;
jurzua
parents:
diff changeset
780 }
jurzua
parents:
diff changeset
781
jurzua
parents:
diff changeset
782 public Long getIdTextSelected() {
jurzua
parents:
diff changeset
783 return idTextSelected;
jurzua
parents:
diff changeset
784 }
jurzua
parents:
diff changeset
785
jurzua
parents:
diff changeset
786 public void setIdTextSelected(Long idTextSelected) {
jurzua
parents:
diff changeset
787 this.idTextSelected = idTextSelected;
jurzua
parents:
diff changeset
788 }
jurzua
parents:
diff changeset
789
jurzua
parents:
diff changeset
790 public String getSearchCaller() {
jurzua
parents:
diff changeset
791 return searchCaller;
jurzua
parents:
diff changeset
792 }
jurzua
parents:
diff changeset
793
jurzua
parents:
diff changeset
794 public void setSearchCaller(String searchCaller) {
jurzua
parents:
diff changeset
795 this.searchCaller = searchCaller;
jurzua
parents:
diff changeset
796 }
jurzua
parents:
diff changeset
797 public ListenerObject getAuthorLo() {
jurzua
parents:
diff changeset
798 return authorLo;
jurzua
parents:
diff changeset
799 }
jurzua
parents:
diff changeset
800
jurzua
parents:
diff changeset
801 public void setAuthorLo(ListenerObject authorLo) {
jurzua
parents:
diff changeset
802 this.authorLo = authorLo;
jurzua
parents:
diff changeset
803 }
jurzua
parents:
diff changeset
804
jurzua
parents:
diff changeset
805 public ListenerObject getPlaceLo() {
jurzua
parents:
diff changeset
806 return placeLo;
jurzua
parents:
diff changeset
807 }
jurzua
parents:
diff changeset
808
jurzua
parents:
diff changeset
809 public void setPlaceLo(ListenerObject placeLo) {
jurzua
parents:
diff changeset
810 this.placeLo = placeLo;
jurzua
parents:
diff changeset
811 }
jurzua
parents:
diff changeset
812
jurzua
parents:
diff changeset
813 public ListenerObject getDedicatedPersonLo() {
jurzua
parents:
diff changeset
814 return dedicatedPersonLo;
jurzua
parents:
diff changeset
815 }
jurzua
parents:
diff changeset
816
jurzua
parents:
diff changeset
817 public void setDedicatedPersonLo(ListenerObject dedicatedPersonLo) {
jurzua
parents:
diff changeset
818 this.dedicatedPersonLo = dedicatedPersonLo;
jurzua
parents:
diff changeset
819 }
jurzua
parents:
diff changeset
820
jurzua
parents:
diff changeset
821 public ListenerObject getCommentaryLo() {
jurzua
parents:
diff changeset
822 return commentaryLo;
jurzua
parents:
diff changeset
823 }
jurzua
parents:
diff changeset
824
jurzua
parents:
diff changeset
825 public void setCommentaryLo(ListenerObject commentaryLo) {
jurzua
parents:
diff changeset
826 this.commentaryLo = commentaryLo;
jurzua
parents:
diff changeset
827 }
jurzua
parents:
diff changeset
828
jurzua
parents:
diff changeset
829 public ListenerObject getTranslationLo() {
jurzua
parents:
diff changeset
830 return translationLo;
jurzua
parents:
diff changeset
831 }
jurzua
parents:
diff changeset
832
jurzua
parents:
diff changeset
833 public void setTranslationLo(ListenerObject translationLo) {
jurzua
parents:
diff changeset
834 this.translationLo = translationLo;
jurzua
parents:
diff changeset
835 }
jurzua
parents:
diff changeset
836
jurzua
parents:
diff changeset
837 public ListenerObject getVersionLo() {
jurzua
parents:
diff changeset
838 return versionLo;
jurzua
parents:
diff changeset
839 }
jurzua
parents:
diff changeset
840
jurzua
parents:
diff changeset
841 public void setVersionLo(ListenerObject versionLo) {
jurzua
parents:
diff changeset
842 this.versionLo = versionLo;
jurzua
parents:
diff changeset
843 }
jurzua
parents:
diff changeset
844
jurzua
parents:
diff changeset
845 public Long getIdSubject() {
jurzua
parents:
diff changeset
846 return idSubject;
jurzua
parents:
diff changeset
847 }
jurzua
parents:
diff changeset
848
jurzua
parents:
diff changeset
849 public void setIdSubject(Long idSubject) {
jurzua
parents:
diff changeset
850 this.idSubject = idSubject;
jurzua
parents:
diff changeset
851 }
jurzua
parents:
diff changeset
852
jurzua
parents:
diff changeset
853 public Entity getSubject() {
jurzua
parents:
diff changeset
854 return subject;
jurzua
parents:
diff changeset
855 }
jurzua
parents:
diff changeset
856
jurzua
parents:
diff changeset
857 public void setSubject(Entity subject) {
jurzua
parents:
diff changeset
858 this.subject = subject;
jurzua
parents:
diff changeset
859 }
jurzua
parents:
diff changeset
860
jurzua
parents:
diff changeset
861 public String getTextAuthorName() {
jurzua
parents:
diff changeset
862 return textAuthorName;
jurzua
parents:
diff changeset
863 }
jurzua
parents:
diff changeset
864
jurzua
parents:
diff changeset
865 public Calendar getCreationDate() {
jurzua
parents:
diff changeset
866 return creationDate;
jurzua
parents:
diff changeset
867 }
jurzua
parents:
diff changeset
868
jurzua
parents:
diff changeset
869 public void setCreationDate(Calendar creationDate) {
jurzua
parents:
diff changeset
870 this.creationDate = creationDate;
jurzua
parents:
diff changeset
871 }
jurzua
parents:
diff changeset
872
jurzua
parents:
diff changeset
873 public void setTextAuthorName(String textAuthorName) {
jurzua
parents:
diff changeset
874 this.textAuthorName = textAuthorName;
jurzua
parents:
diff changeset
875 }
jurzua
parents:
diff changeset
876
jurzua
parents:
diff changeset
877 public String getTextAuthorNameTranslit() {
jurzua
parents:
diff changeset
878 return textAuthorNameTranslit;
jurzua
parents:
diff changeset
879 }
jurzua
parents:
diff changeset
880
jurzua
parents:
diff changeset
881 public void setTextAuthorNameTranslit(String textAuthorNameTranslit) {
jurzua
parents:
diff changeset
882 this.textAuthorNameTranslit = textAuthorNameTranslit;
jurzua
parents:
diff changeset
883 }
jurzua
parents:
diff changeset
884
jurzua
parents:
diff changeset
885 public boolean isRestrictedByRole() {
jurzua
parents:
diff changeset
886 return restrictedByRole;
jurzua
parents:
diff changeset
887 }
jurzua
parents:
diff changeset
888
jurzua
parents:
diff changeset
889 public void setRestrictedByRole(boolean restrictedByRole) {
jurzua
parents:
diff changeset
890 this.restrictedByRole = restrictedByRole;
jurzua
parents:
diff changeset
891 }
jurzua
parents:
diff changeset
892
jurzua
parents:
diff changeset
893
jurzua
parents:
diff changeset
894 public String getPersonType() {
jurzua
parents:
diff changeset
895 return personType;
jurzua
parents:
diff changeset
896 }
jurzua
parents:
diff changeset
897
jurzua
parents:
diff changeset
898 public void setPersonType(String personType) {
jurzua
parents:
diff changeset
899 this.personType = personType;
jurzua
parents:
diff changeset
900 }
jurzua
parents:
diff changeset
901
jurzua
parents:
diff changeset
902 public EntityList getAliasList() {
jurzua
parents:
diff changeset
903 return aliasList;
jurzua
parents:
diff changeset
904 }
jurzua
parents:
diff changeset
905
jurzua
parents:
diff changeset
906 public void setAliasList(EntityList aliasList) {
jurzua
parents:
diff changeset
907 this.aliasList = aliasList;
jurzua
parents:
diff changeset
908 }
jurzua
parents:
diff changeset
909
jurzua
parents:
diff changeset
910 public EntityList getExplicitAliasList() {
jurzua
parents:
diff changeset
911 return explicitAliasList;
jurzua
parents:
diff changeset
912 }
jurzua
parents:
diff changeset
913
jurzua
parents:
diff changeset
914 public void setExplicitAliasList(EntityList explicitAliasList) {
jurzua
parents:
diff changeset
915 this.explicitAliasList = explicitAliasList;
jurzua
parents:
diff changeset
916 }
jurzua
parents:
diff changeset
917
jurzua
parents:
diff changeset
918 public Long getSelectedPersonId() {
jurzua
parents:
diff changeset
919 return selectedPersonId;
jurzua
parents:
diff changeset
920 }
jurzua
parents:
diff changeset
921
jurzua
parents:
diff changeset
922 public void setSelectedPersonId(Long selectedPersonId) {
jurzua
parents:
diff changeset
923 this.selectedPersonId = selectedPersonId;
jurzua
parents:
diff changeset
924 }
jurzua
parents:
diff changeset
925
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
926 public MisattributionTable getMisattTable() {
1
jurzua
parents:
diff changeset
927 return misattTable;
jurzua
parents:
diff changeset
928 }
jurzua
parents:
diff changeset
929
91
d172201d24ad more comments and refactorings.
casties
parents: 90
diff changeset
930 public void setMisattTable(MisattributionTable misattTable) {
1
jurzua
parents:
diff changeset
931 this.misattTable = misattTable;
jurzua
parents:
diff changeset
932 }
jurzua
parents:
diff changeset
933
jurzua
parents:
diff changeset
934 public String getRomanizedTitle() {
jurzua
parents:
diff changeset
935 return romanizedTitle;
jurzua
parents:
diff changeset
936 }
jurzua
parents:
diff changeset
937
jurzua
parents:
diff changeset
938 public void setRomanizedTitle(String romanizedTitle) {
jurzua
parents:
diff changeset
939 this.romanizedTitle = romanizedTitle;
jurzua
parents:
diff changeset
940 }
jurzua
parents:
diff changeset
941
jurzua
parents:
diff changeset
942 public String getRomanizedPrimaAlias() {
jurzua
parents:
diff changeset
943 return romanizedPrimaAlias;
jurzua
parents:
diff changeset
944 }
jurzua
parents:
diff changeset
945
jurzua
parents:
diff changeset
946 public void setRomanizedPrimaAlias(String romanizedPrimaAlias) {
jurzua
parents:
diff changeset
947 this.romanizedPrimaAlias = romanizedPrimaAlias;
jurzua
parents:
diff changeset
948 }
jurzua
parents:
diff changeset
949 }