com.ca.jcs.sdk.converter
Class DemoFlattenAttributeConverter

java.lang.Object
  extended by com.ca.jcs.sdk.converter.DemoFlattenAttributeConverter
All Implemented Interfaces:
AttributeConverter

public class DemoFlattenAttributeConverter
extends Object
implements AttributeConverter

A demo flattener that flattens multiple values into a single string literal separated by a configured valueSeparator string (refer to comments in DemoFlattenPropertyConverter. Because of the job this converter does it has the following features worthy of special mention:

  1. It is "structural" meaning that it changes the representation of an attributes values in a fundamental way. Structural converters are always run after all other converters in the to-connector direction and before all others in the from-connector direction.
  2. It doesn't delegate to a Converter underneath it as it does its job on an entire set of attribute values without needing to convert individual ones.
.

Note that this converter is for demo purposes only as there are a number of production converters included in the JCS framework which are more useful (refer to XMLMultiValuePropertyFlattener and other related classes).


Constructor Summary
DemoFlattenAttributeConverter(String valueSeparator)
           
 
Method Summary
 void convertFromConnector(Attribute connAttr)
          Perform the reverse operation of taking a single string literal value stored on the managed native system and splitting it back up in possibly multiple values for the provided attribute.
 void convertToConnector(Attribute attr)
          Flatten the values for attr into a single string literal (if it has two or more), otherwise leave it unchanged, for storage on a the managed native system.
 Converter getConverter()
          Not required by most structural converters.
 boolean isLossy()
          Returns true if the converter performs a lossy attribute value conversion
 boolean isMultiValued()
           
 boolean isStructural()
          Returns true if the converter performs a change to the structure of an attribute's values, rather then just transforming individual values themselves.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DemoFlattenAttributeConverter

public DemoFlattenAttributeConverter(String valueSeparator)
Method Detail

convertToConnector

public void convertToConnector(Attribute attr)
                        throws NamingException
Flatten the values for attr into a single string literal (if it has two or more), otherwise leave it unchanged, for storage on a the managed native system. Note that these values are first sorted in lexicographical order.

Specified by:
convertToConnector in interface AttributeConverter
Parameters:
attr - Attribute whosse values need to be flattended.
Throws:
NamingException

convertFromConnector

public void convertFromConnector(Attribute connAttr)
                          throws NamingException
Perform the reverse operation of taking a single string literal value stored on the managed native system and splitting it back up in possibly multiple values for the provided attribute.

Specified by:
convertFromConnector in interface AttributeConverter
Parameters:
connAttr - Attribute whose value is to be possibly split.
Throws:
NamingException

isMultiValued

public boolean isMultiValued()
Specified by:
isMultiValued in interface AttributeConverter

isStructural

public boolean isStructural()
Description copied from interface: AttributeConverter
Returns true if the converter performs a change to the structure of an attribute's values, rather then just transforming individual values themselves. For instance changing a multi-valued attribute into a String[] is a structural conversion.

Specified by:
isStructural in interface AttributeConverter

isLossy

public boolean isLossy()
Description copied from interface: AttributeConverter
Returns true if the converter performs a lossy attribute value conversion

Specified by:
isLossy in interface AttributeConverter

getConverter

public Converter getConverter()
Not required by most structural converters.

Specified by:
getConverter in interface AttributeConverter


Created 2011-07-14 13:27 EST