KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > common > ejbs > entity > callbacklogger > OperationLogger


1 /**
2  * EasyBeans
3  * Copyright (C) 2006 Bull S.A.S.
4  * Contact: easybeans@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: OperationLogger.java 731 2006-06-23 09:12:59Z studzine $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger;
26
27 import java.text.MessageFormat JavaDoc;
28
29 import javax.persistence.DiscriminatorValue;
30 import javax.persistence.Entity;
31 import javax.persistence.EnumType;
32 import javax.persistence.Enumerated;
33 import javax.persistence.Table;
34
35 /**
36  * Makes the log of the operations.
37  * @author Gisele Pinheiro Souza
38  * @author Eduardo Studzinski Estima de Castro
39  */

40 @Entity
41 @Table(name = "OPERATIONLOGGER")
42 @DiscriminatorValue("operation")
43 public class OperationLogger extends CallbackLogger {
44
45     /**
46      * Class ID.
47      */

48     private static final long serialVersionUID = 6121867108408882235L;
49
50     /**
51      * The identifier of the operation.
52      */

53     private OperationType opType;
54
55     /**
56      * The operation description.
57      */

58     private String JavaDoc opDescription;
59
60     /**
61      * Gets the operation type.
62      * @return the operation type.
63      */

64     @Enumerated(EnumType.STRING)
65     public OperationType getOperationType() {
66         return opType;
67     }
68
69     /**
70      * Sets the operation type.
71      * @param operationType the operation type.
72      */

73     public void setOperationType(final OperationType operationType) {
74         this.opType = operationType;
75     }
76
77     /**
78      * Gets the operation description.
79      * @return the operation description.
80      */

81     public String JavaDoc getDescription() {
82         return opDescription;
83     }
84
85     /**
86      * Sets the operation description.
87      * @param description the operation description.
88      */

89     public void setDescription(final String JavaDoc description) {
90         this.opDescription = description;
91     }
92
93     /**
94      * String representation of the object.
95      * @return object representation
96      */

97     @SuppressWarnings JavaDoc("boxing")
98     @Override JavaDoc
99     public String JavaDoc toString() {
100         return MessageFormat.format("{0}, ID = {1}, ClassName = {2}, CallbackClassName = {3}, CallbackEvent = {4}, "
101                 + "OperationType = {5}, Description = {6}, Date = {7}", OperationLogger.class.getName(), getId(),
102                 getClassName(), getCallbackClassName(), getCallbackEvent(), getOperationType(), getDescription(),
103                 getInsertionDate());
104     }
105
106 }
107
Popular Tags