Rev 1310 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
853 | jmachado | 1 | package pt.estgp.estgweb.web.controllers.processes; |
2 | |||
3 | import jomm.dao.utils.HibernateUtils; |
||
4 | import jomm.utils.FilesUtils; |
||
5 | import jomm.utils.MessageResources; |
||
6 | import org.apache.log4j.Logger; |
||
7 | import org.apache.struts.action.ActionForm; |
||
8 | import org.apache.struts.action.ActionForward; |
||
9 | import org.apache.struts.action.ActionMapping; |
||
10 | import org.apache.struts.upload.FormFile; |
||
11 | import pt.estgp.estgweb.domain.*; |
||
12 | import pt.estgp.estgweb.domain.Process; |
||
13 | import pt.estgp.estgweb.domain.dao.DaoFactory; |
||
14 | import pt.estgp.estgweb.filters.chains.ResourceAccessControlEnum; |
||
15 | import pt.estgp.estgweb.services.data.RepositoryService; |
||
16 | import pt.estgp.estgweb.web.UserSessionProxy; |
||
17 | import pt.estgp.estgweb.web.controllers.ApplicationDispatchController; |
||
18 | import pt.estgp.estgweb.web.form.processes.ProcessEventForm; |
||
19 | |||
20 | import javax.servlet.ServletException; |
||
21 | import javax.servlet.http.HttpServletRequest; |
||
22 | import javax.servlet.http.HttpServletResponse; |
||
23 | import java.io.IOException; |
||
24 | import java.util.Date; |
||
25 | import java.util.HashSet; |
||
26 | import java.util.Set; |
||
27 | |||
28 | /** |
||
29 | * @author Jorge Machado |
||
30 | * @date 26/Fev/2008 |
||
31 | * @time 18:01:54 |
||
32 | * @see pt.estgp.estgweb.web |
||
33 | */ |
||
34 | public class ProcessEventController extends ApplicationDispatchController |
||
35 | { |
||
36 | |||
37 | private static final 1.5.0/docs/api/java/util/logging/Logger.html">Logger logger = 1.5.0/docs/api/java/util/logging/Logger.html">Logger.getLogger(ProcessEventController.class); |
||
38 | |||
39 | public ActionForward updateProcessEvent(ActionMapping mapping, |
||
40 | ActionForm form, |
||
41 | HttpServletRequest request, |
||
42 | HttpServletResponse response) |
||
43 | throws 1.5.0/docs/api/java/lang/Throwable.html">Throwable, ServletException |
||
44 | { |
||
45 | try |
||
46 | { |
||
47 | |||
48 | ProcessEventForm f = (ProcessEventForm)form; |
||
49 | 1.5.0/docs/api/java/lang/System.html">System.out.println("Actualizando"); |
||
50 | HibernateUtils.getCurrentSession().beginTransaction(); |
||
51 | ProcessEvent p = DaoFactory.getProcessEventDaoImpl().load(f.getProcessEvent().getId()); |
||
52 | p.setNotes(f.getProcessEvent().getNotes()); |
||
53 | p.setNotesAccessLevel(f.getProcessEvent().getNotesAccessLevel()); |
||
54 | p.setNotesToStarter(f.getProcessEvent().getNotesToStarter()); |
||
55 | 5+0%2Fdocs%2Fapi+Date">Date now = new 5+0%2Fdocs%2Fapi+Date">Date(); |
||
56 | p.setLastChangeDate(now); |
||
57 | |||
58 | importPossibleFile(request, f, p, now); |
||
59 | |||
60 | HibernateUtils.getCurrentSession().getTransaction().commit(); |
||
61 | request.setAttribute("processId",f.getProcessEvent().getProcess().getId()); |
||
62 | return mapping.getInputForward(); |
||
63 | } |
||
64 | catch (1.5.0/docs/api/java/lang/Throwable.html">Throwable e) |
||
65 | { |
||
66 | logger.error(e, e); |
||
67 | return mapping.findForward("error501"); |
||
68 | } |
||
69 | } |
||
70 | |||
71 | public ActionForward transitProcessEventRole(ActionMapping mapping, |
||
72 | ActionForm form, |
||
73 | HttpServletRequest request, |
||
74 | HttpServletResponse response) |
||
75 | throws 1.5.0/docs/api/java/lang/Throwable.html">Throwable, ServletException |
||
76 | { |
||
77 | try |
||
78 | { |
||
79 | |||
80 | ProcessEventForm f = (ProcessEventForm)form; |
||
81 | 1.5.0/docs/api/java/lang/System.html">System.out.println("Actualizando com destino a um role"); |
||
82 | HibernateUtils.getCurrentSession().beginTransaction(); |
||
83 | ProcessEvent p = DaoFactory.getProcessEventDaoImpl().load(f.getProcessEvent().getId()); |
||
84 | |||
85 | //updata data |
||
86 | p.setNotes(f.getProcessEvent().getNotes()); |
||
87 | p.setNotesAccessLevel(f.getProcessEvent().getNotesAccessLevel()); |
||
88 | p.setNotesToStarter(f.getProcessEvent().getNotesToStarter()); |
||
89 | |||
90 | |||
91 | 5+0%2Fdocs%2Fapi+Date">Date now = new 5+0%2Fdocs%2Fapi+Date">Date(); |
||
92 | ProcessEventImpl eventDest = DomainObjectFactory.createProcessEventImpl(); |
||
93 | eventDest.setOwner(null); |
||
94 | eventDest.setOpenDate(now); |
||
95 | eventDest.setNowStateEnum(ProcessEventImpl.ProcessEventState.NOT_ACCEPTED); |
||
96 | eventDest.setSaveDate(now); |
||
97 | eventDest.setLastChangeDate(now); |
||
98 | eventDest.setCloseDate(null); |
||
99 | eventDest.setAccepted(false); |
||
100 | eventDest.setAcceptedDate(null); |
||
101 | eventDest.setDispatchedDate(null); |
||
102 | eventDest.setNotes(""); |
||
103 | eventDest.setDestinationRole(f.getDestinationRole());//OK |
||
104 | eventDest.setPreviousEvent(p); |
||
105 | eventDest.setNextEvent(null); |
||
106 | eventDest.setProcess(p.getProcess()); |
||
107 | |||
108 | p.setNextEvent(eventDest); |
||
109 | |||
110 | p.setNowState(ProcessEventImpl.ProcessEventState.FINNISH_TRANSITATED.name()); |
||
111 | p.setLastChangeDate(now); |
||
112 | p.setCloseDate(now); |
||
113 | p.setDispatchedDate(now); |
||
114 | |||
115 | DaoFactory.getProcessEventDaoImpl().save(eventDest); |
||
116 | p.getProcess().setLastChangeDate(now); |
||
117 | p.getProcess().setLastEvent(eventDest); |
||
118 | p.getProcess().getEvents().add(eventDest); |
||
119 | p.getProcess().setNowState(ProcessImpl.ProcessState.TRANSITION.name()); |
||
120 | |||
121 | |||
122 | //importPossibleFile(request, f, p, now); |
||
123 | |||
124 | |||
125 | HibernateUtils.getCurrentSession().getTransaction().commit(); |
||
126 | request.setAttribute("processId",f.getProcessEvent().getProcess().getId()); |
||
127 | return mapping.getInputForward(); |
||
128 | } |
||
129 | catch (1.5.0/docs/api/java/lang/Throwable.html">Throwable e) |
||
130 | { |
||
131 | logger.error(e, e); |
||
132 | return mapping.findForward("error501"); |
||
133 | } |
||
134 | } |
||
135 | |||
136 | private void importPossibleFile(HttpServletRequest request, ProcessEventForm f, ProcessEvent p, 5+0%2Fdocs%2Fapi+Date">Date now) throws 1.5.0/docs/api/java/io/IOException.html">IOException { |
||
137 | if(f.getFile() != null && f.getFile().getFileSize() > 0) |
||
138 | { |
||
139 | UserSession sess = UserSessionProxy.loadUserSessionFromRequest(request); |
||
140 | FormFile file = f.getFile(); |
||
141 | logger.info("Adding file " + f.getFile().getFileName() + " to process " + p.getProcess().getId() + " in event " + p.getId()); |
||
142 | RepositoryService repositoryService = new RepositoryService(); |
||
143 | |||
144 | 1.5.0/docs/api/java/lang/String.html">String repositoryId; |
||
145 | try { |
||
146 | repositoryId = repositoryService.storeRepositoryFile(file.getInputStream(),file.getContentType(), FilesUtils.getExtension(file.getFileName()), |
||
1703 | jmachado | 147 | file.getFileSize(),file.getFileName(),"Process Event file " + p.getProcess().getMetaProcess().getName(), ResourceAccessControlEnum.processDomain, null, sess); |
853 | jmachado | 148 | |
149 | ProcessEventFileImpl ef = DomainObjectFactory.createProcessEventFileImpl(); |
||
150 | Set<ProcessEventFile> proceSet = null; |
||
151 | if(p.getFiles() != null){ |
||
152 | proceSet = p.getFiles(); |
||
153 | } |
||
154 | else{ |
||
155 | proceSet = new HashSet<ProcessEventFile>(); |
||
156 | p.setFiles(proceSet); |
||
157 | } |
||
158 | proceSet.add(ef); |
||
159 | ef.setImportDate(now); |
||
160 | ef.setOwner(sess.getUser()); |
||
161 | ef.setProcessEvent(p); |
||
162 | ef.setRepositoryStream(repositoryId); |
||
163 | ef.setFileAccessLevel(f.getFileAccess()); |
||
164 | ef.setGhost(false); |
||
165 | ef.setSaveDate(now); |
||
166 | ef.setName(file.getFileName()); |
||
167 | DaoFactory.getProcessEventFileDaoImpl().save(ef); |
||
168 | } catch (1.5.0/docs/api/java/io/IOException.html">IOException e) { |
||
169 | logger.error(e,e); |
||
170 | throw e; |
||
171 | } |
||
172 | } |
||
173 | } |
||
174 | |||
175 | public ActionForward transitProcessEventPerson(ActionMapping mapping, |
||
176 | ActionForm form, |
||
177 | HttpServletRequest request, |
||
178 | HttpServletResponse response) |
||
179 | throws 1.5.0/docs/api/java/lang/Throwable.html">Throwable, ServletException |
||
180 | { |
||
181 | try |
||
182 | { |
||
183 | |||
184 | ProcessEventForm f = (ProcessEventForm)form; |
||
185 | HibernateUtils.getCurrentSession().beginTransaction(); |
||
186 | ProcessEvent p = DaoFactory.getProcessEventDaoImpl().load(f.getProcessEvent().getId()); |
||
187 | |||
188 | //updata data |
||
189 | p.setNotes(f.getProcessEvent().getNotes()); |
||
190 | p.setNotesAccessLevel(f.getProcessEvent().getNotesAccessLevel()); |
||
191 | p.setNotesToStarter(f.getProcessEvent().getNotesToStarter()); |
||
192 | |||
193 | |||
194 | 5+0%2Fdocs%2Fapi+Date">Date now = new 5+0%2Fdocs%2Fapi+Date">Date(); |
||
195 | ProcessEventImpl eventDest = DomainObjectFactory.createProcessEventImpl(); |
||
196 | eventDest.setOwner(null); |
||
197 | eventDest.setOpenDate(now); |
||
198 | eventDest.setNowStateEnum(ProcessEventImpl.ProcessEventState.NOT_ACCEPTED); |
||
199 | eventDest.setSaveDate(now); |
||
200 | eventDest.setLastChangeDate(now); |
||
201 | eventDest.setCloseDate(null); |
||
202 | eventDest.setAccepted(false); |
||
203 | eventDest.setAcceptedDate(null); |
||
204 | eventDest.setDispatchedDate(null); |
||
205 | eventDest.setNotes(""); |
||
206 | eventDest.setDestinationRole(null);//OK |
||
207 | |||
208 | //UNICA COISA DIFERENTE DO ROLE DESTINATED |
||
209 | User u = DaoFactory.getUserDaoImpl().loadByUsername(f.getDestinationPerson()); |
||
210 | eventDest.setOwner(u); |
||
211 | //UNICA COISA DIFERENTE |
||
212 | |||
213 | eventDest.setPreviousEvent(p); |
||
214 | eventDest.setNextEvent(null); |
||
215 | eventDest.setProcess(p.getProcess()); |
||
216 | |||
217 | p.setNextEvent(eventDest); |
||
218 | |||
219 | p.setNowState(ProcessEventImpl.ProcessEventState.FINNISH_TRANSITATED.name()); |
||
220 | p.setLastChangeDate(now); |
||
221 | p.setCloseDate(now); |
||
222 | p.setDispatchedDate(now); |
||
223 | |||
224 | DaoFactory.getProcessEventDaoImpl().save(eventDest); |
||
225 | p.getProcess().setLastChangeDate(now); |
||
226 | p.getProcess().setLastEvent(eventDest); |
||
227 | p.getProcess().getEvents().add(eventDest); |
||
228 | p.getProcess().setNowState(ProcessImpl.ProcessState.TRANSITION.name()); |
||
229 | |||
230 | //importPossibleFile(request, f, p, now); |
||
231 | |||
232 | HibernateUtils.getCurrentSession().getTransaction().commit(); |
||
233 | request.setAttribute("processId",f.getProcessEvent().getProcess().getId()); |
||
234 | return mapping.getInputForward(); |
||
235 | } |
||
236 | catch (1.5.0/docs/api/java/lang/Throwable.html">Throwable e) |
||
237 | { |
||
238 | logger.error(e, e); |
||
239 | return mapping.findForward("error501"); |
||
240 | } |
||
241 | } |
||
242 | |||
901 | jmachado | 243 | public ActionForward deleteLastProcessEvent(ActionMapping mapping, |
244 | ActionForm form, |
||
245 | HttpServletRequest request, |
||
246 | HttpServletResponse response) |
||
247 | throws 1.5.0/docs/api/java/lang/Throwable.html">Throwable, ServletException |
||
248 | { |
||
249 | try |
||
250 | { |
||
853 | jmachado | 251 | |
901 | jmachado | 252 | ProcessEventForm f = (ProcessEventForm)form; |
253 | HibernateUtils.getCurrentSession().beginTransaction(); |
||
254 | 1.5.0/docs/api/java/lang/Process.html">Process process = DaoFactory.getProcessDaoImpl().load(1.5.0/docs/api/java/lang/Long.html">Long.parseLong(request.getParameter("id"))); |
||
853 | jmachado | 255 | |
901 | jmachado | 256 | User nowUser = UserSessionProxy.loadUserSessionFromRequest(request).getUser(); |
257 | |||
258 | ProcessEvent pLastEvent = process.getLastEvent(); |
||
259 | //only Last Event |
||
260 | if(!((ProcessImpl)pLastEvent.getProcess()).canRemoveLastEvent(nowUser)) |
||
261 | return mapping.findForward("error401"); |
||
262 | |||
263 | 5+0%2Fdocs%2Fapi+Date">Date now = new 5+0%2Fdocs%2Fapi+Date">Date(); |
||
264 | |||
265 | logger.warn("Deleting event: " + pLastEvent.toString()); |
||
266 | |||
267 | pLastEvent.getProcess().setLastEvent(pLastEvent.getPreviousEvent()); |
||
268 | pLastEvent.getPreviousEvent().setNextEvent(null); |
||
269 | pLastEvent.getProcess().getEvents().remove(pLastEvent); |
||
270 | pLastEvent.setProcess(null); |
||
271 | pLastEvent.getProcess().setLastChangeDate(now); |
||
272 | pLastEvent.getProcess().setNowState(ProcessImpl.ProcessState.TRANSITION.name()); |
||
273 | pLastEvent.setNowState(ProcessEventImpl.ProcessEventState.ACCEPTED.name()); |
||
274 | pLastEvent.setCloseDate(null); |
||
275 | pLastEvent.setDispatchedDate(null); |
||
276 | DaoFactory.getProcessEventDaoImpl().delete(pLastEvent); |
||
277 | |||
278 | logger.warn("DELETED event: " + pLastEvent.toString()); |
||
279 | //importPossibleFile(request, f, p, now); |
||
280 | |||
281 | HibernateUtils.getCurrentSession().getTransaction().commit(); |
||
282 | request.setAttribute("processId",f.getProcessEvent().getProcess().getId()); |
||
283 | return mapping.getInputForward(); |
||
284 | } |
||
285 | catch (1.5.0/docs/api/java/lang/Throwable.html">Throwable e) |
||
286 | { |
||
287 | logger.error(e, e); |
||
288 | return mapping.findForward("error501"); |
||
289 | } |
||
290 | } |
||
291 | |||
292 | |||
293 | |||
853 | jmachado | 294 | public ActionForward reopenProcessEventPerson(ActionMapping mapping, |
295 | ActionForm form, |
||
296 | HttpServletRequest request, |
||
297 | HttpServletResponse response) |
||
298 | throws 1.5.0/docs/api/java/lang/Throwable.html">Throwable, ServletException |
||
299 | { |
||
300 | try |
||
301 | { |
||
302 | |||
303 | ProcessEventForm f = (ProcessEventForm)form; |
||
304 | HibernateUtils.getCurrentSession().beginTransaction(); |
||
305 | |||
306 | User user = UserSessionProxy.loadUserSessionFromRequest(request).getUser(); |
||
307 | long processId = 1.5.0/docs/api/java/lang/Long.html">Long.parseLong(request.getParameter("id")); |
||
308 | ProcessImpl process = (ProcessImpl) DaoFactory.getProcessDaoImpl().load(processId); |
||
309 | if(!process.canReopen(user)) |
||
310 | { |
||
311 | addError(request,"process.cant.reopen"); |
||
312 | return mapping.getInputForward(); |
||
313 | } |
||
314 | process.setCloseDate(null); |
||
315 | |||
316 | //updata data |
||
317 | |||
318 | |||
319 | 5+0%2Fdocs%2Fapi+Date">Date now = new 5+0%2Fdocs%2Fapi+Date">Date(); |
||
320 | ProcessEventImpl eventDest = DomainObjectFactory.createProcessEventImpl(); |
||
321 | eventDest.setOwner(null); |
||
322 | eventDest.setOpenDate(now); |
||
323 | eventDest.setNowStateEnum(ProcessEventImpl.ProcessEventState.ACCEPTED); |
||
324 | eventDest.setSaveDate(now); |
||
325 | eventDest.setLastChangeDate(now); |
||
326 | eventDest.setCloseDate(null); |
||
327 | eventDest.setAccepted(true); |
||
328 | eventDest.setAcceptedDate(now); |
||
329 | eventDest.setDispatchedDate(null); |
||
330 | eventDest.setNotes(""); |
||
331 | eventDest.setDestinationRole(null);//OK |
||
332 | |||
333 | //UNICA COISA DIFERENTE DO ROLE DESTINATED |
||
334 | |||
335 | eventDest.setOwner(user); |
||
336 | //UNICA COISA DIFERENTE |
||
337 | |||
338 | eventDest.setPreviousEvent(process.getLastEvent()); |
||
339 | |||
340 | eventDest.setNextEvent(null); |
||
341 | eventDest.setProcess(process); |
||
342 | |||
343 | process.getLastEvent().setNextEvent(eventDest); |
||
344 | |||
345 | //lets keep it closed |
||
346 | //process.getLastEvent().setNowState(ProcessEventImpl.ProcessEventState.FINNISH_TRANSITATED.name()); |
||
347 | |||
348 | DaoFactory.getProcessEventDaoImpl().save(eventDest); |
||
349 | process.setLastChangeDate(now); |
||
350 | process.setLastEvent(eventDest); |
||
351 | process.getEvents().add(eventDest); |
||
352 | process.setNowState(ProcessImpl.ProcessState.TRANSITION.name()); |
||
353 | |||
354 | f.setProcessEvent(eventDest); |
||
355 | |||
356 | |||
357 | HibernateUtils.getCurrentSession().getTransaction().commit(); |
||
358 | request.setAttribute("processId",processId); |
||
359 | return mapping.getInputForward(); |
||
360 | } |
||
361 | catch (1.5.0/docs/api/java/lang/Throwable.html">Throwable e) |
||
362 | { |
||
363 | logger.error(e, e); |
||
364 | return mapping.findForward("error501"); |
||
365 | } |
||
366 | } |
||
367 | |||
368 | public ActionForward finnishProcessEvent(ActionMapping mapping, |
||
369 | ActionForm form, |
||
370 | HttpServletRequest request, |
||
371 | HttpServletResponse response) |
||
372 | throws 1.5.0/docs/api/java/lang/Throwable.html">Throwable, ServletException |
||
373 | { |
||
374 | try |
||
375 | { |
||
376 | |||
377 | ProcessEventForm f = (ProcessEventForm)form; |
||
378 | HibernateUtils.getCurrentSession().beginTransaction(); |
||
379 | ProcessEvent p = DaoFactory.getProcessEventDaoImpl().load(f.getProcessEvent().getId()); |
||
380 | |||
381 | //updata data |
||
382 | p.setNotes(f.getProcessEvent().getNotes()); |
||
383 | p.setNotesAccessLevel(f.getProcessEvent().getNotesAccessLevel()); |
||
384 | p.setNotesToStarter(f.getProcessEvent().getNotesToStarter()); |
||
385 | |||
386 | 5+0%2Fdocs%2Fapi+Date">Date now = new 5+0%2Fdocs%2Fapi+Date">Date(); |
||
387 | p.setNowState(ProcessEventImpl.ProcessEventState.FINNISH_CLOSED.name()); |
||
388 | p.setLastChangeDate(now); |
||
389 | p.setCloseDate(now); |
||
390 | p.setDispatchedDate(now); |
||
391 | |||
392 | p.getProcess().setLastChangeDate(now); |
||
393 | p.getProcess().setCloseDate(now); |
||
394 | p.getProcess().setNowState(ProcessImpl.ProcessState.CLOSED.name()); |
||
395 | |||
396 | |||
397 | HibernateUtils.getCurrentSession().getTransaction().commit(); |
||
398 | request.setAttribute("processId",f.getProcessEvent().getProcess().getId()); |
||
399 | return mapping.getInputForward(); |
||
400 | } |
||
401 | catch (1.5.0/docs/api/java/lang/Throwable.html">Throwable e) |
||
402 | { |
||
403 | logger.error(e, e); |
||
404 | return mapping.findForward("error501"); |
||
405 | } |
||
406 | } |
||
407 | |||
408 | |||
409 | public ActionForward setGhostFileFromProcessEvent(ActionMapping mapping, |
||
410 | ActionForm form, |
||
411 | HttpServletRequest request, |
||
412 | HttpServletResponse response) |
||
413 | throws 1.5.0/docs/api/java/lang/Throwable.html">Throwable, ServletException |
||
414 | { |
||
415 | try |
||
416 | { |
||
417 | |||
418 | long fileId = 1.5.0/docs/api/java/lang/Long.html">Long.parseLong(request.getParameter("fileId")); |
||
419 | |||
420 | User user = UserSessionProxy.loadUserSessionFromRequest(request).getUser(); |
||
421 | |||
422 | HibernateUtils.getCurrentSession().beginTransaction(); |
||
423 | ProcessEventFileImpl ef = (ProcessEventFileImpl) DaoFactory.getProcessEventFileDaoImpl().load(fileId); |
||
424 | |||
425 | if(!ef.isGhost()) |
||
426 | { |
||
427 | if(ef.canOpenCloseGhost(user)) |
||
428 | { |
||
429 | ef.setGhost(true); |
||
430 | ef.setOldFileAccessLevel(ef.getFileAccessLevel()); |
||
431 | ef.setFileAccessLevelEnum(ProcessEventFileImpl.AccessLevel.OWNER); |
||
432 | addMessage(request, "processes.file.set.ghost"); |
||
433 | } |
||
434 | } |
||
435 | |||
436 | HibernateUtils.getCurrentSession().getTransaction().commit(); |
||
437 | request.setAttribute("processId", ef.getProcessEvent().getProcess().getId()); |
||
438 | return mapping.getInputForward(); |
||
439 | } |
||
440 | catch (1.5.0/docs/api/java/lang/Throwable.html">Throwable e) |
||
441 | { |
||
442 | logger.error(e, e); |
||
443 | return mapping.findForward("error501"); |
||
444 | } |
||
445 | } |
||
446 | |||
447 | public ActionForward unsetGhostFileFromProcessEvent(ActionMapping mapping, |
||
448 | ActionForm form, |
||
449 | HttpServletRequest request, |
||
450 | HttpServletResponse response) |
||
451 | throws 1.5.0/docs/api/java/lang/Throwable.html">Throwable, ServletException |
||
452 | { |
||
453 | try |
||
454 | { |
||
455 | |||
456 | long fileId = 1.5.0/docs/api/java/lang/Long.html">Long.parseLong(request.getParameter("fileId")); |
||
457 | User user = UserSessionProxy.loadUserSessionFromRequest(request).getUser(); |
||
458 | |||
459 | |||
460 | HibernateUtils.getCurrentSession().beginTransaction(); |
||
461 | ProcessEventFileImpl ef = (ProcessEventFileImpl) DaoFactory.getProcessEventFileDaoImpl().load(fileId); |
||
462 | if(ef.isGhost()) |
||
463 | { |
||
464 | if(ef.canOpenCloseGhost(user)) |
||
465 | { |
||
466 | ef.setGhost(false); |
||
467 | ef.setFileAccessLevel(ef.getOldFileAccessLevel()); |
||
468 | 1.5.0/docs/api/java/lang/String.html">String level = MessageResources.getMessage(request,"process.access.level." + ef.getFileAccessLevel()); |
||
469 | addMessage(request,"processes.file.unset.ghost",level); |
||
470 | } |
||
471 | } |
||
472 | HibernateUtils.getCurrentSession().getTransaction().commit(); |
||
473 | request.setAttribute("processId",ef.getProcessEvent().getProcess().getId()); |
||
474 | return mapping.getInputForward(); |
||
475 | } |
||
476 | catch (1.5.0/docs/api/java/lang/Throwable.html">Throwable e) |
||
477 | { |
||
478 | logger.error(e, e); |
||
479 | return mapping.findForward("error501"); |
||
480 | } |
||
481 | } |
||
482 | |||
483 | |||
484 | } |