001/*
002 * (C) Copyright 2007 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Nuxeo - initial API and implementation
018 *
019 * $Id: LogEntryFactoryDescriptor.java 19481 2007-05-27 10:50:10Z sfermigier $
020 */
021
022package org.nuxeo.ecm.platform.audit.service.extension;
023
024import java.io.Serializable;
025
026import org.apache.commons.lang.builder.ToStringBuilder;
027import org.nuxeo.common.xmap.annotation.XNode;
028import org.nuxeo.common.xmap.annotation.XObject;
029
030/**
031 * Extended info descriptor
032 *
033 * @author <a href="mailto:ja@nuxeo.com">Julien Anguenot</a>
034 */
035@XObject("extendedInfo")
036public class ExtendedInfoDescriptor implements Serializable {
037
038    private static final long serialVersionUID = 5381693968565370680L;
039
040    @XNode("@key")
041    private String key;
042
043    @XNode("@expression")
044    private String expression;
045
046    @XNode("@enabled")
047    private boolean enabled = true;
048
049    public String getKey() {
050        return key;
051    }
052
053    public void setKey(String value) {
054        key = value;
055    }
056
057    public String getExpression() {
058        return expression;
059    }
060
061    public void setExpression(String value) {
062        expression = value;
063    }
064
065    public boolean getEnabled() {
066        return enabled;
067    }
068
069    public void setEnabled(boolean enabled) {
070        this.enabled = enabled;
071    }
072
073    @Override
074    public int hashCode() {
075        return key == null ? 0 : key.hashCode();
076    }
077
078    @Override
079    public boolean equals(Object obj) {
080        if (this == obj) {
081            return true;
082        }
083        if (obj == null) {
084            return false;
085        }
086        if (getClass() != obj.getClass()) {
087            return false;
088        }
089        ExtendedInfoDescriptor other = (ExtendedInfoDescriptor) obj;
090        if (key == null) {
091            if (other.key != null) {
092                return false;
093            }
094        } else if (!key.equals(other.key)) {
095            return false;
096        }
097        return true;
098    }
099
100    @Override
101    public String toString() {
102        return ToStringBuilder.reflectionToString(this);
103    }
104
105}