KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infoglue > cms > util > NotificationMessage


1 /* ===============================================================================
2  *
3  * Part of the InfoGlue Content Management Platform (www.infoglue.org)
4  *
5  * ===============================================================================
6  *
7  * Copyright (C)
8  *
9  * This program is free software; you can redistribute it and/or modify it under
10  * the terms of the GNU General Public License version 2, as published by the
11  * Free Software Foundation. See the file LICENSE.html for more information.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY, including the implied warranty of MERCHANTABILITY or FITNESS
15  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along with
18  * this program; if not, write to the Free Software Foundation, Inc. / 59 Temple
19  * Place, Suite 330 / Boston, MA 02111-1307 / USA.
20  *
21  * ===============================================================================
22  */

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 JavaDoc TRANS_CREATE_TEXT = "create";
37     public final static String JavaDoc TRANS_UPDATE_TEXT = "update";
38     public final static String JavaDoc TRANS_DELETE_TEXT = "delete";
39     public final static String JavaDoc PUBLISHING_TEXT = "publishing";
40     public final static String JavaDoc DENIED_PUBLISHING_TEXT = "publishing denied";
41     public final static String JavaDoc UNPUBLISHING_TEXT = "unpublishing";
42     public final static String JavaDoc SYSTEM_TEXT = "general configuration change";
43
44
45     private String JavaDoc name;
46     private String JavaDoc systemUserName;
47     private int type;
48     private String JavaDoc className;
49     private Object JavaDoc objectId;
50     private String JavaDoc objectName;
51     
52     public NotificationMessage(String JavaDoc name, String JavaDoc className, String JavaDoc systemUserName, int type, Object JavaDoc objectId, String JavaDoc 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 JavaDoc getName()
64     {
65         return this.name;
66     }
67
68     public String JavaDoc getClassName()
69     {
70         return this.className;
71     }
72
73     public String JavaDoc getSystemUserName()
74     {
75         return this.systemUserName;
76     }
77
78     public int getType()
79     {
80         return this.type;
81     }
82
83     public Object JavaDoc getObjectId()
84     {
85         return this.objectId;
86     }
87
88     public String JavaDoc getObjectName()
89     {
90         return this.objectName;
91     }
92
93     public static String JavaDoc getTransactionTypeName(Integer JavaDoc 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