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 * <a href="mailto:at@nuxeo.com">Anahide Tchertchian</a> 018 * 019 * $Id: FieldDescriptor.java 28478 2008-01-04 12:53:58Z sfermigier $ 020 */ 021 022package org.nuxeo.ecm.platform.forms.layout.descriptors; 023 024import org.nuxeo.common.xmap.annotation.XNode; 025import org.nuxeo.common.xmap.annotation.XObject; 026import org.nuxeo.ecm.platform.forms.layout.api.FieldDefinition; 027import org.nuxeo.ecm.platform.forms.layout.api.impl.FieldDefinitionImpl; 028 029/** 030 * Field definition descriptor. 031 * 032 * @author <a href="mailto:at@nuxeo.com">Anahide Tchertchian</a> 033 */ 034@XObject("field") 035public class FieldDescriptor { 036 037 @XNode("@schema") 038 String schema; 039 040 @XNode("") 041 String field; 042 043 public FieldDescriptor() { 044 } 045 046 public FieldDescriptor(String schema, String field) { 047 this.schema = schema; 048 this.field = field; 049 } 050 051 public String getSchemaName() { 052 return schema; 053 } 054 055 public String getFieldName() { 056 return field; 057 } 058 059 public String getPropertyName() { 060 if (schema == null || schema.length() == 0) { 061 return field; 062 } else { 063 return schema + ":" + field; 064 } 065 } 066 067 public FieldDefinition getFieldDefinition() { 068 return new FieldDefinitionImpl(schema, field); 069 } 070 071}