001/*
002 * (C) Copyright 2011 Nuxeo SA (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 *     Anahide Tchertchian
016 */
017package org.nuxeo.ecm.platform.forms.layout.api.impl;
018
019import org.nuxeo.ecm.platform.forms.layout.api.RenderingInfo;
020
021/**
022 * @since 5.5
023 */
024public class RenderingInfoImpl implements RenderingInfo {
025
026    private static final long serialVersionUID = 1L;
027
028    protected String level;
029
030    protected String message;
031
032    protected boolean translated = false;
033
034    public RenderingInfoImpl(String level, String message, boolean translated) {
035        super();
036        this.level = level;
037        this.message = message;
038        this.translated = translated;
039    }
040
041    public String getLevel() {
042        return level;
043    }
044
045    public String getMessage() {
046        return message;
047    }
048
049    public boolean isTranslated() {
050        return translated;
051    }
052
053    @Override
054    public RenderingInfo clone() {
055        return new RenderingInfoImpl(level, message, translated);
056    }
057
058    /**
059     * @since 7.2
060     */
061    @Override
062    public boolean equals(Object obj) {
063        if (!(obj instanceof RenderingInfoImpl)) {
064            return false;
065        }
066        if (obj == this) {
067            return true;
068        }
069        RenderingInfoImpl ri = (RenderingInfoImpl) obj;
070        return new EqualsBuilder().append(level, ri.level).append(message, ri.message).append(translated, ri.translated).isEquals();
071    }
072
073}