com.sap.ip.me.api.smartsync
Interface FieldDescriptor

All Superinterfaces:
AttributeDescriptor

public interface FieldDescriptor
extends AttributeDescriptor

The FieldDescriptor provides read access to field's metadata description. MetaData information for example:

The following are the possible data types of a field.

ME2.1 Representation:
These representations are used in interfaces available from 2.1 version such as Row.getValue and Row.setValue methods.



ME2.5 Representation:
These representations are used in interfaces available from 2.5 version such as Field.getValue and Field.setValue methods.

FieldDescriptor has methods convertTo21DataType,convertTo25DataType for converting the specified objects to ME2.1 and ME2.5 data types.
 Example usage:
 Retrieving the Field object form a Row parentRow using FieldDescriptor.
 
 RowDescriptor rowDesc = parentRow.getRowDescriptor();
 FieldDescriptor fieldDesc = rowDesc.getFieldDescriptor("field name");
 CharacterField charField = parentRow.getCharacterField(fieldDesc);
 
 The field object can retrieved for the other types using the appropriate methods.
 

 
 

Since:
2.1
Author:
SAP

Method Summary
 boolean checkFieldValue(java.lang.Object fieldValue)
          Returns true if the field value represented by an Object instnace is compliant to the type , length and decimals definitions in the application's metadata.
 int compare(java.lang.Object comparedValue, java.lang.Object referenceValue)
          Comparison of two field values represented by Object instances. the comparison is based on field value type.
 java.lang.Object convertTo21DataType(java.lang.Object object)
          Converts the specified object to the ME 2.1 data type.
 java.lang.Object convertTo25DataType(java.lang.Object object)
          Converts the specified object to the ME 2.5 data type.
 FieldGroupDescriptorIterator getAllFieldGroupDescriptors()
          Returns an iterator to all FieldGroupDescriptor objects to which this Field is a member; null if this Field is not a member of any group.
 FieldInputQualifyType getCreateInputQualifyType()
          Identify qualification of application input when the field is created on device but is not synchronized with the backend.
 int getDecimals()
          Returns the maximum decimal number digit length defined in the backend system.
 FieldGroupDescriptor getFieldGroupDescriptor(FieldGroupType type)
          Returns the FieldGroupDescriptor of the specified FieldGroupType for which this Field is a member; null if this Field is not a member of any group or of the specfied group type.
 java.lang.String getFieldName()
          Retrieves the name of the field described by this FieldDescriptor
 BasisFieldType getFieldType()
          Retuns the BasisFieldType instance of the field described by this FieldDescriptor.
 int getLength()
          Returns the maximum field length defined in the backend system
 FieldInputQualifyType getModifyInputQualifyType()
          Identify qualification of applications input when the field has been synchronized with the backend.
 int getRealLength()
          Returns the maximum real field length defined in the backend.
 RelationDescriptor getRelatedRelation()
          Returns the RelationDescriptor instance related this FieldDescriptor.
 RowDescriptor getRowDescriptor()
          Returns the RowDescriptor instance that contains this FieldDescriptor
 boolean isIndexed()
          Returns the flag indicating whether the corresponding object for this FieldDescriptor is an index field or not.
 boolean isKey()
          Returns the flag indicating whether the corresponding object for this FieldDescriptor is a key field or not.
 boolean signed()
          Returns the flag indicating whether the length includes a sign or not.
 java.lang.Object to25Object(java.lang.String string)
          Transformation of a field value represented by a String instance, to a field value represented by an Object instance.
 java.lang.String to25String(java.lang.Object object)
          Transformation of a field value represented by an Object instance into a field value represented by a String instance.
 java.lang.Object toObject(java.lang.String string)
          Deprecated.  
 java.lang.String toString(java.lang.Object object)
          Deprecated.  
 
Methods inherited from interface com.sap.ip.me.api.persist.meta.AttributeDescriptor
getMultiple, getName, getType, isIndex, toSqlString
 

Method Detail

getFieldName

public java.lang.String getFieldName()
Retrieves the name of the field described by this FieldDescriptor

Returns:
the name of the field described by this FieldDescriptor

getFieldType

public BasisFieldType getFieldType()
Retuns the BasisFieldType instance of the field described by this FieldDescriptor. Currently supports C(Char),N(Numeric Char), D(Date), P(Packed) and T(Time)

Returns:
the BasisFieldType instance of the field described by this FieldDescriptor
See Also:
BasisFieldType

getLength

public int getLength()
Returns the maximum field length defined in the backend system

Specified by:
getLength in interface AttributeDescriptor
Returns:
int value that represents the maximum field length

getRealLength

public int getRealLength()
Returns the maximum real field length defined in the backend.
The returned value is basically equal to the value of getlength() except for the BasisFieldType.P, where getRealLength() returns value excluding decimal point and sign.

Returns:
int value that represents the maximum field length

getDecimals

public int getDecimals()
Returns the maximum decimal number digit length defined in the backend system. Field types other than BasisFieldType.P, the value is set to zero.

Specified by:
getDecimals in interface AttributeDescriptor
Returns:
int value that represents the maximum decimal number length

getCreateInputQualifyType

public FieldInputQualifyType getCreateInputQualifyType()
Identify qualification of application input when the field is created on device but is not synchronized with the backend.
This returns the FieldInputQualifyType when creating the field.

Returns:
the FieldInputQualifyType when creating the field
See Also:
FieldInputQualifyType

getModifyInputQualifyType

public FieldInputQualifyType getModifyInputQualifyType()
Identify qualification of applications input when the field has been synchronized with the backend.
Returns the FieldInputQualifyType when modifying the field

Returns:
the FieldInputQualifyType when modifying the field
See Also:
FieldInputQualifyType

isKey

public boolean isKey()
Returns the flag indicating whether the corresponding object for this FieldDescriptor is a key field or not.

Returns:
true if this FieldDescriptor is a key field, otherwise false

signed

public boolean signed()
Returns the flag indicating whether the length includes a sign or not. This attribute is only available for BasisFieldType.P.

Returns:
Returns true if the length includes a sign, otherwise false

isIndexed

public boolean isIndexed()
Returns the flag indicating whether the corresponding object for this FieldDescriptor is an index field or not.

Returns:
true if this FieldDescriptor is an index field, otherwise false

getRelatedRelation

public RelationDescriptor getRelatedRelation()
Returns the RelationDescriptor instance related this FieldDescriptor. The FieldDescriptor represents a foreign key, which is related to the unique key of related row

Returns:
the RelationDescriptor instance related this FieldDescriptor
See Also:
RelationDescriptor

getRowDescriptor

public RowDescriptor getRowDescriptor()
Returns the RowDescriptor instance that contains this FieldDescriptor

Returns:
the RowDescriptor instance that contains this FieldDescriptor
See Also:
RowDescriptor

toString

public java.lang.String toString(java.lang.Object object)
Deprecated.  

Transformation of a field value represented by an Object instance into a field value represented by a String instance. This is used for handing over field values to the synchronization layer for example.

Parameters:
object - the field value in Object representation
Returns:
the String representation of the specified Object entity.

toObject

public java.lang.Object toObject(java.lang.String string)
Deprecated.  

Transformation of a field value represented by a String instance, to a field value represented by an Object instance. This is used for handing over field values from the synchronization layer for example.

Parameters:
string - the String field value
Returns:
the Object representation of the specified field value

checkFieldValue

public boolean checkFieldValue(java.lang.Object fieldValue)
Returns true if the field value represented by an Object instnace is compliant to the type , length and decimals definitions in the application's metadata.

Parameters:
fieldValue - the field value to be tested
Returns:
true if the specified field value is compliance to the defined attributes of this FieldDescriptor;, otherwise false

compare

public int compare(java.lang.Object comparedValue,
                   java.lang.Object referenceValue)
Comparison of two field values represented by Object instances. the comparison is based on field value type.

Parameters:
comparedValue - the Object to be compared
referenceValue - the Object used as a reference of comparison
Returns:
the value 0 if the two are equal; a value greater than 0 if comparedValue is greater than referenceValue; and a value less than 0 if comparedValue is less than referenceValue (signed comparison).

to25String

public java.lang.String to25String(java.lang.Object object)
Transformation of a field value represented by an Object instance into a field value represented by a String instance. This is used for handing over field values to the synchronization layer for example.

Parameters:
object - the field value in ME2.5 Object representation
Returns:
the String representation of the specified Object entity for ME2.5
Since:
2.5

to25Object

public java.lang.Object to25Object(java.lang.String string)
Transformation of a field value represented by a String instance, to a field value represented by an Object instance. This is used for handing over field values from the synchronization layer for example.

Parameters:
string - the String field value
Returns:
the Object representation of the specified field value for ME2.5
Since:
2.5

getAllFieldGroupDescriptors

public FieldGroupDescriptorIterator getAllFieldGroupDescriptors()
Returns an iterator to all FieldGroupDescriptor objects to which this Field is a member; null if this Field is not a member of any group. Here is an example for usage. We assume that the following a part of meta data is stored in SyncBoDescriptorFacade repository.
 <SyncBO id="SAP001" version="1" type="timedTwoWay" allowCreate="true" allowModify="true" allowDelete="true" reqDirectSync="false">
   <TopStructure name="TOP">
     <Field name="SYNC_KEY" type="N" length="10" decimalLength="0" signed="false" isKey="true" isIndex="true">
       <Input type="create">false</Input>
       <Input type="modify">false</Input>
     </Field>
     <Field name="NFIELD" type="N" length="10" decimalLength="0" signed="false" isKey="false" isIndex="false" />
     <Field name="CFIELD" type="C" length="50" decimalLength="0" signed="false" isKey="false" isIndex="false" />
     <Field name="DFIELD" type="D" length="8" decimalLength="0" signed="false" isKey="false" isIndex="false" />
     <Field name="TFIELD" type="T" length="6" decimalLength="0" signed="false" isKey="false" isIndex="false" />
     <Field name="PFIELD" type="P" length="10" decimalLength="3" signed="false" isKey="false" isIndex="false" />
     <FieldGroup name="GROUP1" type="T">
       <Field name="DFIELD" />
       <Field name="TFIELD" />
     </FieldGroup>
     <FieldGroup name="GROUP2" type="O">
       <Field name="NFIELD" />
       <Field name="PFIELD" />
       <Field name="CFIELD" />
     </FieldGroup>
   </TopStructure>
 </SyncBO>

 TopRowDescriptor topDesc // assume that we have already assined
 FieldGroupDescriptorIterator itr = topDesc.getFieldDescriptor("DFIELD").getAllFieldGroupDescriptors();
 while(itr.hasNext()) {
   FieldGroupDescriptor group = itr.next();
   System.out.println("group name:"+group.getName());
 }

  Output: group name:GROUP1
 

Returns:
FieldGroupDescriptorIterator of all FieldGroupDescriptor objects to which this Field is a member; null if this Field is not a member of any group.
Since:
2.5

getFieldGroupDescriptor

public FieldGroupDescriptor getFieldGroupDescriptor(FieldGroupType type)
Returns the FieldGroupDescriptor of the specified FieldGroupType for which this Field is a member; null if this Field is not a member of any group or of the specfied group type. Here is an example for usage. We assume that the following a part
 TopRowDescriptor topDesc // assume that we have already assined
 FieldGroupDescriptor group = topDesc.getFieldDescriptor("DFIELD").getFieldGroupDescriptor(FieldGroupType.T);
 System.out.println("group name:"+group.getName());

  Output: group name:GROUP1

Parameters:
type - field group type
Returns:
FieldGroupDescriptor of the specified FieldGroupType for which this Field is a member; null if this Field is not a member of any group or of the specfied group type.
Since:
2.5

convertTo21DataType

public java.lang.Object convertTo21DataType(java.lang.Object object)
Converts the specified object to the ME 2.1 data type. For example, Calendar will be converted to java.sql.Date object. Please refer to the Client Representation above.

Parameters:
object -
Returns:
the object in its ME 2.1 data type format; null if the specified object is not the data type represented by this FieldDescriptor

convertTo25DataType

public java.lang.Object convertTo25DataType(java.lang.Object object)
Converts the specified object to the ME 2.5 data type. For example, java.sql.Date will be converted to Calendar object. Please refer to the Client Representation above.

Parameters:
object -
Returns:
the object in its ME 2.5 data type format; null if the specified object is not the data type represented by this FieldDescriptor


Copyright © 2005 SAP AG. All Rights Reserved.