001/*
002 * (C) Copyright 2007 Nuxeo SAS (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     Nuxeo - initial API and implementation
016 *
017 * $Id: LogEntryFactoryDescriptor.java 19481 2007-05-27 10:50:10Z sfermigier $
018 */
019
020package org.nuxeo.ecm.platform.audit.service.extension;
021
022import java.io.Serializable;
023
024import org.apache.commons.lang.builder.ToStringBuilder;
025import org.nuxeo.common.xmap.annotation.XNode;
026import org.nuxeo.common.xmap.annotation.XObject;
027
028/**
029 * Extended info descriptor
030 *
031 * @author <a href="mailto:ja@nuxeo.com">Julien Anguenot</a>
032 */
033@XObject("extendedInfo")
034public class ExtendedInfoDescriptor implements Serializable {
035
036    private static final long serialVersionUID = 5381693968565370680L;
037
038    @XNode("@key")
039    private String key;
040
041    @XNode("@expression")
042    private String expression;
043
044    @XNode("@enabled")
045    private boolean enabled = true;
046
047    public String getKey() {
048        return key;
049    }
050
051    public void setKey(String value) {
052        key = value;
053    }
054
055    public String getExpression() {
056        return expression;
057    }
058
059    public void setExpression(String value) {
060        expression = value;
061    }
062
063    public boolean getEnabled() {
064        return enabled;
065    }
066
067    public void setEnabled(boolean enabled) {
068        this.enabled = enabled;
069    }
070
071    @Override
072    public int hashCode() {
073        return key == null ? 0 : key.hashCode();
074    }
075
076    @Override
077    public boolean equals(Object obj) {
078        if (this == obj) {
079            return true;
080        }
081        if (obj == null) {
082            return false;
083        }
084        if (getClass() != obj.getClass()) {
085            return false;
086        }
087        ExtendedInfoDescriptor other = (ExtendedInfoDescriptor) obj;
088        if (key == null) {
089            if (other.key != null) {
090                return false;
091            }
092        } else if (!key.equals(other.key)) {
093            return false;
094        }
095        return true;
096    }
097
098    @Override
099    public String toString() {
100        return ToStringBuilder.reflectionToString(this);
101    }
102
103}