001/*
002 * (C) Copyright 2006-2007 Nuxeo SAS (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 *     Nuxeo - initial API and implementation
016 *
017 * $Id$
018 */
019
020package org.nuxeo.ecm.platform.filemanager.service.extension;
021
022import java.io.Serializable;
023import java.util.ArrayList;
024import java.util.List;
025
026import org.nuxeo.common.xmap.annotation.XNode;
027import org.nuxeo.common.xmap.annotation.XNodeList;
028import org.nuxeo.common.xmap.annotation.XObject;
029
030@XObject("unicitySettings")
031public class UnicityExtension implements Serializable {
032
033    private static final long serialVersionUID = 7764225025169187266L;
034
035    public static final List<String> DEFAULT_FIELDS = new ArrayList<String>();
036
037    @XNode("algo")
038    protected String algo;
039
040    @XNode("enabled")
041    protected Boolean enabled;
042
043    @XNode("computeDigest")
044    protected Boolean computeDigest = Boolean.FALSE;
045
046    @XNodeList(value = "field", type = ArrayList.class, componentType = String.class)
047    protected List<String> fields = DEFAULT_FIELDS;
048
049    public String getAlgo() {
050        return algo;
051    }
052
053    public Boolean getEnabled() {
054        return enabled;
055    }
056
057    public List<String> getFields() {
058        return fields;
059    }
060
061    public Boolean getComputeDigest() {
062        if (Boolean.TRUE.equals(enabled)) {
063            return enabled;
064        }
065        return computeDigest;
066    }
067
068}