KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > services > version > IsValidForActivationResults


1 //
2
// ____.
3
// __/\ ______| |__/\. _______
4
// __ .____| | \ | +----+ \
5
// _______| /--| | | - \ _ | : - \_________
6
// \\______: :---| : : | : | \________>
7
// |__\---\_____________:______: :____|____:_____\
8
// /_____|
9
//
10
// . . . i n j a h i a w e t r u s t . . .
11
//
12
//
13

14 package org.jahia.services.version;
15
16 import org.jahia.content.NodeOperationResult;
17 import org.jahia.content.ObjectKey;
18 import org.jahia.engines.EngineMessage;
19
20 /**
21  * <p>Title: A node result for an activation test.</p>
22  * <p>Description:
23  * This object is created when an error is triggered during the check for
24  * activation process.
25  * </p>
26  * <p>Copyright: MAP (Jahia Solutions S�rl 2002)</p>
27  * <p>Company: Jahia Solutions</p>
28  * @author MAP
29  * @version 1.0
30  */

31 public class IsValidForActivationResults extends NodeOperationResult {
32     
33     private EngineMessage msg;
34
35     /**
36      * Constructor for the result.
37      * @param objectType the objects type. Here only supported object types
38      * are allowed. See the org.jahia.content.ObjectKey class and it's
39      * descendents for more information.
40      * @param objectID the identifier within the type, again refer to the
41      * ObjectKey class for more information.
42      * @param languageCode the language for which this result is given
43      * @param msg An EngineMessage to use for internationalization
44      * @throws ClassNotFoundException thrown if the object type is not
45      * recognized by Jahia
46      * @see org.jahia.content.ObjectKey
47      */

48     public IsValidForActivationResults(String JavaDoc objectType, int objectID,
49             String JavaDoc languageCode, EngineMessage aMsg) throws ClassNotFoundException JavaDoc {
50         super(ObjectKey.getInstance(objectType + ObjectKey.KEY_SEPARATOR +
51                 Integer.toString(objectID)), languageCode, null);
52         this.msg = aMsg;
53     }
54     
55     public IsValidForActivationResults(String JavaDoc objectType, int objectID,
56             String JavaDoc languageCode, String JavaDoc comment) throws ClassNotFoundException JavaDoc {
57         super(ObjectKey.getInstance(objectType + ObjectKey.KEY_SEPARATOR +
58                 Integer.toString(objectID)), languageCode, comment);
59     }
60
61     public String JavaDoc getObjectType() {
62         return getNodeKey().getType();
63     }
64
65     public int getObjectID() {
66         return getNodeKey().getIdInType();
67     }
68     
69     public EngineMessage getMsg() {
70         return msg;
71     }
72
73     public String JavaDoc toString() {
74         final StringBuffer JavaDoc result = new StringBuffer JavaDoc();
75         result.append("IsValidForActivationResult=[");
76         result.append("objectType=");
77         result.append(getObjectType());
78         result.append(",objectID=");
79         result.append(getObjectID());
80         result.append(",languageCode=");
81         result.append(getLanguageCode());
82         result.append(", comment=");
83         result.append(getComment());
84         result.append(", msg=");
85         result.append(msg);
86         result.append("]");
87         return result.toString();
88     }
89
90     public boolean equals(final Object JavaDoc obj) {
91         if (this == obj) return true;
92
93         if (IsValidForActivationResults.class == obj.getClass()) {
94             final IsValidForActivationResults tmp = (IsValidForActivationResults) obj;
95             final boolean interim = tmp.getObjectType().equals(getObjectType()) && tmp.getObjectID() == getObjectID();
96             if (interim) {
97                 final String JavaDoc tmpComment = tmp.getComment() == null ? "" : tmp.getComment();
98                 final EngineMessage tmpMsg = tmp.getMsg() == null ? new EngineMessage() : tmp.getMsg();
99                 return tmpComment.equals(getComment()) || tmpMsg.equals(getMsg());
100             }
101         }
102         return false;
103     }
104 }
105
Popular Tags