Mercurial > hg > ismi-richfaces
comparison src/main/java/de/mpiwg/itgroup/ismi/browse/EntityDetailsBean.java @ 148:b40a84944716
add public/private editing to Entity Details.
author | Robert Casties <casties@mpiwg-berlin.mpg.de> |
---|---|
date | Tue, 11 Jul 2017 17:44:50 +0200 |
parents | 28a0c2726466 |
children | 3d8b31508128 |
comparison
equal
deleted
inserted
replaced
147:1389c83028ef | 148:b40a84944716 |
---|---|
12 import org.mpi.openmind.repository.bo.Entity; | 12 import org.mpi.openmind.repository.bo.Entity; |
13 import org.mpi.openmind.repository.bo.Node; | 13 import org.mpi.openmind.repository.bo.Node; |
14 import org.mpi.openmind.repository.bo.Relation; | 14 import org.mpi.openmind.repository.bo.Relation; |
15 | 15 |
16 import de.mpiwg.itgroup.ismi.entry.beans.SessionBean; | 16 import de.mpiwg.itgroup.ismi.entry.beans.SessionBean; |
17 import de.mpiwg.itgroup.ismi.entry.utils.PrivacityUtils; | |
17 import de.mpiwg.itgroup.ismi.event.beans.CopyEvent; | 18 import de.mpiwg.itgroup.ismi.event.beans.CopyEvent; |
18 import de.mpiwg.itgroup.ismi.event.beans.StudyEvent; | 19 import de.mpiwg.itgroup.ismi.event.beans.StudyEvent; |
19 import de.mpiwg.itgroup.ismi.event.beans.TransferEvent; | 20 import de.mpiwg.itgroup.ismi.event.beans.TransferEvent; |
20 | 21 |
21 public class EntityDetailsBean extends AbstractBrowse { | 22 public class EntityDetailsBean extends AbstractBrowse { |
219 try { | 220 try { |
220 // getting de.mpiwg.itgroup.ismi.entry.beans.SessionBean | 221 // getting de.mpiwg.itgroup.ismi.entry.beans.SessionBean |
221 getSessionBean().editEntity(this.entity); | 222 getSessionBean().editEntity(this.entity); |
222 | 223 |
223 } catch (Exception e) { | 224 } catch (Exception e) { |
224 e.printStackTrace(); | 225 logger.error(e); |
225 } | 226 } |
227 | |
226 if(entity.getObjectClass().equals(StudyEvent.OC) || | 228 if(entity.getObjectClass().equals(StudyEvent.OC) || |
227 entity.getObjectClass().equals(CopyEvent.OC) || | 229 entity.getObjectClass().equals(CopyEvent.OC) || |
228 entity.getObjectClass().equals(TransferEvent.OC)){ | 230 entity.getObjectClass().equals(TransferEvent.OC)){ |
229 return SessionBean.PAGE_EVENT_FORM; | 231 return SessionBean.PAGE_EVENT_FORM; |
230 }else{ | 232 }else{ |
231 return SessionBean.PAGE_ENTRY; | 233 return SessionBean.PAGE_ENTRY; |
232 } | 234 } |
233 } | 235 } |
234 | 236 |
237 | |
238 /** | |
239 * Toggle this entity's public state. | |
240 * @return | |
241 */ | |
242 public String actionChangeEntityPrivacity() { | |
243 // toggle publication state | |
244 PrivacityUtils.changeEntityPrivacity(this.entity, null, getWrapper()); | |
245 ArrayList<Entity> saveList = new ArrayList<Entity>(); | |
246 saveList.add(entity); | |
247 try { | |
248 getWrapper().saveEntityListAsNodeWithoutContent(saveList, getUserName()); | |
249 } catch (Exception e) { | |
250 printInternalError(e); | |
251 logger.error(e); | |
252 } | |
253 return GOTO_ENTITY_DETAILS; | |
254 } | |
255 | |
256 /** | |
257 * Change all related entities' public state to match this entity. | |
258 * | |
259 * @return | |
260 */ | |
261 public String actionChangeRelatedEntitiesPrivacity() { | |
262 // set publication state | |
263 List<Entity> saveList = PrivacityUtils.setRelatedEntitiesPrivacity(this.entity, null, getWrapper()); | |
264 // hide related entities from display | |
265 sourceRelations = new HashMap<String, List<Relation>>(); | |
266 targetRelations = new HashMap<String, List<Relation>>(); | |
267 // save entities | |
268 try { | |
269 getWrapper().saveEntityListAsNodeWithoutContent(saveList, getUserName()); | |
270 } catch (Exception e) { | |
271 printInternalError(e); | |
272 logger.error(e); | |
273 } | |
274 return GOTO_ENTITY_DETAILS; | |
275 } | |
276 | |
235 /** | 277 /** |
236 * <p> | 278 * <p> |
237 * Show the details page for the current entity. | 279 * Show the details page for the current entity. |
238 * </p> | 280 * </p> |
239 */ | 281 */ |