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    public String getLevel() {
044        return level;
045    }
046
047    public String getMessage() {
048        return message;
049    }
050
051    public boolean isTranslated() {
052        return translated;
053    }
054
055    @Override
056    public RenderingInfo clone() {
057        return new RenderingInfoImpl(level, message, translated);
058    }
059
060    /**
061     * @since 7.2
062     */
063    @Override
064    public boolean equals(Object obj) {
065        if (!(obj instanceof RenderingInfoImpl)) {
066            return false;
067        }
068        if (obj == this) {
069            return true;
070        }
071        RenderingInfoImpl ri = (RenderingInfoImpl) obj;
072        return new EqualsBuilder().append(level, ri.level).append(message, ri.message).append(translated, ri.translated).isEquals();
073    }
074
075}