1 /*
2 * Copyright 2010 Fraunhofer Gesellschaft, Munich, Germany,
3 * for its Fraunhofer Institute for Computer Architecture and Software
4 * Technology (FIRST), Berlin, Germany. All rights reserved.
5 * http://www.first.fraunhofer.de/
6 */
7
8 package net.kwfgrid.gwes;
9
10 import org.apache.log4j.Logger;
11
12 /**
13 * ToDo: Currently the transition status represents the latest status change of an activity. Better would be to have some hierarchical approach.
14 * @author Andreas Hoheisel
15 * (<a href="http://www.andreas-hoheisel.de">www.andreas-hoheisel.de</a>)
16 * @version $Id: TransitionStatus.java 1490 2011-02-18 13:20:36Z hoheisel $
17 */
18 public class TransitionStatus {
19
20 /**
21 * log4j logger.
22 */
23 final static Logger logger = Logger.getLogger(TransitionStatus.class);
24
25 public Activity.Status status;
26
27 public Activity.Status oldStatus;
28
29 public TransitionStatus(Activity.Status status) {
30 this.status = status;
31 this.oldStatus = Activity.Status.UNDEFINED;
32 }
33
34 public TransitionStatus() {
35 this.status = Activity.Status.UNDEFINED;
36 this.oldStatus = Activity.Status.UNDEFINED;
37 }
38
39 /**
40 * Get the current status of this transition as string.
41 *
42 * @return string representing the status of the transition.
43 * This String is useful for user-readable output.
44 * @see #getStatus()
45 * @see #getStatusAsString(Activity.Status.UNDEFINED;)
46 */
47 public String getStatusAsString() {
48 return getStatusAsString(status);
49 }
50
51 /**
52 * Convert the status of a transition from an integer to a string.
53 *
54 * @param status The status code with should be converted into a string.
55 * @return string representing the status that corresponds to the status code.
56 */
57 public static String getStatusAsString(Activity.Status status) {
58 return Activity.getStatusAsString(status);
59 }
60
61 public Activity.Status getStatus() {
62 return status;
63 }
64
65 public void setStatus(Activity.Status status) {
66 this.status = status;
67 }
68
69 public boolean isModified() {
70 return (oldStatus != status);
71 }
72
73 public void resetModified() {
74 oldStatus = status;
75 }
76
77 }