From 631c94c899c7408701ec61b4b39c417f7204c6dc Mon Sep 17 00:00:00 2001 From: David Caruana Date: Thu, 25 Sep 2008 14:06:55 +0000 Subject: [PATCH] Simple cmis client sample: browse repo, folders and view content - two surf web scripts utilizing remote - 'atom' helper added for parsing atom responses from server - moved abdera cmis extension to webscript f/w - added urlEncodeComponent to ScriptableUtils - temp. change to RemoteClient which doesn't prefix endpoint, if passed url already starts with endpoint git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@11020 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../repository/repository.get.atom.ftl | 2 +- .../web-scripts-application-context.xml | 15 - .../abdera/ext/cmis/CMISCapabilities.java | 99 ----- .../apache/abdera/ext/cmis/CMISConstants.java | 140 ------- .../abdera/ext/cmis/CMISExtensionFactory.java | 73 ---- .../apache/abdera/ext/cmis/CMISObject.java | 217 ---------- .../abdera/ext/cmis/CMISProperties.java | 104 ----- .../apache/abdera/ext/cmis/CMISProperty.java | 387 ------------------ .../abdera/ext/cmis/CMISRepositoryInfo.java | 142 ------- 9 files changed, 1 insertion(+), 1178 deletions(-) delete mode 100644 source/java/org/apache/abdera/ext/cmis/CMISCapabilities.java delete mode 100644 source/java/org/apache/abdera/ext/cmis/CMISConstants.java delete mode 100644 source/java/org/apache/abdera/ext/cmis/CMISExtensionFactory.java delete mode 100644 source/java/org/apache/abdera/ext/cmis/CMISObject.java delete mode 100644 source/java/org/apache/abdera/ext/cmis/CMISProperties.java delete mode 100644 source/java/org/apache/abdera/ext/cmis/CMISProperty.java delete mode 100644 source/java/org/apache/abdera/ext/cmis/CMISRepositoryInfo.java diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/repository.get.atom.ftl b/config/alfresco/templates/webscripts/org/alfresco/repository/repository.get.atom.ftl index 26e6a79334..52a708e4f4 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/repository.get.atom.ftl +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/repository.get.atom.ftl @@ -13,7 +13,7 @@ Alfresco Alfresco Repository (${server.edition}) ${server.version} - ${absurl(url.serviceContext)}/api/path/${encodeuri(defaultRootFolderPath)}/children + ${absurl(url.serviceContext)}/api/path/${encodeuri(defaultRootFolderPath)} true false diff --git a/config/alfresco/web-scripts-application-context.xml b/config/alfresco/web-scripts-application-context.xml index 85c3b2ef79..7fb3e92c82 100644 --- a/config/alfresco/web-scripts-application-context.xml +++ b/config/alfresco/web-scripts-application-context.xml @@ -457,19 +457,4 @@ - - - http://www.cmis.org/2008/05 - - - object - - - - - - - - - diff --git a/source/java/org/apache/abdera/ext/cmis/CMISCapabilities.java b/source/java/org/apache/abdera/ext/cmis/CMISCapabilities.java deleted file mode 100644 index 83c58a4639..0000000000 --- a/source/java/org/apache/abdera/ext/cmis/CMISCapabilities.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (C) 2005-2008 Alfresco Software Limited. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - * As a special exception to the terms and conditions of version 2.0 of - * the GPL, you may redistribute this Program in connection with Free/Libre - * and Open Source Software ("FLOSS") applications as described in Alfresco's - * FLOSS exception. You should have recieved a copy of the text describing - * the FLOSS exception, and it is also available here: - * http://www.alfresco.com/legal/licensing" - */ -package org.apache.abdera.ext.cmis; - -import org.apache.abdera.factory.Factory; -import org.apache.abdera.model.Element; -import org.apache.abdera.model.ElementWrapper; - - -/** - * CMIS Repository Info for the Abdera ATOM library. - * - * Encapsulates access and modification of CMIS extension values to ATOM - * Service Document. - * - * NOTE: Potentially, this extension can be contributed to Abdera upon - * publication of CMIS. This is why it is organised under a - * non-Alfresco Java package. It follows the conventions of all - * other Abdera extensions. - * - * @author davidc - */ -public class CMISCapabilities extends ElementWrapper -{ - public CMISCapabilities(Element internal) - { - super(internal); - } - - public CMISCapabilities(Factory factory) - { - super(factory, CMISConstants.REPOSITORY_INFO); - } - - public boolean hasMultifiling() - { - Element child = getFirstChild(CMISConstants.CAPABILITY_MULTIFILING); - return Boolean.valueOf(child.getText()); - } - - public boolean hasUnfiling() - { - Element child = getFirstChild(CMISConstants.CAPABILITY_UNFILING); - return Boolean.valueOf(child.getText()); - } - - public boolean hasVersionSpecificFiling() - { - Element child = getFirstChild(CMISConstants.CAPABILITY_VERSION_SPECIFIC_FILING); - return Boolean.valueOf(child.getText()); - } - - public boolean isPWCUpdatable() - { - Element child = getFirstChild(CMISConstants.CAPABILITY_PWC_UPDATEABLE); - return Boolean.valueOf(child.getText()); - } - - public boolean isAllVersionsSearchable() - { - Element child = getFirstChild(CMISConstants.CAPABILITY_ALL_VERIONS_SEARCHABLE); - return Boolean.valueOf(child.getText()); - } - - public String getJoin() - { - Element child = getFirstChild(CMISConstants.CAPABILITY_JOIN); - return child.getText(); - } - - public String getFullText() - { - Element child = getFirstChild(CMISConstants.CAPABILITY_FULLTEXT); - return child.getText(); - } - -} diff --git a/source/java/org/apache/abdera/ext/cmis/CMISConstants.java b/source/java/org/apache/abdera/ext/cmis/CMISConstants.java deleted file mode 100644 index c7b828f40a..0000000000 --- a/source/java/org/apache/abdera/ext/cmis/CMISConstants.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (C) 2005-2008 Alfresco Software Limited. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - * As a special exception to the terms and conditions of version 2.0 of - * the GPL, you may redistribute this Program in connection with Free/Libre - * and Open Source Software ("FLOSS") applications as described in Alfresco's - * FLOSS exception. You should have recieved a copy of the text describing - * the FLOSS exception, and it is also available here: - * http://www.alfresco.com/legal/licensing" - */ -package org.apache.abdera.ext.cmis; - -import javax.xml.namespace.QName; - -import org.apache.abdera.util.Constants; - - -/** - * CMIS Namespace definitions for the Abdera ATOM library. - * - * Encapsulates access and modification of CMIS extension values to ATOM. - * - * NOTE: Potentially, this extension can be contributed to Abdera upon - * publication of CMIS. This is why it is organised under a - * non-Alfresco Java package. It follows the conventions of all - * other Abdera extensions. - * - * @author davidc - */ -public interface CMISConstants -{ - // Namespace - public static final String CMIS_200805_NS = "http://www.cmis.org/2008/05"; - - // Mimetypes - public static final String MIMETYPE_QUERY = "application/cmisquery+xml"; - public static final String MIMETYPE_ALLOWABLEACTIONS = "application/cmisallowableactions+xml"; - - // CMIS Service Document - public static final QName COLLECTION_TYPE = new QName(CMIS_200805_NS, "collectionType"); - public static final String COLLECTION_ROOT_CHILDREN = "root-children"; - public static final String COLLECTION_ROOT_DESCENDANTS = "root-descendants"; - public static final String COLLECTION_CHECKEDOUT = "checkedout"; - public static final String COLLECTION_UNFILED = "unfiled"; - public static final String COLLECTION_TYPES_CHILDREN = "types-children"; - public static final String COLLECTION_TYPES_DESCENDANTS = "types-descendants"; - public static final String COLLECTION_QUERY = "query"; - - // CMIS Repository Info - public static final QName REPOSITORY_INFO = new QName(CMIS_200805_NS, "repositoryInfo"); - public static final QName REPOSITORY_ID = new QName(CMIS_200805_NS, "repositoryId"); - public static final QName REPOSITORY_NAME = new QName(CMIS_200805_NS, "repositoryName"); - public static final QName REPOSITORY_DESCRIPTION = new QName(CMIS_200805_NS, "repositoryDescription"); - public static final QName REPOSITORY_SPECIFIC_INFO = new QName(CMIS_200805_NS, "repositorySpecificInformation"); - public static final QName VENDOR_NAME = new QName(CMIS_200805_NS, "vendorName"); - public static final QName PRODUCT_NAME = new QName(CMIS_200805_NS, "productName"); - public static final QName PRODUCT_VERSION = new QName(CMIS_200805_NS, "productVersion"); - public static final QName VERSIONS_SUPPORTED = new QName(CMIS_200805_NS, "cmisVersionsSupported"); - - // CMIS Capabilities - public static final QName CAPABILITIES = new QName(CMIS_200805_NS, "capabilities"); - public static final QName CAPABILITY_MULTIFILING = new QName(CMIS_200805_NS, "capabilityMultifiling"); - public static final QName CAPABILITY_UNFILING = new QName(CMIS_200805_NS, "capabilityUnfiling"); - public static final QName CAPABILITY_VERSION_SPECIFIC_FILING = new QName(CMIS_200805_NS, "capabilityVersionSpecificFiling"); - public static final QName CAPABILITY_PWC_UPDATEABLE = new QName(CMIS_200805_NS, "capabilityPWCUpdateable"); - public static final QName CAPABILITY_ALL_VERIONS_SEARCHABLE = new QName(CMIS_200805_NS, "capabilityAllVersionsSearchable"); - public static final QName CAPABILITY_JOIN = new QName(CMIS_200805_NS, "capabilityJoin"); - public static final QName CAPABILITY_FULLTEXT = new QName(CMIS_200805_NS, "capabilityFullText"); - - // CMIS Object - public static final QName OBJECT = new QName(CMIS_200805_NS, "object"); - public static final QName PROPERTIES = new QName(CMIS_200805_NS, "properties"); - public static final QName PROPERTY_NAME = new QName(CMIS_200805_NS, "name"); - public static final QName PROPERTY_VALUE = new QName(CMIS_200805_NS, "value"); - public static final QName PROPERTY_STRING = new QName(CMIS_200805_NS, "propertyString"); - public static final QName PROPERTY_DECIMAL = new QName(CMIS_200805_NS, "propertyDecimal"); - public static final QName PROPERTY_INTEGER = new QName(CMIS_200805_NS, "propertyInteger"); - public static final QName PROPERTY_BOOLEAN = new QName(CMIS_200805_NS, "propertyBoolean"); - public static final QName PROPERTY_DATETIME = new QName(CMIS_200805_NS, "propertyDateTime"); - public static final QName PROPERTY_URI = new QName(CMIS_200805_NS, "propertyUri"); - public static final QName PROPERTY_ID = new QName(CMIS_200805_NS, "propertyId"); - public static final QName PROPERTY_XML = new QName(CMIS_200805_NS, "propertyXml"); - public static final QName PROPERTY_HTML = new QName(CMIS_200805_NS, "propertyHtml"); - - // CMIS Relationships - public static final String REL_CHILDREN = "cmis-children"; - public static final String REL_DESCENDANTS = "cmis-descendants"; - public static final String REL_PARENT = "cmis-parent"; - public static final String REL_FOLDERPARENT = "cmis-folderparent"; - public static final String REL_PARENTS = "cmis-parents"; - public static final String REL_ALLVERSIONS = "cmis-allversions"; - public static final String REL_TYPE = "cmis-type"; - public static final String REL_SOURCE = "cmis-source"; - - // CMIS Nested Entry - public static final QName NESTED_ENTRY = Constants.ENTRY; - - - // CMIS Properties Names - public static final String PROP_NAME = "Name"; - public static final String PROP_OBJECT_ID = "ObjectId"; - public static final String PROP_BASETYPE = "BaseType"; - public static final String PROP_OBJECT_TYPE_ID = "ObjectTypeId"; - public static final String PROP_IS_IMMUTABLE = "IsImmutable"; - public static final String PROP_IS_LATEST_VERSION = "IsLatestVersion"; - public static final String PROP_IS_MAJOR_VERSION = "IsMajorVersion"; - public static final String PROP_IS_LATEST_MAJOR_VERSION = "IsLatestMajorVersion"; - public static final String PROP_VERSION_LABEL = "VersionLabel"; - public static final String PROP_VERSION_SERIES_ID = "VersionSeriesId"; - public static final String PROP_IS_VERSION_SERIES_CHECKED_OUT = "IsVersionSeriesCheckedOut"; - public static final String PROP_VERSION_SERIES_CHECKED_OUT_BY = "VersionSeriesCheckedOutBy"; - public static final String PROP_VERSION_SERIES_CHECKED_OUT_ID = "VersionSeriesCheckedOutId"; - public static final String PROP_CHECKIN_COMMENT = "CheckinComment"; - - // CMIS Property Types - public static final String PROP_TYPE_STRING = "string"; - public static final String PROP_TYPE_DECIMAL = "decimal"; - public static final String PROP_TYPE_INTEGER = "integer"; - public static final String PROP_TYPE_BOOLEAN = "boolean"; - public static final String PROP_TYPE_DATETIME = "datetime"; - public static final String PROP_TYPE_URI = "uri"; - public static final String PROP_TYPE_ID = "id"; - public static final String PROP_TYPE_XML = "xml"; - public static final String PROP_TYPE_HTML = "html"; - -} diff --git a/source/java/org/apache/abdera/ext/cmis/CMISExtensionFactory.java b/source/java/org/apache/abdera/ext/cmis/CMISExtensionFactory.java deleted file mode 100644 index df5fdb00bf..0000000000 --- a/source/java/org/apache/abdera/ext/cmis/CMISExtensionFactory.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2005-2008 Alfresco Software Limited. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - * As a special exception to the terms and conditions of version 2.0 of - * the GPL, you may redistribute this Program in connection with Free/Libre - * and Open Source Software ("FLOSS") applications as described in Alfresco's - * FLOSS exception. You should have recieved a copy of the text describing - * the FLOSS exception, and it is also available here: - * http://www.alfresco.com/legal/licensing" - */ -package org.apache.abdera.ext.cmis; - -import org.apache.abdera.ext.cmis.CMISProperty.CMISPropertyBoolean; -import org.apache.abdera.ext.cmis.CMISProperty.CMISPropertyDateTime; -import org.apache.abdera.ext.cmis.CMISProperty.CMISPropertyDecimal; -import org.apache.abdera.ext.cmis.CMISProperty.CMISPropertyHtml; -import org.apache.abdera.ext.cmis.CMISProperty.CMISPropertyId; -import org.apache.abdera.ext.cmis.CMISProperty.CMISPropertyInteger; -import org.apache.abdera.ext.cmis.CMISProperty.CMISPropertyString; -import org.apache.abdera.ext.cmis.CMISProperty.CMISPropertyUri; -import org.apache.abdera.ext.cmis.CMISProperty.CMISPropertyXml; -import org.apache.abdera.util.AbstractExtensionFactory; - - -/** - * CMIS Extension Factory for the Abdera ATOM Library. - * - * Encapsulates access and modification of CMIS extension values to ATOM. - * - * NOTE: Potentially, this extension can be contributed to Abdera upon - * publication of CMIS. This is why it is organised under a - * non-Alfresco Java package. It follows the conventions of all - * other Abdera extensions. - * - * @author davidc - */ -public class CMISExtensionFactory extends AbstractExtensionFactory - implements CMISConstants -{ - - public CMISExtensionFactory() - { - super(CMIS_200805_NS); - addImpl(REPOSITORY_INFO, CMISRepositoryInfo.class); - addImpl(CAPABILITIES, CMISCapabilities.class); - addImpl(OBJECT, CMISObject.class); - addImpl(PROPERTIES, CMISProperties.class); - addImpl(PROPERTY_STRING, CMISPropertyString.class); - addImpl(PROPERTY_DECIMAL, CMISPropertyDecimal.class); - addImpl(PROPERTY_INTEGER, CMISPropertyInteger.class); - addImpl(PROPERTY_BOOLEAN, CMISPropertyBoolean.class); - addImpl(PROPERTY_DATETIME, CMISPropertyDateTime.class); - addImpl(PROPERTY_URI, CMISPropertyUri.class); - addImpl(PROPERTY_ID, CMISPropertyId.class); - addImpl(PROPERTY_XML, CMISPropertyXml.class); - addImpl(PROPERTY_HTML, CMISPropertyHtml.class); - } - -} diff --git a/source/java/org/apache/abdera/ext/cmis/CMISObject.java b/source/java/org/apache/abdera/ext/cmis/CMISObject.java deleted file mode 100644 index 76dfbddc18..0000000000 --- a/source/java/org/apache/abdera/ext/cmis/CMISObject.java +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright (C) 2005-2008 Alfresco Software Limited. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - * As a special exception to the terms and conditions of version 2.0 of - * the GPL, you may redistribute this Program in connection with Free/Libre - * and Open Source Software ("FLOSS") applications as described in Alfresco's - * FLOSS exception. You should have recieved a copy of the text describing - * the FLOSS exception, and it is also available here: - * http://www.alfresco.com/legal/licensing" - */ -package org.apache.abdera.ext.cmis; - -import org.apache.abdera.factory.Factory; -import org.apache.abdera.model.Element; -import org.apache.abdera.model.ExtensibleElementWrapper; - - -/** - * CMIS Object for the Abdera ATOM library. - * - * Encapsulates access and modification of CMIS extension values to CMIS - * Object. - * - * NOTE: Potentially, this extension can be contributed to Abdera upon - * publication of CMIS. This is why it is organised under a - * non-Alfresco Java package. It follows the conventions of all - * other Abdera extensions. - * - * @author davidc - */ -public class CMISObject extends ExtensibleElementWrapper -{ - /** - * @param internal - */ - public CMISObject(Element internal) - { - super(internal); - } - - /** - * @param factory - */ - public CMISObject(Factory factory) - { - super(factory, CMISConstants.OBJECT); - } - - /** - * Gets all Properties for this CMIS Object - * - * @return properties - */ - public CMISProperties getProperties() - { - Element child = getFirstChild(CMISConstants.PROPERTIES); - if (child == null) - { - child = addExtension(CMISConstants.PROPERTIES); - } - return (CMISProperties)child; - } - - /** - * Gets name - * - * @return name property - */ - public CMISProperty getName() - { - return getProperties().find(CMISConstants.PROP_NAME); - } - - /** - * Gets id - * - * @return id property - */ - public CMISProperty getObjectId() - { - return getProperties().find(CMISConstants.PROP_OBJECT_ID); - } - - /** - * Gets base type - * - * @return base type property - */ - public CMISProperty getBaseType() - { - return getProperties().find(CMISConstants.PROP_BASETYPE); - } - - /** - * Gets object type - * - * @return object type property - */ - public CMISProperty getObjectTypeId() - { - return getProperties().find(CMISConstants.PROP_OBJECT_TYPE_ID); - } - - /** - * Is immutable? - * - * @return isImmutable property - */ - public CMISProperty isImmutable() - { - return getProperties().find(CMISConstants.PROP_IS_IMMUTABLE); - } - - /** - * Gets Latest Version - * - * @return latest version property - */ - public CMISProperty isLatestVersion() - { - return getProperties().find(CMISConstants.PROP_IS_LATEST_VERSION); - } - - /** - * Is Major Version? - * - * @return is major version property - */ - public CMISProperty isMajorVersion() - { - return getProperties().find(CMISConstants.PROP_IS_MAJOR_VERSION); - } - - /** - * Is Latest Major Version? - * - * @return is latest major version property - */ - public CMISProperty isLatestMajorVersion() - { - return getProperties().find(CMISConstants.PROP_IS_LATEST_MAJOR_VERSION); - } - - /** - * Version label - * - * @return version label property - */ - public CMISProperty getVersionLabel() - { - return getProperties().find(CMISConstants.PROP_VERSION_LABEL); - } - - /** - * Version series id - * - * @return version series id property - */ - public CMISProperty getVersionSeriesId() - { - return getProperties().find(CMISConstants.PROP_VERSION_SERIES_ID); - } - - /** - * Version Series Checked Out - * - * @return version series checked out property - */ - public CMISProperty isVersionSeriesCheckedOut() - { - return getProperties().find(CMISConstants.PROP_IS_VERSION_SERIES_CHECKED_OUT); - } - - /** - * Version Series Checked Out By - * - * @return version series checked out by property - */ - public CMISProperty getVersionSeriesCheckedOutBy() - { - return getProperties().find(CMISConstants.PROP_VERSION_SERIES_CHECKED_OUT_BY); - } - - /** - * Version Series Checked Out Id - * - * @return version series checked out id property - */ - public CMISProperty getVersionSeriesCheckedOutId() - { - return getProperties().find(CMISConstants.PROP_VERSION_SERIES_CHECKED_OUT_ID); - } - - /** - * Checkin Comment - * - * @return checkin comment property - */ - public CMISProperty getCheckinComment() - { - return getProperties().find(CMISConstants.PROP_CHECKIN_COMMENT); - } -} diff --git a/source/java/org/apache/abdera/ext/cmis/CMISProperties.java b/source/java/org/apache/abdera/ext/cmis/CMISProperties.java deleted file mode 100644 index 252ad3ca40..0000000000 --- a/source/java/org/apache/abdera/ext/cmis/CMISProperties.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (C) 2005-2008 Alfresco Software Limited. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - * As a special exception to the terms and conditions of version 2.0 of - * the GPL, you may redistribute this Program in connection with Free/Libre - * and Open Source Software ("FLOSS") applications as described in Alfresco's - * FLOSS exception. You should have recieved a copy of the text describing - * the FLOSS exception, and it is also available here: - * http://www.alfresco.com/legal/licensing" - */ -package org.apache.abdera.ext.cmis; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.abdera.factory.Factory; -import org.apache.abdera.model.Element; -import org.apache.abdera.model.ElementWrapper; - - -/** - * CMIS Properties Element Wrapper for the Abdera ATOM library. - * - * Encapsulates access and modification of CMIS extension values to ATOM. - * - * NOTE: Potentially, this extension can be contributed to Abdera upon - * publication of CMIS. This is why it is organised under a - * non-Alfresco Java package. It follows the conventions of all - * other Abdera extensions. - * - * @author davidc - */ -public class CMISProperties extends ElementWrapper -{ - /** - * @param internal - */ - public CMISProperties(Element internal) - { - super(internal); - } - - /** - * @param factory - */ - public CMISProperties(Factory factory) - { - super(factory, CMISConstants.PROPERTIES); - } - - /** - * Gets all property names - * - * @return list of property names - */ - public List getNames() - { - List props = getElements(); - List names = new ArrayList(props.size()); - for (CMISProperty prop : props) - { - names.add(prop.getName()); - } - return names; - } - - /** - * Finds property by name - * - * @param name property name - * @return property - */ - public CMISProperty find(String name) - { - List elements = getElements(); - for (Element element : elements) - { - if (element instanceof CMISProperty) - { - CMISProperty prop = (CMISProperty)element; - if (prop.getName().equals(name)) - { - return prop; - } - } - } - return null; - } - -} diff --git a/source/java/org/apache/abdera/ext/cmis/CMISProperty.java b/source/java/org/apache/abdera/ext/cmis/CMISProperty.java deleted file mode 100644 index 67e9eed24e..0000000000 --- a/source/java/org/apache/abdera/ext/cmis/CMISProperty.java +++ /dev/null @@ -1,387 +0,0 @@ -/* - * Copyright (C) 2005-2008 Alfresco Software Limited. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - * As a special exception to the terms and conditions of version 2.0 of - * the GPL, you may redistribute this Program in connection with Free/Libre - * and Open Source Software ("FLOSS") applications as described in Alfresco's - * FLOSS exception. You should have recieved a copy of the text describing - * the FLOSS exception, and it is also available here: - * http://www.alfresco.com/legal/licensing" - */ -package org.apache.abdera.ext.cmis; - -import java.math.BigDecimal; -import java.util.Date; - -import javax.xml.namespace.QName; - -import org.apache.abdera.factory.Factory; -import org.apache.abdera.model.Element; -import org.apache.abdera.model.ElementWrapper; - - -/** - * CMIS Property for the Abdera ATOM library. - * - * Encapsulates access and modification of CMIS extension values to CMIS - * Property. - * - * NOTE: Potentially, this extension can be contributed to Abdera upon - * publication of CMIS. This is why it is organised under a - * non-Alfresco Java package. It follows the conventions of all - * other Abdera extensions. - * - * @author davidc - */ -public abstract class CMISProperty extends ElementWrapper -{ - /** - * @param internal - */ - public CMISProperty(Element internal) - { - super(internal); - } - - /** - * @param factory - * @param qname - */ - public CMISProperty(Factory factory, QName qname) - { - super(factory, qname); - } - - /** - * Gets the property type - * - * @return type - */ - public abstract String getType(); - - /** - * Gets the property name - * - * @return name - */ - public String getName() - { - return getAttributeValue(CMISConstants.PROPERTY_NAME); - } - - /** - * Is property value null? - * - * @return true => null - */ - public boolean isNull() - { - return getFirstChild(CMISConstants.PROPERTY_VALUE) == null ? true : false; - } - - /** - * Gets property value (as String) - * - * @return property value (or null, if not specified) - */ - public String getValue() - { - Element child = getFirstChild(CMISConstants.PROPERTY_VALUE); - if (child != null) - { - return child.getText(); - } - return null; - } - - /** - * Gets String value - * - * @return string value - */ - public String getStringValue() - { - return getValue(); - } - - /** - * Gets Decimal value - * - * @return decimal value - */ - public BigDecimal getDecimalValue() - { - return new BigDecimal(getValue()); - } - - /** - * Gets Integer value - * - * @return integer value - */ - public int getIntegerValue() - { - return new Integer(getValue()); - } - - /** - * Gets Boolean value - * - * @return boolean value - */ - public boolean getBooleanValue() - { - return Boolean.valueOf(getValue()); - } - - /** - * Gets Date value - * - * @return date value - */ - public Date getDateValue() - { - // TODO: - return null; - } - - - /** - * String Property - */ - public static class CMISPropertyString extends CMISProperty - { - public CMISPropertyString(Element internal) - { - super(internal); - } - - public CMISPropertyString(Factory factory, QName qname) - { - super(factory, qname); - } - - /* (non-Javadoc) - * @see org.apache.abdera.ext.cmis.CMISProperty#getType() - */ - @Override - public String getType() - { - return CMISConstants.PROP_TYPE_STRING; - } - } - - /** - * Decimal Property - */ - public static class CMISPropertyDecimal extends CMISProperty - { - public CMISPropertyDecimal(Element internal) - { - super(internal); - } - - public CMISPropertyDecimal(Factory factory, QName qname) - { - super(factory, qname); - } - - /* (non-Javadoc) - * @see org.apache.abdera.ext.cmis.CMISProperty#getType() - */ - @Override - public String getType() - { - return CMISConstants.PROP_TYPE_DECIMAL; - } - } - - /** - * Integer Property - */ - public static class CMISPropertyInteger extends CMISProperty - { - public CMISPropertyInteger(Element internal) - { - super(internal); - } - - public CMISPropertyInteger(Factory factory, QName qname) - { - super(factory, qname); - } - - /* (non-Javadoc) - * @see org.apache.abdera.ext.cmis.CMISProperty#getType() - */ - @Override - public String getType() - { - return CMISConstants.PROP_TYPE_INTEGER; - } - } - - /** - * Boolean Property - */ - public static class CMISPropertyBoolean extends CMISProperty - { - public CMISPropertyBoolean(Element internal) - { - super(internal); - } - - public CMISPropertyBoolean(Factory factory, QName qname) - { - super(factory, qname); - } - - /* (non-Javadoc) - * @see org.apache.abdera.ext.cmis.CMISProperty#getType() - */ - @Override - public String getType() - { - return CMISConstants.PROP_TYPE_BOOLEAN; - } - } - - /** - * DateTime Property - */ - public static class CMISPropertyDateTime extends CMISProperty - { - public CMISPropertyDateTime(Element internal) - { - super(internal); - } - - public CMISPropertyDateTime(Factory factory, QName qname) - { - super(factory, qname); - } - - /* (non-Javadoc) - * @see org.apache.abdera.ext.cmis.CMISProperty#getType() - */ - @Override - public String getType() - { - return CMISConstants.PROP_TYPE_DATETIME; - } - } - - /** - * URI Property - */ - public static class CMISPropertyUri extends CMISPropertyString - { - public CMISPropertyUri(Element internal) - { - super(internal); - } - - public CMISPropertyUri(Factory factory, QName qname) - { - super(factory, qname); - } - - /* (non-Javadoc) - * @see org.apache.abdera.ext.cmis.CMISProperty.CMISPropertyString#getType() - */ - @Override - public String getType() - { - return CMISConstants.PROP_TYPE_URI; - } - } - - /** - * ID Property - */ - public static class CMISPropertyId extends CMISPropertyString - { - public CMISPropertyId(Element internal) - { - super(internal); - } - - public CMISPropertyId(Factory factory, QName qname) - { - super(factory, qname); - } - - /* (non-Javadoc) - * @see org.apache.abdera.ext.cmis.CMISProperty.CMISPropertyString#getType() - */ - @Override - public String getType() - { - return CMISConstants.PROP_TYPE_ID; - } - } - - /** - * XML Property - */ - public static class CMISPropertyXml extends CMISPropertyString - { - public CMISPropertyXml(Element internal) - { - super(internal); - } - - public CMISPropertyXml(Factory factory, QName qname) - { - super(factory, qname); - } - - /* (non-Javadoc) - * @see org.apache.abdera.ext.cmis.CMISProperty.CMISPropertyString#getType() - */ - @Override - public String getType() - { - return CMISConstants.PROP_TYPE_XML; - } - } - - /** - * HTML Property - */ - public static class CMISPropertyHtml extends CMISPropertyString - { - public CMISPropertyHtml(Element internal) - { - super(internal); - } - - public CMISPropertyHtml(Factory factory, QName qname) - { - super(factory, qname); - } - - /* (non-Javadoc) - * @see org.apache.abdera.ext.cmis.CMISProperty.CMISPropertyString#getType() - */ - @Override - public String getType() - { - return CMISConstants.PROP_TYPE_HTML; - } - } -} diff --git a/source/java/org/apache/abdera/ext/cmis/CMISRepositoryInfo.java b/source/java/org/apache/abdera/ext/cmis/CMISRepositoryInfo.java deleted file mode 100644 index 31ab8c9130..0000000000 --- a/source/java/org/apache/abdera/ext/cmis/CMISRepositoryInfo.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (C) 2005-2008 Alfresco Software Limited. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - * As a special exception to the terms and conditions of version 2.0 of - * the GPL, you may redistribute this Program in connection with Free/Libre - * and Open Source Software ("FLOSS") applications as described in Alfresco's - * FLOSS exception. You should have recieved a copy of the text describing - * the FLOSS exception, and it is also available here: - * http://www.alfresco.com/legal/licensing" - */ -package org.apache.abdera.ext.cmis; - -import org.apache.abdera.factory.Factory; -import org.apache.abdera.model.Element; -import org.apache.abdera.model.ElementWrapper; - - -/** - * CMIS Repository Info for the Abdera ATOM library. - * - * Encapsulates access and modification of CMIS extension values to ATOM - * Service Document. - * - * NOTE: Potentially, this extension can be contributed to Abdera upon - * publication of CMIS. This is why it is organised under a - * non-Alfresco Java package. It follows the conventions of all - * other Abdera extensions. - * - * @author davidc - */ -public class CMISRepositoryInfo extends ElementWrapper -{ - public CMISRepositoryInfo(Element internal) - { - super(internal); - } - - public CMISRepositoryInfo(Factory factory) - { - super(factory, CMISConstants.REPOSITORY_INFO); - } - - - public String getId() - { - Element child = getFirstChild(CMISConstants.REPOSITORY_ID); - if (child != null) - { - return child.getText(); - } - return null; - } - - public String getName() - { - Element child = getFirstChild(CMISConstants.REPOSITORY_NAME); - if (child != null) - { - return child.getText(); - } - return null; - } - - public String getDescription() - { - Element child = getFirstChild(CMISConstants.REPOSITORY_DESCRIPTION); - if (child != null) - { - return child.getText(); - } - return null; - } - - public Element getSpecificInfo() - { - return getFirstChild(CMISConstants.REPOSITORY_SPECIFIC_INFO); - } - - public String getVendorName() - { - Element child = getFirstChild(CMISConstants.VENDOR_NAME); - if (child != null) - { - return child.getText(); - } - return null; - } - - public String getProdutName() - { - Element child = getFirstChild(CMISConstants.PRODUCT_NAME); - if (child != null) - { - return child.getText(); - } - return null; - } - - public String getProdutVersion() - { - Element child = getFirstChild(CMISConstants.PRODUCT_VERSION); - if (child != null) - { - return child.getText(); - } - return null; - } - - public String getVersionsSupported() - { - Element child = getFirstChild(CMISConstants.VERSIONS_SUPPORTED); - if (child != null) - { - return child.getText(); - } - return null; - } - - public CMISCapabilities getCapabilities() - { - Element child = getFirstChild(CMISConstants.CAPABILITIES); - if (child != null) - { - return (CMISCapabilities)child; - } - return null; - } -}