com.ca.jcs.converter.meta
Class JSONCompoundValueClassConverter

java.lang.Object
  extended by com.ca.jcs.cfg.Vetoable
      extended by com.ca.jcs.converter.meta.ClassConverter
          extended by com.ca.jcs.converter.meta.JSONCompoundValueClassConverter
Direct Known Subclasses:
JSONReverseCompoundValueClassConverter

public class JSONCompoundValueClassConverter
extends ClassConverter

Converts JNDI Attributes collections representing compound values to/from JSON objects, or optionally their string representation. When used directly this class performs no LDAP-speak <=> connector-speak attribute id mapping, but when its protected methods are invoked via JSONReverseCompoundValueClassConverter this mapping is performed as part of the conversion process.


Nested Class Summary
static class JSONCompoundValueClassConverter.Config
           
 
Field Summary
 
Fields inherited from class com.ca.jcs.converter.meta.ClassConverter
classMap, converterConfig
 
Constructor Summary
JSONCompoundValueClassConverter(JSONCompoundValueClassConverter.Config cfg, MetaObjectClassMapping classMap)
           
JSONCompoundValueClassConverter(MetaObjectClassMapping classMap)
           
 
Method Summary
 void convertFromConnector(Attributes attrs)
          Flat Attributes (JSON values) => Attributes(maybe nested), with no attrId mapping.
protected  Attribute convertPropertyFromJSON(MetaObjectClassMapping classMap, DataModelProperty dmProp, boolean isLdap, boolean mapAttrIds, com.ca.commons.json.JSONValue jsonVal)
           
 void convertToConnector(Attributes attrs)
          Attributes (maybe nested) => Attributes(JSON values).
 ModificationItem[] convertToConnector(ModificationItem[] modItems)
          Attributes (maybe nested) => Attributes(JSON values).
protected  void doConvertFromConnector(Attributes attrs, boolean isLdap, boolean mapAttrIds)
          Note top-level ids in attrs are always in LDAP-speak, regardless of the value of isLdap.
protected  void doConvertToConnector(Attributes attrs, boolean isLdap, boolean mapAttrIds)
          Add flag which controls attribute id mapping in nested compound values.
 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.
static com.ca.commons.json.JSONValue parseJSON(String s)
           
 
Methods inherited from class com.ca.jcs.cfg.Vetoable
isVetoed, setVetoed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSONCompoundValueClassConverter

public JSONCompoundValueClassConverter(JSONCompoundValueClassConverter.Config cfg,
                                       MetaObjectClassMapping classMap)

JSONCompoundValueClassConverter

public JSONCompoundValueClassConverter(MetaObjectClassMapping classMap)
Method Detail

isStructural

public boolean isStructural()
Description copied from class: ClassConverter
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 Attributes representations into an alternative representation such as JSON is an example of a structural conversion.

Specified by:
isStructural in class ClassConverter

doConvertToConnector

protected void doConvertToConnector(Attributes attrs,
                                    boolean isLdap,
                                    boolean mapAttrIds)
                             throws NamingException
Add flag which controls attribute id mapping in nested compound values.

Throws:
NamingException

convertToConnector

public void convertToConnector(Attributes attrs)
                        throws NamingException
Attributes (maybe nested) => Attributes(JSON values).

Specified by:
convertToConnector in class ClassConverter
Throws:
NamingException

convertToConnector

public ModificationItem[] convertToConnector(ModificationItem[] modItems)
                                      throws NamingException
Attributes (maybe nested) => Attributes(JSON values).

Specified by:
convertToConnector in class ClassConverter
Throws:
NamingException

convertPropertyFromJSON

protected Attribute convertPropertyFromJSON(MetaObjectClassMapping classMap,
                                            DataModelProperty dmProp,
                                            boolean isLdap,
                                            boolean mapAttrIds,
                                            com.ca.commons.json.JSONValue jsonVal)
                                     throws NamingException
Throws:
NamingException

parseJSON

@NotNull
public static com.ca.commons.json.JSONValue parseJSON(String s)
                                               throws NamingException
Throws:
NamingException

doConvertFromConnector

protected void doConvertFromConnector(Attributes attrs,
                                      boolean isLdap,
                                      boolean mapAttrIds)
                               throws NamingException
Note top-level ids in attrs are always in LDAP-speak, regardless of the value of isLdap.

Throws:
NamingException

convertFromConnector

public void convertFromConnector(Attributes attrs)
                          throws NamingException
Flat Attributes (JSON values) => Attributes(maybe nested), with no attrId mapping. SET and SEQ collections must always represented as JSONArrays.

Specified by:
convertFromConnector in class ClassConverter
Throws:
NamingException


Created 2011-07-14 13:27 EST