1 23 24 package org.infoglue.cms.util; 25 26 public class NotificationMessage 27 { 28 public final static int TRANS_CREATE = 0; 29 public final static int TRANS_UPDATE = 1; 30 public final static int TRANS_DELETE = 2; 31 public final static int PUBLISHING = 10; 32 public final static int DENIED_PUBLISHING = 20; 33 public final static int UNPUBLISHING = 30; 34 public final static int SYSTEM = 100; 35 36 public final static String TRANS_CREATE_TEXT = "create"; 37 public final static String TRANS_UPDATE_TEXT = "update"; 38 public final static String TRANS_DELETE_TEXT = "delete"; 39 public final static String PUBLISHING_TEXT = "publishing"; 40 public final static String DENIED_PUBLISHING_TEXT = "publishing denied"; 41 public final static String UNPUBLISHING_TEXT = "unpublishing"; 42 public final static String SYSTEM_TEXT = "general configuration change"; 43 44 45 private String name; 46 private String systemUserName; 47 private int type; 48 private String className; 49 private Object objectId; 50 private String objectName; 51 52 public NotificationMessage(String name, String className, String systemUserName, int type, Object objectId, String objectName) 53 { 54 this.name = name; 55 this.className = className; 56 this.systemUserName = systemUserName; 57 this.type = type; 58 this.objectId = objectId; 59 this.objectName = objectName; 60 } 61 62 63 public String getName() 64 { 65 return this.name; 66 } 67 68 public String getClassName() 69 { 70 return this.className; 71 } 72 73 public String getSystemUserName() 74 { 75 return this.systemUserName; 76 } 77 78 public int getType() 79 { 80 return this.type; 81 } 82 83 public Object getObjectId() 84 { 85 return this.objectId; 86 } 87 88 public String getObjectName() 89 { 90 return this.objectName; 91 } 92 93 public static String getTransactionTypeName(Integer transactionType) 94 { 95 switch (transactionType.intValue()) 96 { 97 case (int) (TRANS_CREATE): 98 return TRANS_CREATE_TEXT; 99 case (TRANS_DELETE): 100 return TRANS_DELETE_TEXT; 101 case (TRANS_UPDATE): 102 return TRANS_UPDATE_TEXT; 103 case (PUBLISHING): 104 return PUBLISHING_TEXT; 105 case (DENIED_PUBLISHING): 106 return DENIED_PUBLISHING_TEXT; 107 } 108 return "unknown - map " + transactionType + " to correct text"; 109 } 110 } | Popular Tags |