001/*
002 * (C) Copyright 2007-2018 Nuxeo (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 org.apache.commons.lang3.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 {
035
036    @XNode("@key")
037    private String key;
038
039    @XNode("@expression")
040    private String expression;
041
042    @XNode("@enabled")
043    private boolean enabled = true;
044
045    public String getKey() {
046        return key;
047    }
048
049    public void setKey(String value) {
050        key = value;
051    }
052
053    public String getExpression() {
054        return expression;
055    }
056
057    public void setExpression(String value) {
058        expression = value;
059    }
060
061    public boolean getEnabled() {
062        return enabled;
063    }
064
065    public void setEnabled(boolean enabled) {
066        this.enabled = enabled;
067    }
068
069    @Override
070    public int hashCode() {
071        return key == null ? 0 : key.hashCode();
072    }
073
074    @Override
075    public boolean equals(Object obj) {
076        if (this == obj) {
077            return true;
078        }
079        if (obj == null) {
080            return false;
081        }
082        if (getClass() != obj.getClass()) {
083            return false;
084        }
085        ExtendedInfoDescriptor other = (ExtendedInfoDescriptor) obj;
086        if (key == null) {
087            if (other.key != null) {
088                return false;
089            }
090        } else if (!key.equals(other.key)) {
091            return false;
092        }
093        return true;
094    }
095
096    @Override
097    public String toString() {
098        return ToStringBuilder.reflectionToString(this);
099    }
100
101}