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