1 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 31 public class IsValidForActivationResults extends NodeOperationResult { 32 33 private EngineMessage msg; 34 35 48 public IsValidForActivationResults(String objectType, int objectID, 49 String languageCode, EngineMessage aMsg) throws ClassNotFoundException { 50 super(ObjectKey.getInstance(objectType + ObjectKey.KEY_SEPARATOR + 51 Integer.toString(objectID)), languageCode, null); 52 this.msg = aMsg; 53 } 54 55 public IsValidForActivationResults(String objectType, int objectID, 56 String languageCode, String comment) throws ClassNotFoundException { 57 super(ObjectKey.getInstance(objectType + ObjectKey.KEY_SEPARATOR + 58 Integer.toString(objectID)), languageCode, comment); 59 } 60 61 public String 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 toString() { 74 final StringBuffer result = new StringBuffer (); 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 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 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 |