Mercurial > hg > ismi-richfaces
annotate src/main/java/de/mpiwg/itgroup/ismi/entry/beans/CurrentRoleBean.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 | 2e911857a759 |
children | eee2e0ca4032 |
rev | line source |
---|---|
1 | 1 package de.mpiwg.itgroup.ismi.entry.beans; |
2 | |
3 import org.apache.commons.lang.StringUtils; | |
4 import org.apache.log4j.Logger; | |
5 import org.mpi.openmind.repository.bo.Entity; | |
6 import org.mpi.openmind.repository.bo.Node; | |
7 | |
8 public class CurrentRoleBean extends AbstractISMIBean{ | |
9 | |
10 /** | |
11 * | |
12 */ | |
13 private static final long serialVersionUID = -4934098828218979428L; | |
14 private static Logger logger = Logger.getLogger(CurrentRoleBean.class); | |
15 | |
16 public CurrentRoleBean(){ | |
17 this.entity = new Entity(Node.TYPE_ABOX, ROLE, false); | |
18 this.setDefObjectClass(ROLE); | |
19 } | |
20 | |
21 @Override | |
22 public void reset(){ | |
23 super.reset(); | |
24 this.entity = new Entity(Node.TYPE_ABOX, ROLE, false); | |
25 } | |
26 | |
27 @Override | |
28 public void setEntity(Entity role) { | |
29 this.reset(); | |
30 this.entity = role; | |
31 | |
32 if(this.entity != null && this.entity.isPersistent()){ | |
33 if (this.entity.isLightweight()) { | |
34 this.entity = getWrapper().getEntityContent(role); | |
35 } | |
36 this.loadAttributes(this.entity);//, getDefinition(this.entity)); | |
37 } | |
38 } | |
39 | |
40 @Override | |
41 public String save(){ | |
42 super.save(); | |
43 try { | |
44 | |
45 if(isConsistent()){ | |
46 this.entity = updateEntityAttributes(this.entity); | |
124
28a0c2726466
changed saveEntity() to use new EditIntent. Set up EditIntent for TEXT, PERSON, REFERENCE.
casties
parents:
1
diff
changeset
|
47 this.entity = getWrapper().saveEntity(this.entity, getUserName(), null); |
1 | 48 getAppBean().setRoleListAsDirty(); |
49 | |
50 logger.info("Entity saved - Time = " + (System.currentTimeMillis() - start) + ", " + entity); | |
51 this.printSuccessSavingEntity(); | |
52 } | |
53 | |
54 } catch (Exception e) { | |
55 logger.error(e.getMessage(), e); | |
56 e.printStackTrace(); | |
57 this.printInternalError(e); | |
58 } | |
59 | |
60 saveEnd(); | |
61 return PAGE_EDITOR; | |
62 } | |
63 | |
64 private boolean isConsistent(){ | |
65 | |
66 if(getAttributes().containsKey("name") && | |
67 StringUtils.isNotEmpty(getAttributes().get("name"))){ | |
68 return true; | |
69 | |
70 }else{ | |
71 addErrorMsg("The role has not be saved, because its name can not be empty!"); | |
72 return false; | |
73 } | |
74 | |
75 | |
76 } | |
77 } |