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