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