Mercurial > hg > ismi-richfaces
annotate src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentDigitalizationBean.java @ 166:caf1aa768457
updated public_manifest_url in DIGITALIZATION form.
author | Robert Casties <casties@mpiwg-berlin.mpg.de> |
---|---|
date | Tue, 29 May 2018 21:16:46 +0200 |
parents | 1326182855ef |
children |
rev | line source |
---|---|
1 | 1 package de.mpiwg.itgroup.ismi.entry.beans; |
2 | |
3 import java.io.Serializable; | |
4 import java.util.List; | |
5 | |
84 | 6 import javax.faces.event.ActionEvent; |
7 | |
1 | 8 import org.apache.log4j.Logger; |
9 import org.mpi.openmind.repository.bo.Entity; | |
10 import org.mpi.openmind.repository.bo.Node; | |
125 | 11 import org.mpi.openmind.repository.services.utils.EditIntent; |
1 | 12 import org.mpi.openmind.security.bo.User; |
13 | |
84 | 14 import de.mpiwg.itgroup.ismi.auxObjects.ListenerObject; |
15 | |
1 | 16 public class CurrentDigitalizationBean extends CodexEditorTemplate implements Serializable{ |
17 | |
18 private static final long serialVersionUID = 4910425502556948216L; | |
19 | |
20 private static Logger logger = Logger.getLogger(CurrentDigitalizationBean.class); | |
21 | |
125 | 22 /** intent to edit all attributes and relations in the form */ |
23 public static EditIntent editDigitalizationIntent = new EditIntent( | |
24 AbstractISMIBean.DIGITALIZATION, | |
25 // attributes | |
166
caf1aa768457
updated public_manifest_url in DIGITALIZATION form.
Robert Casties <casties@mpiwg-berlin.mpg.de>
parents:
151
diff
changeset
|
26 new String[]{"name", "num_files", "public_manifest_url", "public"}, |
125 | 27 // source relations |
28 new String[]{"is_digitalization_of"}, | |
29 // target relations | |
30 new String[]{}); | |
31 | |
1 | 32 |
33 public CurrentDigitalizationBean(){ | |
34 super(); | |
35 this.entity = new Entity(Node.TYPE_ABOX, DIGITALIZATION, false); | |
36 setDefObjectClass(DIGITALIZATION); | |
37 } | |
38 | |
39 @Override | |
40 public void reset(){ | |
41 super.reset(); | |
42 this.entity = new Entity(Node.TYPE_ABOX, DIGITALIZATION, false); | |
43 } | |
44 | |
45 @Override | |
46 public void setEntity(Entity digi){ | |
47 this.reset(); | |
48 this.entity = digi; | |
49 | |
50 if(this.entity.isPersistent()){ | |
51 if (entity.isLightweight()) { | |
52 entity = getWrapper().getEntityContent(digi); | |
53 } | |
54 } | |
55 | |
56 this.loadAttributes(this.entity); | |
57 | |
58 List<Entity> list = getWrapper().getTargetsForSourceRelation(entity, is_digitalization_of, CODEX, -1); | |
59 if(list.size() > 0){ | |
60 this.setCodex(list.get(0)); | |
61 } | |
62 } | |
63 | |
64 | |
65 public void setCodex(Entity codex){ | |
111
22a18bfc66b0
new completion that uses ALIASes: AbstractListenerObject. was_copied_in in WITNESS form can use PLACE aliases now. some cleanup.
casties
parents:
84
diff
changeset
|
66 this.getCodexLo().setEntityAndAttributeName(codex, "identifier"); |
1 | 67 |
68 if(this.getCodexLo().entity != null && this.getCodexLo().entity.isPersistent()){ | |
69 | |
70 List<Entity> list = getWrapper().getTargetsForSourceRelation(codex, is_part_of, COLLECTION, 1); | |
71 if(list.size() > 0){ | |
72 this.setCollection(list.get(0)); | |
73 } | |
74 } | |
75 } | |
76 | |
84 | 77 public void unsetCodex(ActionEvent event){ |
78 this.setCodexLo(new ListenerObject()); | |
79 //this.getCodexLo().setEntityAndAttribute(null, null); | |
80 } | |
81 | |
1 | 82 @Override |
83 public String save() { | |
84 super.save(); | |
85 try { | |
86 User user = getSessionUser(); | |
87 | |
88 this.entity = this.updateEntityAttributes(this.entity); | |
89 | |
90 // DIGITALIZATION -> is_digitalization_of -> CODEX | |
134
25bfcc9d757c
effort to re-use more relations when saving entities.
casties
parents:
125
diff
changeset
|
91 this.entity.replaceUniqueSourceRelation(getCodexLo().entity, CODEX, is_digitalization_of); |
1 | 92 |
134
25bfcc9d757c
effort to re-use more relations when saving entities.
casties
parents:
125
diff
changeset
|
93 // save this entity |
125 | 94 this.entity = getWrapper().saveEntity(this.entity, user.getEmail(), editDigitalizationIntent); |
1 | 95 |
96 this.setEntity(this.entity); | |
97 | |
98 logger.info("Entity saved - Time = " + (System.currentTimeMillis() - start) + ", " + entity); | |
99 | |
100 this.printSuccessSavingEntity(); | |
101 | |
102 } catch (Exception e) { | |
103 logger.error(e.getMessage(), e); | |
104 this.printInternalError(e); | |
105 } | |
106 saveEnd(); | |
107 return PAGE_EDITOR; | |
108 } | |
109 | |
110 | |
111 } |