[alfresco-opencmis-extension] r21 committed - Diff between Trunk & Branch. Remove some dependencies that are not pre...

6 views
Skip to first unread message

alfresco-opencmis-exte...@codespot.com

unread,
Jan 31, 2013, 8:15:16 AM1/31/13
to alfresco-opencmis...@googlegroups.com
Revision: 21
Author: jeanmari...@alfresco.com
Date: Thu Jan 31 05:15:00 2013
Log: Diff between Trunk & Branch. Remove some dependencies that are
not present inside Android SDK + Make classes serializable.
http://code.google.com/a/apache-extras.org/p/alfresco-opencmis-extension/source/detail?r=21

Added:
/branches/android/src/main/java/org/alfresco/cmis/client/impl/utils

/branches/android/src/main/java/org/alfresco/cmis/client/impl/utils/DateUtils.java
Deleted:
/branches/android/src/main/java/org/alfresco/cmis/client/authentication
Modified:
/branches/android
/branches/android/pom.xml

/branches/android/src/main/java/org/alfresco/cmis/client/AlfrescoAspects.java

/branches/android/src/main/java/org/alfresco/cmis/client/impl/AlfrescoAspectsImpl.java

/branches/android/src/main/java/org/alfresco/cmis/client/impl/AlfrescoObjectFactoryImpl.java

/branches/android/src/main/java/org/alfresco/cmis/client/impl/AlfrescoUtils.java

/branches/android/src/test/org/alfresco/cmis/client/test/CMISClientTest.java

=======================================
--- /dev/null
+++
/branches/android/src/main/java/org/alfresco/cmis/client/impl/utils/DateUtils.java
Thu Jan 31 05:15:00 2013
@@ -0,0 +1,66 @@
+package org.alfresco.cmis.client.impl.utils;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.Locale;
+
+public class DateUtils
+{
+ public static final String FORMAT_1 = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
+ public static final String FORMAT_2 = "yyyy-MM-dd'T'HH:mm:ss'Z'";
+ public static final String FORMAT_3 = "yyyy-MM-dd'T'HH:mm:ss.SSSZ";
+ public static final String FORMAT_4 = "MMM dd yyyy HH:mm:ss zzzz";
+
+ private static final String[] DATE_FORMATS = { FORMAT_1, FORMAT_2,
FORMAT_3, FORMAT_4 };
+
+
+ public static Date parseJsonDate(String jsonDate)
+ {
+ return parseDate(jsonDate, FORMAT_4);
+ }
+
+ public static Date parseDate(String atomPubDate)
+ {
+ Date d = null;
+ SimpleDateFormat sdf;
+ for (int i = 0; i < DATE_FORMATS.length; i++)
+ {
+ sdf = new SimpleDateFormat(DATE_FORMATS[i], Locale.UK);
+ sdf.setLenient(true);
+ try
+ {
+ d = sdf.parse(atomPubDate);
+ break;
+ }
+ catch (ParseException e)
+ {
+ continue;
+ }
+ }
+
+ return d;
+ }
+
+ public static Date parseDate(String date, String format)
+ {
+ Date d = null;
+ SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.UK);
+ sdf.setLenient(true);
+ try
+ {
+ d = sdf.parse(date);
+ }
+ catch (ParseException e)
+ {
+ d = parseDate(date);
+ }
+ return d;
+ }
+
+
+ public static String format(GregorianCalendar calendar){
+ return new SimpleDateFormat(FORMAT_1).format(calendar.getTime());
+ }
+}
=======================================
--- /branches/android/pom.xml Tue Oct 30 12:25:57 2012
+++ /branches/android/pom.xml Thu Jan 31 05:15:00 2013
@@ -20,7 +20,7 @@
<groupId>org.alfresco.cmis.client</groupId>
<artifactId>alfresco-opencmis-extension</artifactId>
<name>Alfresco OpenCMIS Extension</name>
- <version>0.4</version>
+ <version>0.4-ANDROID-2</version>
<packaging>jar</packaging>

<organization>
@@ -64,18 +64,19 @@
</mailingList>
</mailingLists>

+
<distributionManagement>
<repository>
- <id>maven.alfresco.com</id>
+ <id>alfresco-internal</id>
<name>Alfresco Maven Repository</name>
-
<url>http://maven.alfresco.com/nexus/content/repositories/releases</url>
+
<url>https://artifacts.alfresco.com/nexus/content/repositories/internal-releases</url>
</repository>
</distributionManagement>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <maven.compile.source>1.5</maven.compile.source>
- <maven.compile.target>1.5</maven.compile.target>
+ <maven.compile.source>1.6</maven.compile.source>
+ <maven.compile.target>1.6</maven.compile.target>
</properties>


@@ -127,30 +128,6 @@
<workspace>..</workspace>
</configuration>
</plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-sources</id>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-javadocs</id>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
</plugins>
</build>

@@ -160,30 +137,5 @@
<artifactId>chemistry-opencmis-client-impl</artifactId>
<version>0.8.0</version>
</dependency>
- <dependency>
- <groupId>org.apache.chemistry.opencmis</groupId>
- <artifactId>chemistry-opencmis-client-api</artifactId>
- <version>0.8.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.chemistry.opencmis</groupId>
- <artifactId>chemistry-opencmis-commons-impl</artifactId>
- <version>0.8.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.chemistry.opencmis</groupId>
- <artifactId>chemistry-opencmis-commons-api</artifactId>
- <version>0.8.0</version>
- </dependency>
- <dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- <version>3.1</version>
- </dependency>
- <dependency>
- <groupId>com.googlecode.json-simple</groupId>
- <artifactId>json-simple</artifactId>
- <version>1.1</version>
- </dependency>
</dependencies>
</project>
=======================================
---
/branches/android/src/main/java/org/alfresco/cmis/client/AlfrescoAspects.java
Mon Nov 7 10:53:15 2011
+++
/branches/android/src/main/java/org/alfresco/cmis/client/AlfrescoAspects.java
Thu Jan 31 05:15:00 2013
@@ -15,6 +15,7 @@
*/
package org.alfresco.cmis.client;

+import java.io.Serializable;
import java.util.Collection;
import java.util.Map;

@@ -23,7 +24,7 @@
/**
* Alfresco aspects interface.
*/
-public interface AlfrescoAspects {
+public interface AlfrescoAspects extends Serializable {

/**
* Returns a type definition with the applied aspects.
=======================================
---
/branches/android/src/main/java/org/alfresco/cmis/client/impl/AlfrescoAspectsImpl.java
Fri Feb 17 09:34:36 2012
+++
/branches/android/src/main/java/org/alfresco/cmis/client/impl/AlfrescoAspectsImpl.java
Thu Jan 31 05:15:00 2013
@@ -31,9 +31,11 @@
import org.apache.chemistry.opencmis.commons.enums.ExtensionLevel;

public class AlfrescoAspectsImpl implements AlfrescoAspects {
- private Session session;
+ private Session session;
private CmisObject object;
private Map<String, ObjectType> aspectTypes;
+
+ private static final long serialVersionUID = 1L;

public AlfrescoAspectsImpl(Session session, CmisObject object) {
this.session = session;
=======================================
---
/branches/android/src/main/java/org/alfresco/cmis/client/impl/AlfrescoObjectFactoryImpl.java
Fri Feb 17 09:34:36 2012
+++
/branches/android/src/main/java/org/alfresco/cmis/client/impl/AlfrescoObjectFactoryImpl.java
Thu Jan 31 05:15:00 2013
@@ -20,13 +20,14 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.Date;
+import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

-import javax.xml.datatype.DatatypeFactory;
-
+import org.alfresco.cmis.client.impl.utils.DateUtils;
import org.alfresco.cmis.client.type.AlfrescoDocumentType;
import org.alfresco.cmis.client.type.AlfrescoFolderType;
import org.alfresco.cmis.client.type.AlfrescoPolicyType;
@@ -268,7 +269,6 @@
// convert values
PropertyDefinition propDef =
aspectType.getPropertyDefinitions().get(id);
List values = new ArrayList();
- DatatypeFactory df = null;
try
{
for (CmisExtensionElement propertyValues :
property.getChildren())
@@ -279,11 +279,12 @@

values.add(Boolean.parseBoolean(propertyValues.getValue()));
break;
case DATETIME:
- if (df == null)
- {
- df = DatatypeFactory.newInstance();
+ GregorianCalendar g = new GregorianCalendar();
+ Date d =
DateUtils.parseDate(propertyValues.getValue());
+ if (d != null){
+ g.setTime(d);
+ values.add(g);
}
-
values.add(df.newXMLGregorianCalendar(propertyValues.getValue()).toGregorianCalendar());
break;
case DECIMAL:
values.add(new
BigDecimal(propertyValues.getValue()));
=======================================
---
/branches/android/src/main/java/org/alfresco/cmis/client/impl/AlfrescoUtils.java
Fri Feb 17 09:34:36 2012
+++
/branches/android/src/main/java/org/alfresco/cmis/client/impl/AlfrescoUtils.java
Thu Jan 31 05:15:00 2013
@@ -26,9 +26,7 @@
import java.util.List;
import java.util.Map;

-import javax.xml.datatype.DatatypeConfigurationException;
-import javax.xml.datatype.DatatypeFactory;
-
+import org.alfresco.cmis.client.impl.utils.DateUtils;
import org.apache.chemistry.opencmis.client.api.ObjectType;
import org.apache.chemistry.opencmis.client.api.Property;
import org.apache.chemistry.opencmis.client.api.Session;
@@ -224,15 +222,7 @@

if (value instanceof GregorianCalendar)
{
- DatatypeFactory df;
- try
- {
- df = DatatypeFactory.newInstance();
- } catch (DatatypeConfigurationException e)
- {
- throw new IllegalArgumentException("Aspect conversation
exception: " + e.getMessage(), e);
- }
- return df.newXMLGregorianCalendar((GregorianCalendar)
value).toXMLFormat();
+ return DateUtils.format((GregorianCalendar) value);
} else if (!(value instanceof String) && !(value instanceof
Number) && !(value instanceof Boolean))
{
throw new IllegalArgumentException("Invalid aspect value!");
=======================================
---
/branches/android/src/test/org/alfresco/cmis/client/test/CMISClientTest.java
Mon Nov 7 10:53:15 2011
+++
/branches/android/src/test/org/alfresco/cmis/client/test/CMISClientTest.java
Thu Jan 31 05:15:00 2013
@@ -52,10 +52,10 @@

// user credentials
parameter.put(SessionParameter.USER, "admin");
- parameter.put(SessionParameter.PASSWORD, "admin");
+ parameter.put(SessionParameter.PASSWORD, "alzheimer");

// connection settings
-
parameter.put(SessionParameter.ATOMPUB_URL, "http://localhost:8080/alfresco/cmisatom");
+
parameter.put(SessionParameter.ATOMPUB_URL, "http://192.168.1.68:8080/alfresco/cmisatom");
parameter.put(SessionParameter.BINDING_TYPE,
BindingType.ATOMPUB.value());

parameter.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");

@@ -69,7 +69,7 @@
String descriptionValue2 = "My Description";

Map<String, Object> properties = new HashMap<String, Object>();
- properties.put(PropertyIds.NAME, "test1");
+ properties.put(PropertyIds.NAME, "testMobile");

properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document,P:cm:titled");
properties.put("cm:description", descriptionValue1);

@@ -145,7 +145,7 @@
String descriptionValue1 = "Beschreibung";

Map<String, Object> properties = new HashMap<String, Object>();
- properties.put(PropertyIds.NAME, "test1");
+ properties.put(PropertyIds.NAME, "testMobile");
properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document");

Document doc = session.getRootFolder().createDocument(properties,
null, null);
@@ -178,7 +178,7 @@
String authorValue = "Mr JUnit Test";

Map<String, Object> properties = new HashMap<String, Object>();
- properties.put(PropertyIds.NAME, "test1");
+ properties.put(PropertyIds.NAME, "testMobile");

properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document,P:cm:titled,P:app:inlineeditable");
properties.put("cm:description", descriptionValue1);
properties.put("app:editInline", true);
Reply all
Reply to author
Forward
0 new messages