001/* 002 * (C) Copyright 2014 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-2.1.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 * Vladimir Pasquier <vpasquier@nuxeo.com> 016 */ 017package org.nuxeo.binary.metadata.internals; 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; 025 026/** 027 * @since 7.1 028 */ 029@XObject("rule") 030public class MetadataRuleDescriptor { 031 032 @XNode("@id") 033 protected String id; 034 035 @XNode("@order") 036 protected Integer order; 037 038 @XNode("@enabled") 039 protected Boolean enabled; 040 041 @XNode("@async") 042 protected Boolean isAsync; 043 044 @XNodeList(value = "metadataMappings/metadataMapping-id", componentType = String.class, type = ArrayList.class) 045 protected List<String> metadataMappingIdDescriptors; 046 047 @XNodeList(value = "filters/filter-id", type = ArrayList.class, componentType = String.class) 048 protected List<String> filterIds; 049 050 public String getId() { 051 return id; 052 } 053 054 public Integer getOrder() { 055 return order; 056 } 057 058 public Boolean getEnabled() { 059 return enabled; 060 } 061 062 public Boolean getIsAsync() { 063 return isAsync; 064 } 065 066 public List<String> getMetadataMappingIdDescriptors() { 067 return metadataMappingIdDescriptors; 068 } 069 070 public List<String> getFilterIds() { 071 return filterIds; 072 } 073 074 @Override 075 public String toString() { 076 return "MetadataRuleDescriptor [id=" + id + "]"; 077 } 078 079 @Override 080 public int hashCode() { 081 final int prime = 31; 082 int result = 1; 083 result = prime * result + ((id == null) ? 0 : id.hashCode()); 084 return result; 085 } 086 087 @Override 088 public boolean equals(Object obj) { 089 if (this == obj) { 090 return true; 091 } 092 if (obj == null) { 093 return false; 094 } 095 if (getClass() != obj.getClass()) { 096 return false; 097 } 098 MetadataRuleDescriptor other = (MetadataRuleDescriptor) obj; 099 if (id == null) { 100 if (other.id != null) { 101 return false; 102 } 103 } else if (!id.equals(other.id)) { 104 return false; 105 } 106 return true; 107 } 108 109}