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 2013/03/12 15:06:00 UTC
svn commit: r1455535 - in /chemistry/opencmis/trunk:
chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/
chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/...
Author: fmui
Date: Tue Mar 12 14:05:59 2013
New Revision: 1455535
URL: http://svn.apache.org/r1455535
Log:
CMIS 1.1 AtomPub, step 6
Removed:
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JaxBHelper.java
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AclServiceImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomEntryWriter.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomPubParser.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/DiscoveryServiceImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/NavigationServiceImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ObjectServiceImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/PolicyServiceImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/RelationshipServiceImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/RepositoryServiceImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/VersioningServiceImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomAcl.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomAllowableActions.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/AtomParserTest.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLUtils.java
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java?rev=1455535&r1=1455534&r2=1455535&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java Tue Mar 12 14:05:59 2013
@@ -18,8 +18,6 @@
*/
package org.apache.chemistry.opencmis.client.bindings.spi.atompub;
-import static org.apache.chemistry.opencmis.commons.impl.Converter.convert;
-
import java.io.InputStream;
import java.io.OutputStream;
import java.math.BigInteger;
@@ -87,9 +85,6 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.impl.dataobjects.PolicyIdListImpl;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertiesImpl;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIdImpl;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisObjectType;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisRepositoryInfoType;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisTypeDefinitionType;
/**
* Base class for all AtomPub client services.
@@ -785,8 +780,8 @@ public abstract class AbstractAtomPubSer
} else if (is(NAME_URI_TEMPLATE, element)) {
Map<String, String> tempMap = (Map<String, String>) element.getObject();
addTemplate(ws.getId(), tempMap.get("type"), tempMap.get("template"));
- } else if (element.getObject() instanceof CmisRepositoryInfoType) {
- repInfos.add(convert((CmisRepositoryInfoType) element.getObject()));
+ } else if (element.getObject() instanceof RepositoryInfo) {
+ repInfos.add((RepositoryInfo) element.getObject());
}
}
}
@@ -844,8 +839,8 @@ public abstract class AbstractAtomPubSer
for (AtomElement element : entry.getElements()) {
if (element.getObject() instanceof AtomLink) {
addLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
- } else if (element.getObject() instanceof CmisObjectType) {
- result = convert((CmisObjectType) element.getObject());
+ } else if (element.getObject() instanceof ObjectData) {
+ result = (ObjectData) element.getObject();
}
}
} finally {
@@ -887,8 +882,8 @@ public abstract class AbstractAtomPubSer
for (AtomElement element : entry.getElements()) {
if (element.getObject() instanceof AtomLink) {
addTypeLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
- } else if (element.getObject() instanceof CmisTypeDefinitionType) {
- result = convert((CmisTypeDefinitionType) element.getObject());
+ } else if (element.getObject() instanceof TypeDefinition) {
+ result = (TypeDefinition) element.getObject();
}
}
} finally {
@@ -918,7 +913,7 @@ public abstract class AbstractAtomPubSer
Response resp = read(url);
AtomAcl acl = parse(resp.getStream(), AtomAcl.class);
- return convert(acl.getACL(), null);
+ return acl.getACL();
}
/**
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AclServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AclServiceImpl.java?rev=1455535&r1=1455534&r2=1455535&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AclServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AclServiceImpl.java Tue Mar 12 14:05:59 2013
@@ -18,8 +18,6 @@
*/
package org.apache.chemistry.opencmis.client.bindings.spi.atompub;
-import static org.apache.chemistry.opencmis.commons.impl.Converter.convert;
-
import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomAcl;
import org.apache.chemistry.opencmis.commons.data.Acl;
@@ -56,7 +54,7 @@ public class AclServiceImpl extends Abst
// update ACL
AtomAcl acl = updateAcl(repositoryId, objectId, newACL, aclPropagation);
- Acl result = convert(acl.getACL(), null);
+ Acl result = acl.getACL();
return result;
}
@@ -67,7 +65,7 @@ public class AclServiceImpl extends Abst
public Acl setAcl(String repositoryId, String objectId, Acl aces) {
AtomAcl acl = updateAcl(repositoryId, objectId, aces, AclPropagation.OBJECTONLY);
- Acl result = convert(acl.getACL(), null);
+ Acl result = acl.getACL();
return result;
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomEntryWriter.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomEntryWriter.java?rev=1455535&r1=1455534&r2=1455535&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomEntryWriter.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomEntryWriter.java Tue Mar 12 14:05:59 2013
@@ -157,6 +157,7 @@ public class AtomEntryWriter {
}
private void writeContent(XMLStreamWriter writer) throws Exception {
+ @SuppressWarnings("resource")
Base64.InputStream b64stream = new Base64.InputStream(stream, Base64.ENCODE);
char[] buffer = new char[BUFFER_SIZE];
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomPubParser.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomPubParser.java?rev=1455535&r1=1455534&r2=1455535&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomPubParser.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomPubParser.java Tue Mar 12 14:05:59 2013
@@ -18,10 +18,6 @@
*/
package org.apache.chemistry.opencmis.client.bindings.spi.atompub;
-import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.ATTR_DOCUMENT_TYPE;
-import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.ATTR_FOLDER_TYPE;
-import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.ATTR_POLICY_TYPE;
-import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.ATTR_RELATIONSHIP_TYPE;
import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.CONTENT_SRC;
import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.LINK_HREF;
import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.LINK_REL;
@@ -53,8 +49,6 @@ import java.math.BigInteger;
import java.util.HashMap;
import java.util.Map;
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.Unmarshaller;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamReader;
@@ -68,23 +62,13 @@ import org.apache.chemistry.opencmis.cli
import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.HtmlDoc;
import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.RepositoryWorkspace;
import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.ServiceDoc;
-import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
+import org.apache.chemistry.opencmis.commons.data.ObjectData;
+import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
+import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
import org.apache.chemistry.opencmis.commons.impl.Constants;
-import org.apache.chemistry.opencmis.commons.impl.JaxBHelper;
-import org.apache.chemistry.opencmis.commons.impl.XMLConstants;
+import org.apache.chemistry.opencmis.commons.impl.XMLConstraints;
+import org.apache.chemistry.opencmis.commons.impl.XMLConverter;
import org.apache.chemistry.opencmis.commons.impl.XMLUtils;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisAccessControlListType;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisAllowableActionsType;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisObjectType;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisProperty;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisPropertyId;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisRepositoryInfoType;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisTypeDefinitionType;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisTypeDocumentDefinitionType;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisTypeFolderDefinitionType;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisTypePolicyDefinitionType;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisTypeRelationshipDefinitionType;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.EnumPropertiesBase;
/**
* AtomPub Parser.
@@ -221,8 +205,8 @@ public class AtomPubParser {
AtomElement element = parseWorkspaceElement(parser);
// check if we can extract the workspace id
- if ((element != null) && (element.getObject() instanceof CmisRepositoryInfoType)) {
- workspace.setId(((CmisRepositoryInfoType) element.getObject()).getRepositoryId());
+ if ((element != null) && (element.getObject() instanceof RepositoryInfo)) {
+ workspace.setId(((RepositoryInfo) element.getObject()).getId());
}
// add to workspace
@@ -303,14 +287,10 @@ public class AtomPubParser {
result.addElement(element);
// find and set object id
- if (element.getObject() instanceof CmisObjectType) {
- for (CmisProperty prop : ((CmisObjectType) element.getObject()).getProperties().getProperty()) {
- if (EnumPropertiesBase.CMIS_OBJECT_ID.value().equals(prop.getPropertyDefinitionId())) {
- result.setId(((CmisPropertyId) prop).getValue().get(0));
- }
- }
- } else if (element.getObject() instanceof CmisTypeDefinitionType) {
- result.setId(((CmisTypeDefinitionType) element.getObject()).getId());
+ if (element.getObject() instanceof ObjectData) {
+ result.setId(((ObjectData) element.getObject()).getId());
+ } else if (element.getObject() instanceof TypeDefinition) {
+ result.setId(((TypeDefinition) element.getObject()).getId());
}
}
} else if (event == XMLStreamReader.END_ELEMENT) {
@@ -331,16 +311,14 @@ public class AtomPubParser {
* Parses an Allowable Actions document.
*/
private static AtomAllowableActions parseAllowableActions(XMLStreamReader parser) throws Exception {
- AtomElement elemenet = unmarshalElement(parser, CmisAllowableActionsType.class);
- return new AtomAllowableActions((CmisAllowableActionsType) elemenet.getObject());
+ return new AtomAllowableActions(XMLConverter.convertAllowableActions(parser));
}
/**
* Parses an ACL document.
*/
private static AtomAcl parseACL(XMLStreamReader parser) throws Exception {
- AtomElement elemenet = unmarshalElement(parser, CmisAccessControlListType.class);
- return new AtomAcl((CmisAccessControlListType) elemenet.getObject());
+ return new AtomAcl(XMLConverter.convertAcl(parser));
}
/**
@@ -351,25 +329,12 @@ public class AtomPubParser {
if (Constants.NAMESPACE_RESTATOM.equals(name.getNamespaceURI())) {
if (TAG_OBJECT.equals(name.getLocalPart())) {
- return unmarshalElement(parser, CmisObjectType.class);
+ return new AtomElement(name, XMLConverter.convertObject(parser));
} else if (TAG_PATH_SEGMENT.equals(name.getLocalPart())
|| TAG_RELATIVE_PATH_SEGMENT.equals(name.getLocalPart())) {
return parseText(parser);
} else if (TAG_TYPE.equals(name.getLocalPart())) {
- // workaround for old Chemistry code - ignore the type namespace
- String typeAttr = parser.getAttributeValue(XMLConstants.NAMESPACE_XSI, "type");
- if (typeAttr == null) {
- return unmarshalElement(parser, CmisTypeDefinitionType.class);
- } else if (typeAttr.endsWith(ATTR_DOCUMENT_TYPE)) {
- return unmarshalElement(parser, CmisTypeDocumentDefinitionType.class);
- } else if (typeAttr.endsWith(ATTR_FOLDER_TYPE)) {
- return unmarshalElement(parser, CmisTypeFolderDefinitionType.class);
- } else if (typeAttr.endsWith(ATTR_RELATIONSHIP_TYPE)) {
- return unmarshalElement(parser, CmisTypeRelationshipDefinitionType.class);
- } else if (typeAttr.endsWith(ATTR_POLICY_TYPE)) {
- return unmarshalElement(parser, CmisTypePolicyDefinitionType.class);
- }
- throw new CmisRuntimeException("Cannot read type definition!");
+ return new AtomElement(name, XMLConverter.convertTypeDefinition(parser));
} else if (TAG_CHILDREN.equals(name.getLocalPart())) {
return parseChildren(parser);
}
@@ -388,18 +353,6 @@ public class AtomPubParser {
}
/**
- * Unmarshals a JAXB element.
- */
- private static <T> AtomElement unmarshalElement(XMLStreamReader parser, Class<T> cmisType) throws Exception {
- QName name = parser.getName();
-
- Unmarshaller u = JaxBHelper.createUnmarshaller();
- JAXBElement<T> object = u.unmarshal(parser, cmisType);
-
- return new AtomElement(name, object.getValue());
- }
-
- /**
* Parses a children element.
*/
private AtomElement parseChildren(XMLStreamReader parser) throws Exception {
@@ -445,7 +398,7 @@ public class AtomPubParser {
if (Constants.NAMESPACE_RESTATOM.equals(name.getNamespaceURI())) {
if (TAG_REPOSITORY_INFO.equals(name.getLocalPart())) {
- return unmarshalElement(parser, CmisRepositoryInfoType.class);
+ return new AtomElement(name, XMLConverter.convertRepositoryInfo(parser));
} else if (TAG_URI_TEMPLATE.equals(name.getLocalPart())) {
return parseTemplate(parser);
}
@@ -482,7 +435,7 @@ public class AtomPubParser {
QName tagName = parser.getName();
if (Constants.NAMESPACE_RESTATOM.equals(tagName.getNamespaceURI())
&& TAG_COLLECTION_TYPE.equals(tagName.getLocalPart())) {
- result.put("collectionType", readText(parser));
+ result.put("collectionType", XMLUtils.readText(parser, XMLConstraints.MAX_STRING_LENGTH));
} else {
XMLUtils.skip(parser);
}
@@ -515,9 +468,9 @@ public class AtomPubParser {
QName tagName = parser.getName();
if (Constants.NAMESPACE_RESTATOM.equals(tagName.getNamespaceURI())) {
if (TAG_TEMPLATE_TEMPLATE.equals(tagName.getLocalPart())) {
- result.put("template", readText(parser));
+ result.put("template", XMLUtils.readText(parser, XMLConstraints.MAX_STRING_LENGTH));
} else if (TAG_TEMPLATE_TYPE.equals(tagName.getLocalPart())) {
- result.put("type", readText(parser));
+ result.put("type", XMLUtils.readText(parser, XMLConstraints.MAX_STRING_LENGTH));
} else {
XMLUtils.skip(parser);
}
@@ -588,7 +541,7 @@ public class AtomPubParser {
*/
private static AtomElement parseText(XMLStreamReader parser) throws Exception {
QName name = parser.getName();
- return new AtomElement(name, readText(parser));
+ return new AtomElement(name, XMLUtils.readText(parser, XMLConstraints.MAX_STRING_LENGTH));
}
/**
@@ -596,37 +549,6 @@ public class AtomPubParser {
*/
private static AtomElement parseBigInteger(XMLStreamReader parser) throws Exception {
QName name = parser.getName();
- return new AtomElement(name, new BigInteger(readText(parser)));
- }
-
- /**
- * Parses a tag that contains text.
- */
- private static String readText(XMLStreamReader parser) throws Exception {
- StringBuilder sb = new StringBuilder();
-
- XMLUtils.next(parser);
-
- while (true) {
- int event = parser.getEventType();
- if (event == XMLStreamReader.END_ELEMENT) {
- break;
- } else if (event == XMLStreamReader.CHARACTERS) {
- String s = parser.getText();
- if (s != null) {
- sb.append(s);
- }
- } else if (event == XMLStreamReader.START_ELEMENT) {
- throw new RuntimeException("Unexpected tag: " + parser.getName());
- }
-
- if (!XMLUtils.next(parser)) {
- break;
- }
- }
-
- XMLUtils.next(parser);
-
- return sb.toString();
+ return new AtomElement(name, new BigInteger(XMLUtils.readText(parser, XMLConstraints.MAX_STRING_LENGTH)));
}
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/DiscoveryServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/DiscoveryServiceImpl.java?rev=1455535&r1=1455534&r2=1455535&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/DiscoveryServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/DiscoveryServiceImpl.java Tue Mar 12 14:05:59 2013
@@ -18,8 +18,6 @@
*/
package org.apache.chemistry.opencmis.client.bindings.spi.atompub;
-import static org.apache.chemistry.opencmis.commons.impl.Converter.convert;
-
import java.io.OutputStream;
import java.math.BigInteger;
import java.util.ArrayList;
@@ -45,7 +43,6 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.impl.XMLUtils;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.ObjectListImpl;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.QueryTypeImpl;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisObjectType;
import org.apache.chemistry.opencmis.commons.spi.DiscoveryService;
import org.apache.chemistry.opencmis.commons.spi.Holder;
@@ -104,8 +101,8 @@ public class DiscoveryServiceImpl extend
// walk through the entry
for (AtomElement element : entry.getElements()) {
- if (element.getObject() instanceof CmisObjectType) {
- hit = convert((CmisObjectType) element.getObject());
+ if (element.getObject() instanceof ObjectData) {
+ hit = (ObjectData) element.getObject();
}
}
@@ -175,8 +172,8 @@ public class DiscoveryServiceImpl extend
// walk through the entry
for (AtomElement element : entry.getElements()) {
- if (element.getObject() instanceof CmisObjectType) {
- hit = convert((CmisObjectType) element.getObject());
+ if (element.getObject() instanceof ObjectData) {
+ hit = (ObjectData) element.getObject();
}
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/NavigationServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/NavigationServiceImpl.java?rev=1455535&r1=1455534&r2=1455535&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/NavigationServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/NavigationServiceImpl.java Tue Mar 12 14:05:59 2013
@@ -18,8 +18,6 @@
*/
package org.apache.chemistry.opencmis.client.bindings.spi.atompub;
-import static org.apache.chemistry.opencmis.commons.impl.Converter.convert;
-
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
@@ -48,13 +46,10 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.impl.dataobjects.ObjectInFolderListImpl;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.ObjectListImpl;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.ObjectParentDataImpl;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisObjectType;
import org.apache.chemistry.opencmis.commons.spi.NavigationService;
/**
* Navigation Service AtomPub client.
- *
- * @author <a href="mailto:fmueller@opentext.com">Florian Müller</a>
*/
public class NavigationServiceImpl extends AbstractAtomPubService implements NavigationService {
@@ -121,9 +116,9 @@ public class NavigationServiceImpl exten
addLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
} else if (isStr(NAME_PATH_SEGMENT, element)) {
pathSegment = (String) element.getObject();
- } else if (element.getObject() instanceof CmisObjectType) {
+ } else if (element.getObject() instanceof ObjectData) {
child = new ObjectInFolderDataImpl();
- child.setObject(convert((CmisObjectType) element.getObject()));
+ child.setObject((ObjectData) element.getObject());
}
}
} finally {
@@ -211,8 +206,8 @@ public class NavigationServiceImpl exten
for (AtomElement element : entry.getElements()) {
if (element.getObject() instanceof AtomLink) {
addLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
- } else if (element.getObject() instanceof CmisObjectType) {
- result = convert((CmisObjectType) element.getObject());
+ } else if (element.getObject() instanceof ObjectData) {
+ result = (ObjectData) element.getObject();
}
}
} finally {
@@ -316,8 +311,8 @@ public class NavigationServiceImpl exten
for (AtomElement element : entry.getElements()) {
if (element.getObject() instanceof AtomLink) {
addLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
- } else if (element.getObject() instanceof CmisObjectType) {
- result = new ObjectParentDataImpl(convert((CmisObjectType) element.getObject()));
+ } else if (element.getObject() instanceof ObjectData) {
+ result = new ObjectParentDataImpl((ObjectData) element.getObject());
} else if (is(NAME_RELATIVE_PATH_SEGMENT, element)) {
relativePathSegment = (String) element.getObject();
}
@@ -386,8 +381,8 @@ public class NavigationServiceImpl exten
for (AtomElement element : entry.getElements()) {
if (element.getObject() instanceof AtomLink) {
addLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
- } else if (element.getObject() instanceof CmisObjectType) {
- child = convert((CmisObjectType) element.getObject());
+ } else if (element.getObject() instanceof ObjectData) {
+ child = (ObjectData) element.getObject();
}
}
} finally {
@@ -428,8 +423,8 @@ public class NavigationServiceImpl exten
for (AtomElement element : entry.getElements()) {
if (element.getObject() instanceof AtomLink) {
addLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
- } else if (element.getObject() instanceof CmisObjectType) {
- objectInFolder = new ObjectInFolderDataImpl(convert((CmisObjectType) element.getObject()));
+ } else if (element.getObject() instanceof ObjectData) {
+ objectInFolder = new ObjectInFolderDataImpl((ObjectData) element.getObject());
} else if (is(NAME_PATH_SEGMENT, element)) {
pathSegment = (String) element.getObject();
} else if (element.getObject() instanceof AtomFeed) {
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ObjectServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ObjectServiceImpl.java?rev=1455535&r1=1455534&r2=1455535&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ObjectServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ObjectServiceImpl.java Tue Mar 12 14:05:59 2013
@@ -18,8 +18,6 @@
*/
package org.apache.chemistry.opencmis.client.bindings.spi.atompub;
-import static org.apache.chemistry.opencmis.commons.impl.Converter.convert;
-
import java.io.InputStream;
import java.io.OutputStream;
import java.math.BigInteger;
@@ -62,9 +60,6 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.ContentStreamImpl;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.FailedToDeleteDataImpl;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisObjectType;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisProperty;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisPropertyString;
import org.apache.chemistry.opencmis.commons.spi.Holder;
import org.apache.chemistry.opencmis.commons.spi.ObjectService;
@@ -356,23 +351,16 @@ public class ObjectServiceImpl extends A
for (AtomElement element : entry.getElements()) {
if (element.getObject() instanceof AtomLink) {
addLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
- } else if (element.getObject() instanceof CmisObjectType) {
+ } else if (element.getObject() instanceof ObjectData) {
// extract new change token
if (changeToken != null) {
- CmisObjectType object = (CmisObjectType) element.getObject();
+ ObjectData object = (ObjectData) element.getObject();
if (object.getProperties() != null) {
- for (CmisProperty property : object.getProperties().getProperty()) {
- if (PropertyIds.CHANGE_TOKEN.equals(property.getPropertyDefinitionId())
- && (property instanceof CmisPropertyString)) {
-
- CmisPropertyString changeTokenProperty = (CmisPropertyString) property;
- if (!changeTokenProperty.getValue().isEmpty()) {
- changeToken.setValue(changeTokenProperty.getValue().get(0));
- }
-
- break;
- }
+ Object changeTokenStr = object.getProperties().getProperties()
+ .get(PropertyIds.CHANGE_TOKEN);
+ if (changeTokenStr instanceof String) {
+ changeToken.setValue((String) changeTokenStr);
}
}
}
@@ -500,7 +488,7 @@ public class ObjectServiceImpl extends A
Response resp = read(url);
AtomAllowableActions allowableActions = parse(resp.getStream(), AtomAllowableActions.class);
- return convert(allowableActions.getAllowableActions());
+ return allowableActions.getAllowableActions();
}
public ContentStream getContentStream(String repositoryId, String objectId, String streamId, BigInteger offset,
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/PolicyServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/PolicyServiceImpl.java?rev=1455535&r1=1455534&r2=1455535&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/PolicyServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/PolicyServiceImpl.java Tue Mar 12 14:05:59 2013
@@ -18,8 +18,6 @@
*/
package org.apache.chemistry.opencmis.client.bindings.spi.atompub;
-import static org.apache.chemistry.opencmis.commons.impl.Converter.convert;
-
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
@@ -37,9 +35,6 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
import org.apache.chemistry.opencmis.commons.impl.Constants;
import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisObjectType;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisProperty;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisPropertyId;
import org.apache.chemistry.opencmis.commons.spi.PolicyService;
/**
@@ -100,8 +95,8 @@ public class PolicyServiceImpl extends A
// walk through the entry
for (AtomElement element : entry.getElements()) {
- if (element.getObject() instanceof CmisObjectType) {
- policy = convert((CmisObjectType) element.getObject());
+ if (element.getObject() instanceof ObjectData) {
+ policy = (ObjectData) element.getObject();
}
}
@@ -147,8 +142,8 @@ public class PolicyServiceImpl extends A
if (Constants.REL_SELF.equals(atomLink.getRel())) {
policyLink = atomLink.getHref();
}
- } else if (element.getObject() instanceof CmisObjectType) {
- String id = findIdProperty((CmisObjectType) element.getObject());
+ } else if (element.getObject() instanceof ObjectData) {
+ String id = ((ObjectData) element.getObject()).getId();
if (policyId.equals(id)) {
found = true;
}
@@ -166,25 +161,4 @@ public class PolicyServiceImpl extends A
delete(new UrlBuilder(policyLink));
}
}
-
- /**
- * Finds the id property within a CMIS object.
- */
- private static String findIdProperty(CmisObjectType object) {
- if ((object == null) || (object.getProperties() == null)) {
- return null;
- }
-
- for (CmisProperty property : object.getProperties().getProperty()) {
- if (PropertyIds.OBJECT_ID.equals(property.getPropertyDefinitionId())
- && (property instanceof CmisPropertyId)) {
- List<String> values = ((CmisPropertyId) property).getValue();
- if (values.size() == 1) {
- return values.get(0);
- }
- }
- }
-
- return null;
- }
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/RelationshipServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/RelationshipServiceImpl.java?rev=1455535&r1=1455534&r2=1455535&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/RelationshipServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/RelationshipServiceImpl.java Tue Mar 12 14:05:59 2013
@@ -18,8 +18,6 @@
*/
package org.apache.chemistry.opencmis.client.bindings.spi.atompub;
-import static org.apache.chemistry.opencmis.commons.impl.Converter.convert;
-
import java.math.BigInteger;
import java.util.ArrayList;
@@ -36,7 +34,6 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.impl.Constants;
import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.ObjectListImpl;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisObjectType;
import org.apache.chemistry.opencmis.commons.spi.RelationshipService;
/**
@@ -103,8 +100,8 @@ public class RelationshipServiceImpl ext
for (AtomElement element : entry.getElements()) {
if (element.getObject() instanceof AtomLink) {
addLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
- } else if (element.getObject() instanceof CmisObjectType) {
- relationship = convert((CmisObjectType) element.getObject());
+ } else if (element.getObject() instanceof ObjectData) {
+ relationship = (ObjectData) element.getObject();
}
}
} finally {
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/RepositoryServiceImpl.java?rev=1455535&r1=1455534&r2=1455535&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/RepositoryServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/RepositoryServiceImpl.java Tue Mar 12 14:05:59 2013
@@ -18,8 +18,6 @@
*/
package org.apache.chemistry.opencmis.client.bindings.spi.atompub;
-import static org.apache.chemistry.opencmis.commons.impl.Converter.convert;
-
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
@@ -41,7 +39,6 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.TypeDefinitionContainerImpl;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.TypeDefinitionListImpl;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisTypeDefinitionType;
import org.apache.chemistry.opencmis.commons.spi.RepositoryService;
/**
@@ -138,8 +135,8 @@ public class RepositoryServiceImpl exten
for (AtomElement element : entry.getElements()) {
if (element.getObject() instanceof AtomLink) {
addTypeLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
- } else if (element.getObject() instanceof CmisTypeDefinitionType) {
- child = convert((CmisTypeDefinitionType) element.getObject());
+ } else if (element.getObject() instanceof TypeDefinition) {
+ child = (TypeDefinition) element.getObject();
}
}
} finally {
@@ -204,9 +201,8 @@ public class RepositoryServiceImpl exten
for (AtomElement element : entry.getElements()) {
if (element.getObject() instanceof AtomLink) {
addTypeLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
- } else if (element.getObject() instanceof CmisTypeDefinitionType) {
- childContainer = new TypeDefinitionContainerImpl(
- convert((CmisTypeDefinitionType) element.getObject()));
+ } else if (element.getObject() instanceof TypeDefinition) {
+ childContainer = new TypeDefinitionContainerImpl((TypeDefinition) element.getObject());
} else if (element.getObject() instanceof AtomFeed) {
addTypeDescendantsLevel(repositoryId, (AtomFeed) element.getObject(), childContainerList);
}
@@ -221,7 +217,7 @@ public class RepositoryServiceImpl exten
}
}
}
-
+
public TypeDefinition createType(String repositoryId, TypeDefinition type, ExtensionsData extension) {
throw new CmisNotSupportedException("Not supported!");
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/VersioningServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/VersioningServiceImpl.java?rev=1455535&r1=1455534&r2=1455535&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/VersioningServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/VersioningServiceImpl.java Tue Mar 12 14:05:59 2013
@@ -18,8 +18,6 @@
*/
package org.apache.chemistry.opencmis.client.bindings.spi.atompub;
-import static org.apache.chemistry.opencmis.commons.impl.Converter.convert;
-
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
@@ -43,7 +41,7 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.impl.Constants;
import org.apache.chemistry.opencmis.commons.impl.ReturnVersion;
import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisObjectType;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlListImpl;
import org.apache.chemistry.opencmis.commons.spi.Holder;
import org.apache.chemistry.opencmis.commons.spi.VersioningService;
@@ -177,7 +175,7 @@ public class VersioningServiceImpl exten
// set object id
objectId.setValue(entry.getId());
- Acl originalAces = null;
+ AccessControlListImpl originalAces = null;
lockLinks();
try {
@@ -188,10 +186,13 @@ public class VersioningServiceImpl exten
for (AtomElement element : entry.getElements()) {
if (element.getObject() instanceof AtomLink) {
addLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
- } else if (element.getObject() instanceof CmisObjectType) {
+ } else if (element.getObject() instanceof ObjectData) {
// extract current ACL
- CmisObjectType object = (CmisObjectType) element.getObject();
- originalAces = convert(object.getAcl(), object.isExactACL());
+ ObjectData object = (ObjectData) element.getObject();
+ if (object.getAcl() != null) {
+ originalAces = new AccessControlListImpl(object.getAcl().getAces());
+ originalAces.setExact(object.isExactAcl());
+ }
}
}
} finally {
@@ -241,8 +242,8 @@ public class VersioningServiceImpl exten
for (AtomElement element : entry.getElements()) {
if (element.getObject() instanceof AtomLink) {
addLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
- } else if (element.getObject() instanceof CmisObjectType) {
- version = convert((CmisObjectType) element.getObject());
+ } else if (element.getObject() instanceof ObjectData) {
+ version = (ObjectData) element.getObject();
}
}
} finally {
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomAcl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomAcl.java?rev=1455535&r1=1455534&r2=1455535&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomAcl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomAcl.java Tue Mar 12 14:05:59 2013
@@ -18,7 +18,7 @@
*/
package org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisAccessControlListType;
+import org.apache.chemistry.opencmis.commons.data.Acl;
/**
* AtomAcl.
@@ -27,13 +27,13 @@ public class AtomAcl extends AtomBase {
private static final long serialVersionUID = 1L;
- private CmisAccessControlListType acl;
+ private Acl acl;
public AtomAcl() {
super();
}
- public AtomAcl(CmisAccessControlListType acl) {
+ public AtomAcl(Acl acl) {
this();
setACL(acl);
}
@@ -43,11 +43,11 @@ public class AtomAcl extends AtomBase {
return "ACL";
}
- public CmisAccessControlListType getACL() {
+ public Acl getACL() {
return acl;
}
- public void setACL(CmisAccessControlListType acl) {
+ public void setACL(Acl acl) {
this.acl = acl;
}
}
\ No newline at end of file
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomAllowableActions.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomAllowableActions.java?rev=1455535&r1=1455534&r2=1455535&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomAllowableActions.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomAllowableActions.java Tue Mar 12 14:05:59 2013
@@ -18,7 +18,7 @@
*/
package org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisAllowableActionsType;
+import org.apache.chemistry.opencmis.commons.data.AllowableActions;
/**
* AtomAllowableActions.
@@ -27,13 +27,13 @@ public class AtomAllowableActions extend
private static final long serialVersionUID = 1L;
- private CmisAllowableActionsType allowableActions;
+ private AllowableActions allowableActions;
public AtomAllowableActions() {
super();
}
- public AtomAllowableActions(CmisAllowableActionsType allowableActions) {
+ public AtomAllowableActions(AllowableActions allowableActions) {
this();
setAllowableActions(allowableActions);
}
@@ -43,11 +43,11 @@ public class AtomAllowableActions extend
return "Allowable Actions";
}
- public CmisAllowableActionsType getAllowableActions() {
+ public AllowableActions getAllowableActions() {
return allowableActions;
}
- public void setAllowableActions(CmisAllowableActionsType allowableActions) {
+ public void setAllowableActions(AllowableActions allowableActions) {
this.allowableActions = allowableActions;
}
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/AtomParserTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/AtomParserTest.java?rev=1455535&r1=1455534&r2=1455535&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/AtomParserTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/AtomParserTest.java Tue Mar 12 14:05:59 2013
@@ -20,7 +20,6 @@ package org.apache.chemistry.opencmis.cl
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
-import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Arrays;
@@ -35,6 +34,7 @@ import org.apache.chemistry.opencmis.cli
import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomEntry;
import org.apache.chemistry.opencmis.commons.PropertyIds;
import org.apache.chemistry.opencmis.commons.data.ContentStream;
+import org.apache.chemistry.opencmis.commons.data.ObjectData;
import org.apache.chemistry.opencmis.commons.data.PropertyData;
import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.ContentStreamImpl;
@@ -43,8 +43,6 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyDecimalImpl;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIntegerImpl;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyStringImpl;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisObjectType;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisProperty;
/**
* Minimal test for AtomEntryWriter and AtomPubParser.
@@ -96,11 +94,11 @@ public class AtomParserTest extends Test
assertTrue(entry.getElements().size() > 0);
// find the object
- CmisObjectType object2 = null;
+ ObjectData object2 = null;
for (AtomElement element : entry.getElements()) {
- if (element.getObject() instanceof CmisObjectType) {
+ if (element.getObject() instanceof ObjectData) {
assertNull(object2);
- object2 = (CmisObjectType) element.getObject();
+ object2 = (ObjectData) element.getObject();
}
}
@@ -109,23 +107,14 @@ public class AtomParserTest extends Test
// compare properties
for (PropertyData<?> property1 : object1.getProperties().getPropertyList()) {
- boolean found = false;
+ PropertyData<?> property2 = object2.getProperties().getProperties().get(property1.getId());
- for (CmisProperty property2 : object2.getProperties().getProperty()) {
- if (property1.getId().equals(property2.getPropertyDefinitionId())) {
- found = true;
-
- // TODO: fix test
- //assertEquals(property1.getValues(), property2.);
- break;
- }
- }
-
- assertTrue(found);
+ assertNotNull(property2);
+ assertEquals(property1, property2);
}
}
- protected void assertEquals(CmisProperty expected, CmisProperty actual) throws Exception {
+ protected void assertEquals(PropertyData<?> expected, PropertyData<?> actual) throws Exception {
if (expected == null && actual == null) {
return;
}
@@ -134,16 +123,14 @@ public class AtomParserTest extends Test
fail("Property is null!");
}
- assertEquals(expected.getPropertyDefinitionId(), actual.getPropertyDefinitionId());
+ assertEquals(expected.getId(), actual.getId());
assertSame(expected.getClass(), actual.getClass());
- Method m1 = expected.getClass().getMethod("getValue");
- List<?> values1 = (List<?>) m1.invoke(expected);
+ List<?> values1 = expected.getValues();
assertNotNull(values1);
assertFalse(values1.isEmpty());
- Method m2 = actual.getClass().getMethod("getValue");
- List<?> values2 = (List<?>) m2.invoke(actual);
+ List<?> values2 = actual.getValues();
assertNotNull(values2);
assertFalse(values2.isEmpty());
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLUtils.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLUtils.java?rev=1455535&r1=1455534&r2=1455535&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLUtils.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLUtils.java Tue Mar 12 14:05:59 2013
@@ -272,7 +272,7 @@ public class XMLUtils {
* Parses a tag that contains text.
*/
public static String readText(XMLStreamReader parser, int maxLength) throws XMLStreamException {
- StringBuilder sb = null;
+ StringBuilder sb = new StringBuilder();
next(parser);
@@ -283,10 +283,6 @@ public class XMLUtils {
} else if (event == XMLStreamReader.CHARACTERS) {
int len = parser.getTextLength();
if (len > 0) {
- if (sb == null) {
- sb = new StringBuilder();
- }
-
if (sb.length() + len > maxLength) {
throw new CmisInvalidArgumentException("String limit exceeded!");
}
@@ -307,7 +303,7 @@ public class XMLUtils {
next(parser);
- return sb == null ? null : sb.toString();
+ return sb.toString();
}
/**