001/*
002 * (C) Copyright 2012 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 *     Antoine Taillefer
016 */
017package org.nuxeo.ecm.diff.service.impl;
018
019import java.util.ArrayList;
020import java.util.List;
021
022import org.nuxeo.common.xmap.annotation.XNode;
023import org.nuxeo.common.xmap.annotation.XNodeList;
024import org.nuxeo.common.xmap.annotation.XObject;
025import org.nuxeo.ecm.diff.model.DiffFieldDefinition;
026import org.nuxeo.ecm.diff.model.impl.DiffFieldDefinitionImpl;
027
028/**
029 * Diff field descriptor.
030 *
031 * @author <a href="mailto:ataillefer@nuxeo.com">Antoine Taillefer</a>
032 * @since 5.6
033 */
034@XObject("field")
035public class DiffFieldDescriptor {
036
037    @XNode("@category")
038    public String category;
039
040    @XNode("@schema")
041    public String schema;
042
043    @XNode("@name")
044    public String name;
045
046    @XNode("@displayContentDiffLinks")
047    public boolean displayContentDiffLinks;
048
049    @XNodeList(value = "items/item", type = ArrayList.class, componentType = DiffFieldItemDescriptor.class)
050    public List<DiffFieldItemDescriptor> items;
051
052    public String getCategory() {
053        return category;
054    }
055
056    public void setCategory(String category) {
057        this.category = category;
058    }
059
060    public String getSchema() {
061        return schema;
062    }
063
064    public void setSchema(String schema) {
065        this.schema = schema;
066    }
067
068    public String getName() {
069        return name;
070    }
071
072    public void setName(String name) {
073        this.name = name;
074    }
075
076    public boolean isDisplayContentDiffLinks() {
077        return displayContentDiffLinks;
078    }
079
080    public void setDisplayContentDiffLinks(boolean displayContentDiffLinks) {
081        this.displayContentDiffLinks = displayContentDiffLinks;
082    }
083
084    public List<DiffFieldItemDescriptor> getItems() {
085        return items;
086    }
087
088    public void setItems(List<DiffFieldItemDescriptor> items) {
089        this.items = items;
090    }
091
092    public DiffFieldDefinition getDiffFieldDefinition() {
093        return new DiffFieldDefinitionImpl(getCategory(), getSchema(), getName());
094    }
095}