001: /**
002: * EasyBeans
003: * Copyright (C) 2006 Bull S.A.S.
004: * Contact: easybeans@ow2.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * --------------------------------------------------------------------------
022: * $Id: OperationLogger.java 1970 2007-10-16 11:49:25Z benoitf $
023: * --------------------------------------------------------------------------
024: */package org.ow2.easybeans.tests.common.ejbs.entity.callbacklogger;
025:
026: import java.text.MessageFormat;
027:
028: import javax.persistence.DiscriminatorValue;
029: import javax.persistence.Entity;
030: import javax.persistence.EnumType;
031: import javax.persistence.Enumerated;
032:
033: /**
034: * Makes the log of the operations.
035: * @author Gisele Pinheiro Souza
036: * @author Eduardo Studzinski Estima de Castro
037: */
038: @Entity
039: @DiscriminatorValue("operation")
040: public class OperationLogger extends CallbackLogger {
041:
042: /**
043: * Class ID.
044: */
045: private static final long serialVersionUID = 6121867108408882235L;
046:
047: /**
048: * The identifier of the operation.
049: */
050: private OperationType opType;
051:
052: /**
053: * The operation description.
054: */
055: private String opDescription;
056:
057: /**
058: * Gets the operation type.
059: * @return the operation type.
060: */
061: @Enumerated(EnumType.STRING)
062: public OperationType getOperationType() {
063: return opType;
064: }
065:
066: /**
067: * Sets the operation type.
068: * @param operationType the operation type.
069: */
070: public void setOperationType(final OperationType operationType) {
071: this .opType = operationType;
072: }
073:
074: /**
075: * Gets the operation description.
076: * @return the operation description.
077: */
078: public String getDescription() {
079: return opDescription;
080: }
081:
082: /**
083: * Sets the operation description.
084: * @param description the operation description.
085: */
086: public void setDescription(final String description) {
087: this .opDescription = description;
088: }
089:
090: /**
091: * String representation of the object.
092: * @return object representation
093: */
094: @SuppressWarnings("boxing")
095: @Override
096: public String toString() {
097: return MessageFormat
098: .format(
099: "{0}, ID = {1}, ClassName = {2}, CallbackClassName = {3}, CallbackEvent = {4}, "
100: + "OperationType = {5}, Description = {6}, Date = {7}",
101: OperationLogger.class.getName(), getId(),
102: getClassName(), getCallbackClassName(),
103: getCallbackEvent(), getOperationType(),
104: getDescription(), getInsertionDate());
105: }
106:
107: }
|