You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2012/02/24 22:46:55 UTC

svn commit: r1293440 [5/5] - in /chemistry/opencmis/branches/android: ./ chemistry-opencmis-android/ chemistry-opencmis-android/chemistry-opencmis-android-client/ chemistry-opencmis-android/chemistry-opencmis-android-client/src/ chemistry-opencmis-andr...

Added: chemistry/opencmis/branches/android/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/AtomPubConverter.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/android/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/AtomPubConverter.java?rev=1293440&view=auto
==============================================================================
--- chemistry/opencmis/branches/android/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/AtomPubConverter.java (added)
+++ chemistry/opencmis/branches/android/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/AtomPubConverter.java Fri Feb 24 21:46:54 2012
@@ -0,0 +1,905 @@
+package org.apache.chemistry.opencmis.commons.impl;
+
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_ACLCAP_ACL_PROPAGATION;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_ACLCAP_SUPPORTED_PERMISSIONS;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_CAP_ACL;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_CAP_ALL_VERSIONS_SEARCHABLE;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_CAP_CHANGES;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_CAP_CONTENT_STREAM_UPDATES;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_CAP_GET_DESCENDANTS;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_CAP_GET_FOLDER_TREE;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_CAP_JOIN;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_CAP_MULTIFILING;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_CAP_PWC_SEARCHABLE;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_CAP_PWC_UPDATABLE;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_CAP_QUERY;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_CAP_RENDITIONS;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_CAP_UNFILING;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_CAP_VERSION_SPECIFIC_FILING;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_PROPERTY_TYPE_CARDINALITY;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_PROPERTY_TYPE_DESCRIPTION;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_PROPERTY_TYPE_DISPLAYNAME;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_PROPERTY_TYPE_INHERITED;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_PROPERTY_TYPE_LOCALNAME;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_PROPERTY_TYPE_LOCALNAMESPACE;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_PROPERTY_TYPE_MAX_LENGTH;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_PROPERTY_TYPE_MAX_VALUE;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_PROPERTY_TYPE_MIN_VALUE;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_PROPERTY_TYPE_OPENCHOICE;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_PROPERTY_TYPE_ORDERABLE;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_PROPERTY_TYPE_PRECISION;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_PROPERTY_TYPE_QUERYABLE;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_PROPERTY_TYPE_QUERYNAME;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_PROPERTY_TYPE_REQUIRED;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_PROPERTY_TYPE_RESOLUTION;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_PROPERTY_TYPE_UPDATABILITY;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_RENDITION_DOCUMENT_ID;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_RENDITION_HEIGHT;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_RENDITION_KIND;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_RENDITION_LENGTH;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_RENDITION_MIMETYPE;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_RENDITION_STREAM_ID;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_RENDITION_TITLE;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_RENDITION_WIDTH;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_REPINFO_CHANGES_INCOMPLETE;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_REPINFO_CHANGE_LOCK_TOKEN;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_REPINFO_CMIS_VERSION_SUPPORTED;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_REPINFO_DESCRIPTION;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_REPINFO_ID;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_REPINFO_NAME;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_REPINFO_PRODUCT;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_REPINFO_PRODUCT_VERSION;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_REPINFO_REPOSITORY_URL;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_REPINFO_ROOT_FOLDER_ID;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_REPINFO_ROOT_FOLDER_URL;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_REPINFO_THIN_CLIENT_URI;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_REPINFO_VENDOR;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_TYPE_CONTENTSTREAM_ALLOWED;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_TYPE_PARENT_ID;
+import static org.apache.chemistry.opencmis.commons.impl.JSONConstants.JSON_TYPE_VERSIONABLE;
+
+import java.lang.reflect.Method;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TimeZone;
+
+import org.apache.chemistry.opencmis.commons.data.Acl;
+import org.apache.chemistry.opencmis.commons.data.AclCapabilities;
+import org.apache.chemistry.opencmis.commons.data.AllowableActions;
+import org.apache.chemistry.opencmis.commons.data.ObjectData;
+import org.apache.chemistry.opencmis.commons.data.PermissionMapping;
+import org.apache.chemistry.opencmis.commons.data.Properties;
+import org.apache.chemistry.opencmis.commons.data.PropertyData;
+import org.apache.chemistry.opencmis.commons.data.RenditionData;
+import org.apache.chemistry.opencmis.commons.data.RepositoryCapabilities;
+import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
+import org.apache.chemistry.opencmis.commons.definitions.PermissionDefinition;
+import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition;
+import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
+import org.apache.chemistry.opencmis.commons.enums.AclPropagation;
+import org.apache.chemistry.opencmis.commons.enums.Action;
+import org.apache.chemistry.opencmis.commons.enums.AtomPropertyType;
+import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
+import org.apache.chemistry.opencmis.commons.enums.CapabilityAcl;
+import org.apache.chemistry.opencmis.commons.enums.CapabilityChanges;
+import org.apache.chemistry.opencmis.commons.enums.CapabilityContentStreamUpdates;
+import org.apache.chemistry.opencmis.commons.enums.CapabilityJoin;
+import org.apache.chemistry.opencmis.commons.enums.CapabilityQuery;
+import org.apache.chemistry.opencmis.commons.enums.CapabilityRenditions;
+import org.apache.chemistry.opencmis.commons.enums.Cardinality;
+import org.apache.chemistry.opencmis.commons.enums.ContentStreamAllowed;
+import org.apache.chemistry.opencmis.commons.enums.DateTimeResolution;
+import org.apache.chemistry.opencmis.commons.enums.DecimalPrecision;
+import org.apache.chemistry.opencmis.commons.enums.PropertyType;
+import org.apache.chemistry.opencmis.commons.enums.SupportedPermissions;
+import org.apache.chemistry.opencmis.commons.enums.Updatability;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.AbstractPropertyData;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.AbstractPropertyDefinition;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.AbstractTypeDefinition;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.AclCapabilitiesDataImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.AllowableActionsImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.DocumentTypeDefinitionImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.FolderTypeDefinitionImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.ObjectDataImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.PolicyTypeDefinitionImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertiesImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyBooleanDefinitionImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyBooleanImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyDateTimeDefinitionImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyDateTimeImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyDecimalDefinitionImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyDecimalImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyHtmlDefinitionImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyHtmlImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIdDefinitionImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIdImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIntegerDefinitionImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIntegerImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyStringDefinitionImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyStringImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyUriDefinitionImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyUriImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.RelationshipTypeDefinitionImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.RenditionDataImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.RepositoryCapabilitiesImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.RepositoryInfoBrowserBindingImpl;
+import org.xmlpull.v1.XmlPullParser;
+
+public class AtomPubConverter {
+
+    public static RepositoryInfo convertRepositoryInfo(Map<String, String> repositoryInfoRawValues,
+            Map<String, String> repositoryCapabilitiesRawValues, AclCapabilities aclCapabilities,
+            List<String> changesOnType) {
+        if (repositoryInfoRawValues == null || repositoryCapabilitiesRawValues == null) {
+            return null;
+        }
+
+        RepositoryInfoBrowserBindingImpl result = new RepositoryInfoBrowserBindingImpl();
+
+        result.setId(getString(repositoryInfoRawValues, JSON_REPINFO_ID));
+        result.setName(getString(repositoryInfoRawValues, JSON_REPINFO_NAME));
+        result.setDescription(getString(repositoryInfoRawValues, JSON_REPINFO_DESCRIPTION));
+        result.setVendorName(getString(repositoryInfoRawValues, JSON_REPINFO_VENDOR));
+        result.setProductName(getString(repositoryInfoRawValues, JSON_REPINFO_PRODUCT));
+        result.setProductVersion(getString(repositoryInfoRawValues, JSON_REPINFO_PRODUCT_VERSION));
+        result.setRootFolder(getString(repositoryInfoRawValues, JSON_REPINFO_ROOT_FOLDER_ID));
+        result.setRepositoryUrl(getString(repositoryInfoRawValues, JSON_REPINFO_REPOSITORY_URL));
+        result.setRootUrl(getString(repositoryInfoRawValues, JSON_REPINFO_ROOT_FOLDER_URL));
+        result.setCapabilities(convertRepositoryCapabilities(repositoryCapabilitiesRawValues));
+        result.setAclCapabilities(aclCapabilities);
+        result.setLatestChangeLogToken(getString(repositoryInfoRawValues, JSON_REPINFO_CHANGE_LOCK_TOKEN));
+        result.setCmisVersionSupported(getString(repositoryInfoRawValues, JSON_REPINFO_CMIS_VERSION_SUPPORTED));
+        result.setThinClientUri(getString(repositoryInfoRawValues, JSON_REPINFO_THIN_CLIENT_URI));
+        result.setChangesIncomplete(getBoolean(repositoryInfoRawValues, JSON_REPINFO_CHANGES_INCOMPLETE));
+
+        List<BaseTypeId> types = new ArrayList<BaseTypeId>();
+        if (changesOnType != null) {
+            for (Object type : changesOnType) {
+                if (type != null) {
+                    types.add(BaseTypeId.fromValue(type.toString()));
+                }
+            }
+        }
+        result.setChangesOnType(types);
+
+        result.setPrincipalAnonymous(getString(repositoryInfoRawValues, "principalAnonymous"));
+        result.setPrincipalAnyone(getString(repositoryInfoRawValues, "principalAnyone"));
+
+        // handle extensions
+        // convertExtension(json, result, REPINFO_KEYS);
+
+        return result;
+    }
+
+    public static RepositoryCapabilities convertRepositoryCapabilities(Map<String, String> values) {
+        if (values == null) {
+            return null;
+        }
+
+        RepositoryCapabilitiesImpl result = new RepositoryCapabilitiesImpl();
+
+        result.setCapabilityContentStreamUpdates(getEnum(values, JSON_CAP_CONTENT_STREAM_UPDATES,
+                CapabilityContentStreamUpdates.class));
+        result.setCapabilityChanges(getEnum(values, JSON_CAP_CHANGES, CapabilityChanges.class));
+        result.setCapabilityRendition(getEnum(values, JSON_CAP_RENDITIONS, CapabilityRenditions.class));
+        result.setSupportsGetDescendants(getBoolean(values, JSON_CAP_GET_DESCENDANTS));
+        result.setSupportsGetFolderTree(getBoolean(values, JSON_CAP_GET_FOLDER_TREE));
+        result.setSupportsMultifiling(getBoolean(values, JSON_CAP_MULTIFILING));
+        result.setSupportsUnfiling(getBoolean(values, JSON_CAP_UNFILING));
+        result.setSupportsVersionSpecificFiling(getBoolean(values, JSON_CAP_VERSION_SPECIFIC_FILING));
+        result.setIsPwcSearchable(getBoolean(values, JSON_CAP_PWC_SEARCHABLE));
+        result.setIsPwcUpdatable(getBoolean(values, JSON_CAP_PWC_UPDATABLE));
+        result.setAllVersionsSearchable(getBoolean(values, JSON_CAP_ALL_VERSIONS_SEARCHABLE));
+        result.setCapabilityQuery(getEnum(values, JSON_CAP_QUERY, CapabilityQuery.class));
+        result.setCapabilityJoin(getEnum(values, JSON_CAP_JOIN, CapabilityJoin.class));
+        result.setCapabilityAcl(getEnum(values, JSON_CAP_ACL, CapabilityAcl.class));
+
+        // handle extensions
+        // convertExtension(values, result, CAP_KEYS);
+
+        return result;
+    }
+
+    @SuppressWarnings("unchecked")
+    public static AclCapabilities convertAclCapabilities(Map<String, String> AclCapabilitiesRawValue,
+            List<PermissionDefinition> permissionDefinitionList, Map<String, PermissionMapping> permissionMapping) {
+        if (AclCapabilitiesRawValue == null) {
+            return null;
+        }
+
+        AclCapabilitiesDataImpl result = new AclCapabilitiesDataImpl();
+
+        result.setSupportedPermissions(getEnum(AclCapabilitiesRawValue, JSON_ACLCAP_SUPPORTED_PERMISSIONS,
+                SupportedPermissions.class));
+        result.setAclPropagation(getEnum(AclCapabilitiesRawValue, JSON_ACLCAP_ACL_PROPAGATION, AclPropagation.class));
+
+        if (permissionDefinitionList != null) {
+            result.setPermissionDefinitionData(permissionDefinitionList);
+        }
+
+        if (permissionMapping != null) {
+            result.setPermissionMappingData(permissionMapping);
+        }
+
+        // handle extensions
+        // convertExtension(json, result, ACLCAP_KEYS);
+
+        return result;
+    }
+
+    public static final String PROPERTY = "property";
+
+    /**
+     * Converts an object.
+     */
+    public static ObjectData convertObject(Properties properties, AllowableActions allowableActions, Acl acl,
+            List<RenditionData> renditions) {
+        if (properties == null) {
+            return null;
+        }
+
+        ObjectDataImpl result = new ObjectDataImpl();
+
+        // TODO ACL Is exact ?
+        result.setAcl(acl);
+        result.setAllowableActions(allowableActions);
+        /*
+         * Map<String, Object> jsonChangeEventInfo =
+         * getMap(json.get(JSON_OBJECT_CHANGE_EVENT_INFO)); if
+         * (jsonChangeEventInfo != null) { ChangeEventInfoDataImpl
+         * changeEventInfo = new ChangeEventInfoDataImpl();
+         * 
+         * changeEventInfo.setChangeTime(getDateTime(jsonChangeEventInfo,
+         * JSON_CHANGE_EVENT_TIME));
+         * changeEventInfo.setChangeType(getEnum(jsonChangeEventInfo,
+         * JSON_CHANGE_EVENT_TYPE, ChangeType.class));
+         * 
+         * convertExtension(json, result, CHANGE_EVENT_KEYS);
+         * 
+         * result.setChangeEventInfo(changeEventInfo); }
+         * result.setIsExactAcl(getBoolean(json, JSON_OBJECT_EXACT_ACL));
+         * result.
+         * setPolicyIds(convertPolicyIds(getList(json.get(JSON_OBJECT_POLICY_IDS
+         * ))));
+         */
+        result.setProperties(properties);
+        /*
+         * List<Object> jsonRelationships =
+         * getList(json.get(JSON_OBJECT_RELATIONSHIPS)); if (jsonRelationships
+         * != null) {
+         * result.setRelationships(convertObjects(jsonRelationships)); }
+         */
+        if (renditions != null) {
+            result.setRenditions(renditions);
+        }
+
+        // convertExtension(json, result, OBJECT_KEYS);
+
+        return result;
+    }
+
+    public static final String PROPERTY_DATATYPE = "type";
+    public static final String PROPERTY_DEFINITION_ID = "propertyDefinitionId";
+    public static final String PROPERTY_LOCALNAME = "localName";
+    public static final String PROPERTY_DISPLAYNAME = "displayName";
+    public static final String PROPERTY_QUERYNAME = "queryName";
+    public static final String PROPERTY_VALUE = "value";
+
+    /**
+     * Converts properties.
+     */
+    public static PropertyData<?> convertProperty(String propertyTypeValue, String id, String displayName,
+            String queryName, String localName, List<String> values) {
+
+        AbstractPropertyData<?> property = null;
+
+        AtomPropertyType propertyType = null;
+        try {
+            propertyType = AtomPropertyType.fromValue(propertyTypeValue);
+        } catch (Exception e) {
+            throw new CmisRuntimeException("Invalid property: " + id);
+        }
+
+        switch (propertyType) {
+        case STRING:
+            property = new PropertyStringImpl();
+            {
+                List<String> propertyValues = null;
+                if (values != null) {
+                    propertyValues = new ArrayList<String>();
+                    for (String obj : values) {
+                        propertyValues.add(obj);
+                    }
+                }
+                ((PropertyStringImpl) property).setValues(propertyValues);
+            }
+            break;
+        case ID:
+            property = new PropertyIdImpl();
+            {
+                List<String> propertyValues = null;
+                if (values != null) {
+                    propertyValues = new ArrayList<String>();
+                    for (String obj : values) {
+                        propertyValues.add(obj);
+                    }
+                }
+                ((PropertyIdImpl) property).setValues(propertyValues);
+            }
+            break;
+        case BOOLEAN:
+            property = new PropertyBooleanImpl();
+            {
+                List<Boolean> propertyValues = null;
+                if (values != null) {
+                    propertyValues = new ArrayList<Boolean>();
+                    for (String obj : values) {
+                        propertyValues.add(Boolean.parseBoolean(obj));
+                    }
+                }
+                ((PropertyBooleanImpl) property).setValues(propertyValues);
+            }
+            break;
+        case INTEGER:
+            property = new PropertyIntegerImpl();
+            {
+                List<BigInteger> propertyValues = null;
+                if (values != null) {
+                    propertyValues = new ArrayList<BigInteger>();
+                    for (String obj : values) {
+                        propertyValues.add(BigInteger.valueOf(Long.parseLong(obj)));
+                    }
+                }
+                ((PropertyIntegerImpl) property).setValues(propertyValues);
+            }
+            break;
+        case DECIMAL:
+            property = new PropertyDecimalImpl();
+            {
+                List<BigDecimal> propertyValues = null;
+                if (values != null) {
+                    propertyValues = new ArrayList<BigDecimal>();
+                    for (String obj : values) {
+                        propertyValues.add(BigDecimal.valueOf(Long.parseLong(obj)));
+                    }
+                }
+                ((PropertyDecimalImpl) property).setValues(propertyValues);
+            }
+            break;
+        case DATETIME:
+            property = new PropertyDateTimeImpl();
+            {
+                List<GregorianCalendar> propertyValues = null;
+                if (values != null) {
+                    propertyValues = new ArrayList<GregorianCalendar>();
+                    for (String obj : values) {
+                        GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
+                        cal.setTime(parseAtomPubDate(obj));
+                        propertyValues.add(cal);
+                    }
+                }
+                ((PropertyDateTimeImpl) property).setValues(propertyValues);
+            }
+            break;
+        case HTML:
+            property = new PropertyHtmlImpl();
+            {
+                List<String> propertyValues = null;
+                if (values != null) {
+                    propertyValues = new ArrayList<String>();
+                    for (String obj : values) {
+                        propertyValues.add(obj.toString());
+                    }
+                }
+                ((PropertyHtmlImpl) property).setValues(propertyValues);
+            }
+            break;
+        case URI:
+            property = new PropertyUriImpl();
+            {
+                List<String> propertyValues = null;
+                if (values != null) {
+                    propertyValues = new ArrayList<String>();
+                    for (Object obj : values) {
+                        propertyValues.add(obj.toString());
+                    }
+                }
+                ((PropertyUriImpl) property).setValues(propertyValues);
+            }
+            break;
+        }
+
+        property.setId(id);
+        property.setDisplayName(displayName);
+        property.setQueryName(queryName);
+        property.setLocalName(localName);
+
+        return property;
+    }
+
+    public static Properties convertProperties(List<PropertyData<?>> props) {
+        if (props == null) {
+            return null;
+        }
+
+        PropertiesImpl result = new PropertiesImpl();
+
+        for (PropertyData<?> propertyData : props) {
+            result.addProperty(propertyData);
+        }
+
+        return result;
+    }
+
+    /**
+     * Converts properties.
+     * 
+     * public static Properties convertProperties(XmlPullParser parser) { if
+     * (parser == null) { return null; }
+     * 
+     * PropertiesImpl result = new PropertiesImpl();
+     * 
+     * try { int eventType = parser.getEventType(); String name =
+     * parser.getName(); String nameSpace = parser.getNamespace(); int
+     * countParam = 0; String id = null, displayName = null, queryName = null,
+     * localName = null, paramName = null, tag = null; List<String> values =
+     * null;
+     * 
+     * while (!(eventType == XmlPullParser.END_TAG &&
+     * Constants.SELECTOR_PROPERTIES.equals(name))) { switch (eventType) { case
+     * XmlPullParser.START_TAG:
+     * 
+     * if (!Constants.NAMESPACE_CMIS.equals(nameSpace)){ skip(parser); eventType
+     * = parser.getEventType(); name = parser.getName(); nameSpace =
+     * parser.getNamespace(); continue; }
+     * 
+     * AbstractPropertyData<?> property = null;
+     * 
+     * AtomPropertyType propertyType = null; try { propertyType =
+     * AtomPropertyType.fromValue(name); tag = name; } catch (Exception e) {
+     * throw new CmisRuntimeException("Invalid property: " + id); }
+     * 
+     * countParam = parser.getAttributeCount(); displayName = null; queryName =
+     * null; localName = null; paramName = null; for (int i = 0; i < countParam;
+     * i++) { paramName = parser.getAttributeName(i); if
+     * (JSON_PROPERTY_DISPLAYNAME.equals(paramName)) { displayName =
+     * parser.getAttributeValue(i); } else if
+     * (JSON_PROPERTY_QUERYNAME.equals(paramName)) { queryName =
+     * parser.getAttributeValue(i); } else if
+     * (JSON_PROPERTY_LOCALNAME.equals(paramName)) { localName =
+     * parser.getAttributeValue(i); } else if
+     * (PROPERTY_DEFINITION_ID.equals(paramName)) { id =
+     * parser.getAttributeValue(i); } }
+     * 
+     * values = new ArrayList<String>(2); while (!(eventType ==
+     * XmlPullParser.END_TAG && tag.equals(name))) { switch (eventType) { case
+     * XmlPullParser.START_TAG: if (JSON_PROPERTY_VALUE.equals(name)) {
+     * parser.next(); values.add(parser.getText()); } break; } eventType =
+     * parser.next(); name = parser.getName(); }
+     * 
+     * switch (propertyType) { case STRING: property = new PropertyStringImpl();
+     * { List<String> propertyValues = null; if (values != null) {
+     * propertyValues = new ArrayList<String>(); for (String obj : values) {
+     * propertyValues.add(obj); } } ((PropertyStringImpl)
+     * property).setValues(propertyValues); } break; case ID: property = new
+     * PropertyIdImpl(); { List<String> propertyValues = null; if (values !=
+     * null) { propertyValues = new ArrayList<String>(); for (String obj :
+     * values) { propertyValues.add(obj); } } ((PropertyIdImpl)
+     * property).setValues(propertyValues); } break; case BOOLEAN: property =
+     * new PropertyBooleanImpl(); { List<Boolean> propertyValues = null; if
+     * (values != null) { propertyValues = new ArrayList<Boolean>(); for (String
+     * obj : values) { propertyValues.add(Boolean.parseBoolean(obj)); } }
+     * ((PropertyBooleanImpl) property).setValues(propertyValues); } break; case
+     * INTEGER: property = new PropertyIntegerImpl(); { List<BigInteger>
+     * propertyValues = null; if (values != null) { propertyValues = new
+     * ArrayList<BigInteger>(); for (String obj : values) {
+     * propertyValues.add(BigInteger.valueOf(Long.parseLong(obj))); } }
+     * ((PropertyIntegerImpl) property).setValues(propertyValues); } break; case
+     * DECIMAL: property = new PropertyDecimalImpl(); { List<BigDecimal>
+     * propertyValues = null; if (values != null) { propertyValues = new
+     * ArrayList<BigDecimal>(); for (String obj : values) {
+     * propertyValues.add(BigDecimal.valueOf(Long.parseLong(obj))); } }
+     * ((PropertyDecimalImpl) property).setValues(propertyValues); } break; case
+     * DATETIME: property = new PropertyDateTimeImpl(); {
+     * List<GregorianCalendar> propertyValues = null; if (values != null) {
+     * propertyValues = new ArrayList<GregorianCalendar>(); for (String obj :
+     * values) { GregorianCalendar cal = new
+     * GregorianCalendar(TimeZone.getTimeZone("UTC"));
+     * cal.setTime(parseAtomPubDate(obj)); propertyValues.add(cal); } }
+     * ((PropertyDateTimeImpl) property).setValues(propertyValues); } break;
+     * case HTML: property = new PropertyHtmlImpl(); { List<String>
+     * propertyValues = null; if (values != null) { propertyValues = new
+     * ArrayList<String>(); for (String obj : values) {
+     * propertyValues.add(obj.toString()); } } ((PropertyHtmlImpl)
+     * property).setValues(propertyValues); } break; case URI: property = new
+     * PropertyUriImpl(); { List<String> propertyValues = null; if (values !=
+     * null) { propertyValues = new ArrayList<String>(); for (Object obj :
+     * values) { propertyValues.add(obj.toString()); } } ((PropertyUriImpl)
+     * property).setValues(propertyValues); } break; }
+     * 
+     * property.setId(id); property.setDisplayName(displayName);
+     * property.setQueryName(queryName); property.setLocalName(localName);
+     * result.addProperty(property); //System.out.println("SIZE PROPS" +
+     * result.getPropertyList().size());
+     * 
+     * break;
+     * 
+     * } eventType = parser.next(); name = parser.getName(); nameSpace =
+     * parser.getNamespace(); } } catch (Exception e) { e.printStackTrace(); }
+     * 
+     * return result; }
+     */
+
+    /**
+     * Converts allowable actions.
+     */
+    public static AllowableActions convertAllowableActions(Map<String, String> rawValues) {
+        if (rawValues == null) {
+            return null;
+        }
+
+        AllowableActionsImpl result = new AllowableActionsImpl();
+        Set<Action> allowableActions = new HashSet<Action>();
+
+        for (Action action : Action.values()) {
+            Boolean value = getBoolean(rawValues, action.value());
+            if (value != null && value.booleanValue()) {
+                allowableActions.add(action);
+            }
+        }
+
+        result.setAllowableActions(allowableActions);
+
+        // convertExtension(json, result, ALLOWABLE_ACTIONS_KEYS);
+
+        return result;
+    }
+
+    /**
+     * Converts a rendition.
+     */
+    public static RenditionData convertRendition(Map<String, String> json) {
+        if (json == null) {
+            return null;
+        }
+
+        RenditionDataImpl result = new RenditionDataImpl();
+
+        result.setBigHeight(getInteger(json, JSON_RENDITION_HEIGHT));
+        result.setKind(getString(json, JSON_RENDITION_KIND));
+        result.setBigLength(getInteger(json, JSON_RENDITION_LENGTH));
+        result.setMimeType(getString(json, JSON_RENDITION_MIMETYPE));
+        result.setRenditionDocumentId(getString(json, JSON_RENDITION_DOCUMENT_ID));
+        result.setStreamId(getString(json, JSON_RENDITION_STREAM_ID));
+        result.setTitle(getString(json, JSON_RENDITION_TITLE));
+        result.setBigWidth(getInteger(json, JSON_RENDITION_WIDTH));
+
+        // convertExtension(json, result, RENDITION_KEYS);
+
+        return result;
+    }
+
+    @SuppressWarnings("unchecked")
+    public static TypeDefinition convertTypeDefinition(BaseTypeId baseType, Map<String, String> definitionRawValues,
+            List<PropertyDefinition<?>> propertyDefinitionList) {
+        if (definitionRawValues == null || propertyDefinitionList == null) {
+            return null;
+        }
+
+        AbstractTypeDefinition result = null;
+
+        switch (baseType) {
+        case CMIS_FOLDER:
+            result = new FolderTypeDefinitionImpl();
+            break;
+        case CMIS_DOCUMENT:
+            result = new DocumentTypeDefinitionImpl();
+            ((DocumentTypeDefinitionImpl) result).setContentStreamAllowed(getEnum(definitionRawValues,
+                    JSON_TYPE_CONTENTSTREAM_ALLOWED, ContentStreamAllowed.class));
+            ((DocumentTypeDefinitionImpl) result).setIsVersionable(getBoolean(definitionRawValues,
+                    JSON_TYPE_VERSIONABLE));
+            break;
+        case CMIS_RELATIONSHIP:
+            result = new RelationshipTypeDefinitionImpl();
+
+            /*
+             * Object allowedSourceTypes =
+             * json.get(JSON_TYPE_ALLOWED_SOURCE_TYPES); if (allowedSourceTypes
+             * instanceof List) { List<String> types = new ArrayList<String>();
+             * for (Object type : ((List<Object>) allowedSourceTypes)) { if
+             * (type != null) { types.add(type.toString()); } }
+             * 
+             * ((RelationshipTypeDefinitionImpl)
+             * result).setAllowedSourceTypes(types); }
+             * 
+             * Object allowedTargetTypes =
+             * json.get(JSON_TYPE_ALLOWED_TARGET_TYPES); if (allowedTargetTypes
+             * instanceof List) { List<String> types = new ArrayList<String>();
+             * for (Object type : ((List<Object>) allowedTargetTypes)) { if
+             * (type != null) { types.add(type.toString()); } }
+             * 
+             * ((RelationshipTypeDefinitionImpl)
+             * result).setAllowedTargetTypes(types); }
+             */
+
+            break;
+        case CMIS_POLICY:
+            result = new PolicyTypeDefinitionImpl();
+            break;
+        default:
+            throw new CmisRuntimeException("Type '" + baseType + "' does not match a base type!");
+        }
+
+        result.setId(getString(definitionRawValues, JSONConstants.JSON_TYPE_ID));
+        result.setLocalName(getString(definitionRawValues, JSONConstants.JSON_TYPE_LOCALNAME));
+        result.setLocalNamespace(getString(definitionRawValues, JSONConstants.JSON_TYPE_LOCALNAMESPACE));
+        result.setDisplayName(getString(definitionRawValues, JSONConstants.JSON_TYPE_DISPLAYNAME));
+        result.setQueryName(getString(definitionRawValues, JSONConstants.JSON_TYPE_QUERYNAME));
+        result.setDescription(getString(definitionRawValues, JSONConstants.JSON_TYPE_DESCRIPTION));
+        result.setBaseTypeId(getEnum(definitionRawValues, JSONConstants.JSON_TYPE_BASE_ID, BaseTypeId.class));
+        result.setIsCreatable(getBoolean(definitionRawValues, JSONConstants.JSON_TYPE_CREATABLE));
+        result.setIsFileable(getBoolean(definitionRawValues, JSONConstants.JSON_TYPE_FILEABLE));
+        result.setIsQueryable(getBoolean(definitionRawValues, JSONConstants.JSON_TYPE_QUERYABLE));
+        result.setIsFulltextIndexed(getBoolean(definitionRawValues, JSONConstants.JSON_TYPE_FULLTEXT_INDEXED));
+        result.setIsIncludedInSupertypeQuery(getBoolean(definitionRawValues,
+                JSONConstants.JSON_TYPE_INCLUDE_IN_SUPERTYPE_QUERY));
+        result.setIsControllablePolicy(getBoolean(definitionRawValues, JSONConstants.JSON_TYPE_CONTROLABLE_POLICY));
+        result.setIsControllableAcl(getBoolean(definitionRawValues, JSONConstants.JSON_TYPE_CONTROLABLE_ACL));
+        result.setParentTypeId(getString(definitionRawValues, JSON_TYPE_PARENT_ID));
+
+        if (propertyDefinitionList != null) {
+            for (PropertyDefinition<?> propertyDefinition : propertyDefinitionList) {
+                result.addPropertyDefinition(propertyDefinition);
+            }
+        }
+
+        // handle extensions
+        // convertExtension(json, result, TYPE_KEYS);
+
+        return result;
+    }
+
+    @SuppressWarnings({ "unchecked", "rawtypes" })
+    public static PropertyDefinition<?> convertPropertyDefinition(String id, Map<String, String> propertyTypeRawValues) {
+        if (propertyTypeRawValues == null) {
+            return null;
+        }
+
+        AbstractPropertyDefinition<?> result = null;
+
+        // find property type
+        PropertyType propertyType = PropertyType.fromValue(id.replace(PROPERTY, "").replace("Definition", "")
+                .toLowerCase());
+        if (propertyType == null) {
+            throw new CmisRuntimeException("Invalid property type '" + id + "'! Data type not set!");
+        }
+
+        // find
+        Cardinality cardinality = getEnum(propertyTypeRawValues, JSON_PROPERTY_TYPE_CARDINALITY, Cardinality.class);
+        if (cardinality == null) {
+            throw new CmisRuntimeException("Invalid property type '" + id + "'! Cardinality not set!");
+        }
+
+        switch (propertyType) {
+        case STRING:
+            result = new PropertyStringDefinitionImpl();
+            ((PropertyStringDefinitionImpl) result).setMaxLength(getInteger(propertyTypeRawValues,
+                    JSON_PROPERTY_TYPE_MAX_LENGTH));
+            // ((PropertyStringDefinitionImpl)
+            // result).setChoices(convertChoicesString(json.get(JSON_PROPERTY_TYPE_CHOICE)));
+            break;
+        case ID:
+            result = new PropertyIdDefinitionImpl();
+            // ((PropertyIdDefinitionImpl)
+            // result).setChoices(convertChoicesString(json.get(JSON_PROPERTY_TYPE_CHOICE)));
+            break;
+        case BOOLEAN:
+            result = new PropertyBooleanDefinitionImpl();
+            // ((PropertyBooleanDefinitionImpl)
+            // result).setChoices(convertChoicesBoolean(json.get(JSON_PROPERTY_TYPE_CHOICE)));
+            break;
+        case INTEGER:
+            result = new PropertyIntegerDefinitionImpl();
+            ((PropertyIntegerDefinitionImpl) result).setMinValue(getInteger(propertyTypeRawValues,
+                    JSON_PROPERTY_TYPE_MIN_VALUE));
+            ((PropertyIntegerDefinitionImpl) result).setMaxValue(getInteger(propertyTypeRawValues,
+                    JSON_PROPERTY_TYPE_MAX_VALUE));
+            // ((PropertyIntegerDefinitionImpl)
+            // result).setChoices(convertChoicesInteger(json.get(JSON_PROPERTY_TYPE_CHOICE)));
+            break;
+        case DATETIME:
+            result = new PropertyDateTimeDefinitionImpl();
+            ((PropertyDateTimeDefinitionImpl) result).setDateTimeResolution(getEnum(propertyTypeRawValues,
+                    JSON_PROPERTY_TYPE_RESOLUTION, DateTimeResolution.class));
+            // ((PropertyDateTimeDefinitionImpl)
+            // result).setChoices(convertChoicesDateTime(json.get(JSON_PROPERTY_TYPE_CHOICE)));
+            break;
+        case DECIMAL:
+            result = new PropertyDecimalDefinitionImpl();
+            ((PropertyDecimalDefinitionImpl) result).setMinValue(getDecimal(propertyTypeRawValues,
+                    JSON_PROPERTY_TYPE_MIN_VALUE));
+            ((PropertyDecimalDefinitionImpl) result).setMaxValue(getDecimal(propertyTypeRawValues,
+                    JSON_PROPERTY_TYPE_MAX_VALUE));
+            ((PropertyDecimalDefinitionImpl) result).setPrecision(getEnum(propertyTypeRawValues,
+                    JSON_PROPERTY_TYPE_PRECISION, DecimalPrecision.class));
+            // ((PropertyDecimalDefinitionImpl)
+            // result).setChoices(convertChoicesDecimal(json.get(JSON_PROPERTY_TYPE_CHOICE)));
+            break;
+        case HTML:
+            result = new PropertyHtmlDefinitionImpl();
+            // ((PropertyHtmlDefinitionImpl)
+            // result).setChoices(convertChoicesString(json.get(JSON_PROPERTY_TYPE_CHOICE)));
+            break;
+        case URI:
+            result = new PropertyUriDefinitionImpl();
+            // ((PropertyUriDefinitionImpl)
+            // result).setChoices(convertChoicesString(json.get(JSON_PROPERTY_TYPE_CHOICE)));
+            break;
+        default:
+            throw new CmisRuntimeException("Property type '" + id + "' does not match a data type!");
+        }
+
+        /*
+         * default value Object defaultValue =
+         * json.get(JSON_PROPERTY_TYPE_DEAULT_VALUE); if (defaultValue != null)
+         * { if (defaultValue instanceof List) { List values = new ArrayList();
+         * for (Object value : (List) defaultValue) {
+         * values.add(getCMISValue(value, propertyType)); }
+         * result.setDefaultValue(values); } else {
+         * result.setDefaultValue((List)
+         * Collections.singletonList(getCMISValue(defaultValue, propertyType)));
+         * } }
+         */
+
+        // generic
+        result.setId(getString(propertyTypeRawValues, JSONConstants.JSON_PROPERTY_TYPE_ID));
+        result.setPropertyType(propertyType);
+        result.setCardinality(cardinality);
+        result.setLocalName(getString(propertyTypeRawValues, JSON_PROPERTY_TYPE_LOCALNAME));
+        result.setLocalNamespace(getString(propertyTypeRawValues, JSON_PROPERTY_TYPE_LOCALNAMESPACE));
+        result.setQueryName(getString(propertyTypeRawValues, JSON_PROPERTY_TYPE_QUERYNAME));
+        result.setDescription(getString(propertyTypeRawValues, JSON_PROPERTY_TYPE_DESCRIPTION));
+        result.setDisplayName(getString(propertyTypeRawValues, JSON_PROPERTY_TYPE_DISPLAYNAME));
+        result.setIsInherited(getBoolean(propertyTypeRawValues, JSON_PROPERTY_TYPE_INHERITED));
+        result.setIsOpenChoice(getBoolean(propertyTypeRawValues, JSON_PROPERTY_TYPE_OPENCHOICE));
+        result.setIsOrderable(getBoolean(propertyTypeRawValues, JSON_PROPERTY_TYPE_ORDERABLE));
+        result.setIsQueryable(getBoolean(propertyTypeRawValues, JSON_PROPERTY_TYPE_QUERYABLE));
+        result.setIsRequired(getBoolean(propertyTypeRawValues, JSON_PROPERTY_TYPE_REQUIRED));
+        result.setUpdatability(getEnum(propertyTypeRawValues, JSON_PROPERTY_TYPE_UPDATABILITY, Updatability.class));
+
+        // handle extensions
+        // convertExtension(json, result, PROPERTY_TYPE_KEYS);
+
+        return result;
+    }
+
+    // -----------------------------------------------------------------
+
+    private static BigDecimal getDecimal(Map<String, String> values, String key) {
+        return (values.get(key) == null || values.get(key).isEmpty()) ? null : BigDecimal.valueOf(Long.parseLong(values
+                .get(key)));
+    }
+
+    private static Boolean getBoolean(Map<String, String> values, String key) {
+        return (values.get(key) == null || values.get(key).isEmpty()) ? null : Boolean.parseBoolean(values.get(key));
+    }
+
+    private static String getString(Map<String, String> values, String key) {
+        return (values.get(key) == null || values.get(key).isEmpty()) ? null : values.get(key);
+    }
+
+    private static BigInteger getInteger(Map<String, String> values, String key) {
+        return (values.get(key) == null || values.get(key).isEmpty()) ? null : BigInteger.valueOf(Long.parseLong(values
+                .get(key)));
+    }
+
+    @SuppressWarnings("unchecked")
+    public static <T extends Enum<T>> T getEnum(
+            @SuppressWarnings("rawtypes") Map<String, String> repositoryCapabilitiesRawValues, String key,
+            Class<T> clazz) {
+        String value = getString(repositoryCapabilitiesRawValues, key);
+        if (value == null) {
+            return null;
+        }
+
+        try {
+            Method m = clazz.getMethod("fromValue", String.class);
+            return (T) m.invoke(null, value);
+        } catch (Exception e) {
+            if (e instanceof IllegalArgumentException) {
+                return null;
+            } else {
+                throw new CmisRuntimeException("Could not parse enum value!", e);
+            }
+        }
+    }
+
+    // -----------------------------------------------------------------
+
+    /*
+     * @SuppressWarnings("unchecked") public static void
+     * convertExtension(Map<String, String> source, ExtensionsData target,
+     * Set<String> cmisKeys) { if (source == null) { return; }
+     * 
+     * List<CmisExtensionElement> extensions = null;
+     * 
+     * for (Map.Entry<String, String> element : source.entrySet()) { if
+     * (cmisKeys.contains(element.getKey())) { continue; }
+     * 
+     * if (extensions == null) { extensions = new
+     * ArrayList<CmisExtensionElement>(); }
+     * 
+     * if (element.getValue() instanceof Map) { extensions.add(new
+     * CmisExtensionElementImpl(null, element.getKey(), null,
+     * convertExtension((Map<String, Object>) element.getValue()))); } else if
+     * (element.getValue() instanceof List) { extensions.add(new
+     * CmisExtensionElementImpl(null, element.getKey(), null,
+     * convertExtension((List<Object>) element.getValue()))); } else { String
+     * value = (element.getValue() == null ? null :
+     * element.getValue().toString()); extensions.add(new
+     * CmisExtensionElementImpl(null, element.getKey(), null, value)); } }
+     * 
+     * target.setExtensions(extensions); }
+     */
+
+    // -----------------------------------------------------------------
+
+    private static Date parseAtomPubDate(String atomPubDate) {
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
+        // sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
+        sdf.setLenient(true);
+        Date d = null;
+
+        try {
+            d = sdf.parse(atomPubDate);
+        } catch (ParseException e) {
+            try {
+                sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
+                d = sdf.parse(atomPubDate);
+            } catch (ParseException ee) {
+                try {
+                    sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
+                    d = sdf.parse(atomPubDate);
+                } catch (ParseException eee) {
+                    eee.printStackTrace();
+                }
+            }
+        }
+        return d;
+    }
+
+    /**
+     * Skips a tag or subtree.
+     */
+    private static void skip(XmlPullParser parser) throws Exception {
+        int level = 1;
+        while (next(parser)) {
+            int event = parser.getEventType();
+            if (event == XmlPullParser.START_TAG) {
+                level++;
+            } else if (event == XmlPullParser.END_TAG) {
+                level--;
+                if (level == 0) {
+                    break;
+                }
+            }
+        }
+
+        next(parser);
+    }
+
+    private static boolean next(XmlPullParser parser) throws Exception {
+        parser.next();
+        return true;
+    }
+}

Propchange: chemistry/opencmis/branches/android/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/AtomPubConverter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: chemistry/opencmis/branches/android/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/StandardAuthenticationProvider.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/android/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/StandardAuthenticationProvider.java?rev=1293440&r1=1293439&r2=1293440&view=diff
==============================================================================
--- chemistry/opencmis/branches/android/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/StandardAuthenticationProvider.java (original)
+++ chemistry/opencmis/branches/android/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/StandardAuthenticationProvider.java Fri Feb 24 21:46:54 2012
@@ -143,28 +143,28 @@ public class StandardAuthenticationProvi
             wsseSecurityElement.appendChild(wsuTimestampElement);
 
             Element tsCreatedElement = document.createElementNS(WSU_NAMESPACE, "Created");
-            tsCreatedElement.setTextContent(sdf.format(created));
+            tsCreatedElement.appendChild(document.createTextNode(sdf.format(created)));
             wsuTimestampElement.appendChild(tsCreatedElement);
 
             Element tsExpiresElement = document.createElementNS(WSU_NAMESPACE, "Expires");
-            tsExpiresElement.setTextContent(sdf.format(expires));
+            tsExpiresElement.appendChild(document.createTextNode(sdf.format(expires)));
             wsuTimestampElement.appendChild(tsExpiresElement);
 
             Element usernameTokenElement = document.createElementNS(WSSE_NAMESPACE, "UsernameToken");
             wsseSecurityElement.appendChild(usernameTokenElement);
 
             Element usernameElement = document.createElementNS(WSSE_NAMESPACE, "Username");
-            usernameElement.setTextContent(user);
+            usernameElement.appendChild(document.createTextNode(user));
             usernameTokenElement.appendChild(usernameElement);
 
             Element passwordElement = document.createElementNS(WSSE_NAMESPACE, "Password");
-            passwordElement.setTextContent(password);
+            passwordElement.appendChild(document.createTextNode(password));
             passwordElement.setAttribute("Type",
                     "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText");
             usernameTokenElement.appendChild(passwordElement);
 
             Element createdElement = document.createElementNS(WSU_NAMESPACE, "Created");
-            createdElement.setTextContent(sdf.format(created));
+            createdElement.appendChild(document.createTextNode(sdf.format(created)));
             usernameTokenElement.appendChild(createdElement);
 
             return wsseSecurityElement;

Modified: chemistry/opencmis/branches/android/pom.xml
URL: http://svn.apache.org/viewvc/chemistry/opencmis/branches/android/pom.xml?rev=1293440&r1=1293439&r2=1293440&view=diff
==============================================================================
--- chemistry/opencmis/branches/android/pom.xml (original)
+++ chemistry/opencmis/branches/android/pom.xml Fri Feb 24 21:46:54 2012
@@ -180,6 +180,7 @@
         <module>chemistry-opencmis-client/chemistry-opencmis-client-impl</module>
         <module>chemistry-opencmis-client/chemistry-opencmis-client-bindings</module>
         <module>chemistry-opencmis-client/chemistry-opencmis-client-bindings-websphere</module>
+        <module>chemistry-opencmis-android/chemistry-opencmis-android-client</module>
         <module>chemistry-opencmis-server/chemistry-opencmis-server-support</module>
         <module>chemistry-opencmis-server/chemistry-opencmis-server-bindings</module>
         <module>chemistry-opencmis-server/chemistry-opencmis-server-inmemory</module>