001/* 002 * (C) Copyright 2017 Nuxeo (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 * Kevin Leturc 018 */ 019package org.nuxeo.ecm.core.schema; 020 021import static org.nuxeo.ecm.core.schema.PropertyDescriptor.DEPRECATED; 022import static org.nuxeo.ecm.core.schema.PropertyDescriptor.REMOVED; 023 024import org.nuxeo.common.xmap.annotation.XNode; 025import org.nuxeo.common.xmap.annotation.XObject; 026 027/** 028 * @since 9.2 029 * @deprecated since 11.1, use {@link PropertyDescriptor} instead 030 */ 031@XObject("property") 032@Deprecated(since = "11.1") 033public class PropertyDeprecationDescriptor { 034 035 @XNode("@schema") 036 protected String schema; 037 038 @XNode("@name") 039 protected String name; 040 041 @XNode("@fallback") 042 protected String fallback; 043 044 @XNode("@deprecated") 045 protected boolean deprecated; 046 047 public String getSchema() { 048 return schema; 049 } 050 051 public String getName() { 052 return name; 053 } 054 055 public String getFallback() { 056 return fallback; 057 } 058 059 public boolean isDeprecated() { 060 return deprecated; 061 } 062 063 @Override 064 public String toString() { 065 StringBuilder builder = new StringBuilder("PropertyDeprecationDescriptor"); 066 builder.append("(schema=").append(schema).append(", "); 067 builder.append("name=").append(name).append(", "); 068 if (fallback != null) { 069 builder.append("fallback=").append(fallback).append(", "); 070 } 071 builder.append("deprecated=").append(deprecated).append(")"); 072 return builder.toString(); 073 } 074 075 protected PropertyDescriptor toPropertyDescriptor() { 076 var descriptor = new PropertyDescriptor(); 077 descriptor.schema = schema; 078 descriptor.name = name; 079 descriptor.fallback = fallback; 080 descriptor.deprecation = deprecated ? DEPRECATED : REMOVED; 081 return descriptor; 082 } 083 084}