001/* 002 * (C) Copyright 2014 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 * Vladimir Pasquier <vpasquier@nuxeo.com> 018 * Thibaud Arguillere 019 */ 020package org.nuxeo.binary.metadata.internals; 021 022import java.util.ArrayList; 023import java.util.List; 024 025import org.nuxeo.common.xmap.annotation.XNode; 026import org.nuxeo.common.xmap.annotation.XNodeList; 027import org.nuxeo.common.xmap.annotation.XObject; 028 029/** 030 * @since 7.1 031 */ 032@XObject("metadataMapping") 033public class MetadataMappingDescriptor { 034 035 @XNode("@id") 036 protected String id; 037 038 @XNode("@processor") 039 protected String processor; 040 041 @XNode("@blobXPath") 042 protected String blobXPath; 043 044 @XNode("@ignorePrefix") 045 protected Boolean ignorePrefix; 046 047 /** @since 11.1 */ 048 @XNode("@readOnly") 049 protected Boolean readOnly; 050 051 @XNodeList(value = "metadata", componentType = MetadataDescriptor.class, type = ArrayList.class) 052 protected List<MetadataDescriptor> metadataDescriptors; 053 054 public List<MetadataDescriptor> getMetadataDescriptors() { 055 return metadataDescriptors; 056 } 057 058 @XObject("metadata") 059 public static class MetadataDescriptor { 060 061 @XNode("@name") 062 protected String name; 063 064 @XNode("@xpath") 065 protected String xpath; 066 067 public String getXpath() { 068 return xpath; 069 } 070 071 public String getName() { 072 return name; 073 } 074 075 } 076 077 public String getId() { 078 return id; 079 } 080 081 public String getProcessor() { 082 return processor; 083 } 084 085 public String getBlobXPath() { 086 return blobXPath; 087 } 088 089 /** 090 * @deprecated since 11.1, use {@link #ignorePrefix()} 091 */ 092 @Deprecated(since = "11.1") 093 public Boolean getIgnorePrefix() { 094 return ignorePrefix(); 095 } 096 097 public boolean ignorePrefix() { 098 return !Boolean.FALSE.equals(ignorePrefix); 099 } 100 101 public boolean isReadOnly() { 102 return Boolean.TRUE.equals(readOnly); 103 } 104}