org.alfresco.jcr.item
Class JCRTypeConverter

java.lang.Object
  extended by org.alfresco.jcr.item.JCRTypeConverter

public class JCRTypeConverter
extends java.lang.Object

Responsible for converting Alfresco values to JCR values.


Constructor Summary
JCRTypeConverter(SessionImpl session)
          Construct
 
Method Summary
 boolean booleanValue(java.lang.Object value)
          Convert to JCR Boolean Value
 java.lang.Object convert(java.lang.Class c, java.lang.Object value)
          General conversion method using JCR converters
 java.lang.Object convert(org.alfresco.service.cmr.dictionary.DataTypeDefinition propertyType, java.lang.Object value)
          General conversion method using JCR converters
 java.util.Calendar dateValue(java.lang.Object value)
          Convert to JCR Date Value
 double doubleValue(java.lang.Object value)
          Convert to JCR Double Value
 org.alfresco.service.cmr.repository.datatype.TypeConverter getConverter()
          Get the underlying Converter
 long longValue(java.lang.Object value)
          Convert to JCR Long Value
 org.alfresco.service.namespace.QName nameValue(java.lang.Object value)
          Convert to JCR Name Value
 org.alfresco.service.cmr.repository.Path pathValue(java.lang.Object value)
          Convert to JCR Path Value
 NodeImpl referenceValue(java.lang.Object value)
          Convert to JCR Reference Value
 java.io.InputStream streamValue(java.lang.Object value)
          Convert to JCR Stream Value
 java.lang.String stringValue(java.lang.Object value)
          Convert to JCR String Value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JCRTypeConverter

public JCRTypeConverter(SessionImpl session)
Construct

Parameters:
session -
Method Detail

getConverter

public org.alfresco.service.cmr.repository.datatype.TypeConverter getConverter()
Get the underlying Converter

Returns:
type converter

referenceValue

public NodeImpl referenceValue(java.lang.Object value)
                        throws javax.jcr.ValueFormatException,
                               javax.jcr.RepositoryException
Convert to JCR Reference Value

Parameters:
session -
value -
Returns:
Throws:
javax.jcr.ValueFormatException
javax.jcr.RepositoryException

stringValue

public java.lang.String stringValue(java.lang.Object value)
                             throws javax.jcr.ValueFormatException,
                                    javax.jcr.RepositoryException
Convert to JCR String Value

Parameters:
value -
Returns:
Throws:
javax.jcr.ValueFormatException
javax.jcr.RepositoryException

streamValue

public java.io.InputStream streamValue(java.lang.Object value)
                                throws java.lang.IllegalStateException,
                                       javax.jcr.RepositoryException
Convert to JCR Stream Value

Parameters:
value -
Returns:
Throws:
java.lang.IllegalStateException
javax.jcr.RepositoryException

longValue

public long longValue(java.lang.Object value)
               throws javax.jcr.ValueFormatException,
                      java.lang.IllegalStateException,
                      javax.jcr.RepositoryException
Convert to JCR Long Value

Parameters:
value -
Returns:
Throws:
javax.jcr.ValueFormatException
java.lang.IllegalStateException
javax.jcr.RepositoryException

doubleValue

public double doubleValue(java.lang.Object value)
                   throws javax.jcr.ValueFormatException,
                          java.lang.IllegalStateException,
                          javax.jcr.RepositoryException
Convert to JCR Double Value

Parameters:
value -
Returns:
Throws:
javax.jcr.ValueFormatException
java.lang.IllegalStateException
javax.jcr.RepositoryException

dateValue

public java.util.Calendar dateValue(java.lang.Object value)
                             throws javax.jcr.ValueFormatException,
                                    java.lang.IllegalStateException,
                                    javax.jcr.RepositoryException
Convert to JCR Date Value

Parameters:
value -
Returns:
Throws:
javax.jcr.ValueFormatException
java.lang.IllegalStateException
javax.jcr.RepositoryException

booleanValue

public boolean booleanValue(java.lang.Object value)
                     throws javax.jcr.ValueFormatException,
                            java.lang.IllegalStateException,
                            javax.jcr.RepositoryException
Convert to JCR Boolean Value

Parameters:
value -
Returns:
Throws:
javax.jcr.ValueFormatException
java.lang.IllegalStateException
javax.jcr.RepositoryException

nameValue

public org.alfresco.service.namespace.QName nameValue(java.lang.Object value)
                                               throws javax.jcr.ValueFormatException,
                                                      java.lang.IllegalStateException,
                                                      javax.jcr.RepositoryException
Convert to JCR Name Value

Parameters:
value -
Returns:
Throws:
javax.jcr.ValueFormatException
java.lang.IllegalStateException
javax.jcr.RepositoryException

pathValue

public org.alfresco.service.cmr.repository.Path pathValue(java.lang.Object value)
                                                   throws javax.jcr.ValueFormatException,
                                                          java.lang.IllegalStateException,
                                                          javax.jcr.RepositoryException
Convert to JCR Path Value

Parameters:
value -
Returns:
Throws:
javax.jcr.ValueFormatException
java.lang.IllegalStateException
javax.jcr.RepositoryException

convert

public final java.lang.Object convert(org.alfresco.service.cmr.dictionary.DataTypeDefinition propertyType,
                                      java.lang.Object value)
                               throws javax.jcr.RepositoryException
General conversion method using JCR converters

Parameters:
propertyType - datatype to convert to
value - the value to convert
Returns:
the converted value
Throws:
javax.jcr.RepositoryException

convert

public final java.lang.Object convert(java.lang.Class c,
                                      java.lang.Object value)
                               throws javax.jcr.RepositoryException
General conversion method using JCR converters

Parameters:
c - class
value - value to convert
Returns:
converted value
Throws:
javax.jcr.RepositoryException


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.