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.types;
018
019import org.nuxeo.common.xmap.annotation.XContent;
020import org.nuxeo.common.xmap.annotation.XNode;
021import org.nuxeo.common.xmap.annotation.XObject;
022
023/**
024 * @since 5.4.2
025 */
026@XObject("contentView")
027public class DocumentContentView {
028
029    @XNode("@showInExportView")
030    protected boolean showInExportView = true;
031
032    @XContent
033    protected String contentView;
034
035    public boolean getShowInExportView() {
036        return showInExportView;
037    }
038
039    public String getContentViewName() {
040        if (contentView != null) {
041            return contentView.trim();
042        }
043        return null;
044    }
045
046    /**
047     * Clone to handle hot reload
048     *
049     * @since 5.6
050     */
051    @Override
052    public DocumentContentView clone() {
053        DocumentContentView clone = new DocumentContentView();
054        clone.showInExportView = getShowInExportView();
055        clone.contentView = getContentViewName();
056        return clone;
057    }
058
059}