mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged CMIS063 to HEAD
17100: Chemistry: AtomPub TCK updates, Alfresco CMIS URL bindings, Delete Content Stream git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@17258 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -40,7 +40,8 @@
|
||||
|
||||
<bean id="CMISService" class="org.alfresco.cmis.mapping.CMISServicesImpl">
|
||||
<property name="CMISSpecVersion"><value>0.7</value></property>
|
||||
<property name="defaultRootPath"><value>workspace/SpacesStore/Company Home</value></property>
|
||||
<property name="defaultStore"><value>workspace://SpacesStore</value></property>
|
||||
<property name="defaultRootPath"><value>/Company Home</value></property>
|
||||
<property name="dictionaryService" ref="dictionaryService" />
|
||||
<property name="CMISDictionaryService" ref="CMISDictionaryService" />
|
||||
<property name="searchService" ref="SearchService" />
|
||||
@@ -69,6 +70,7 @@
|
||||
<property name="models">
|
||||
<list>
|
||||
<value>alfresco/model/cmisModel.xml</value>
|
||||
<value>alfresco/model/cmisTestModel.xml</value>
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
@@ -91,6 +93,10 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="CMISReferenceFactory" class="org.alfresco.cmis.reference.ReferenceFactory">
|
||||
<property name="CMISService" ref="CMISService" />
|
||||
<property name="CMISDictionaryService" ref="CMISDictionaryService" />
|
||||
</bean>
|
||||
|
||||
<bean id="adm.luceneQueryEngine" class="org.springframework.aop.framework.ProxyFactoryBean">
|
||||
<property name="proxyInterfaces">
|
||||
|
61
config/alfresco/model/cmisTestModel.xml
Normal file
61
config/alfresco/model/cmisTestModel.xml
Normal file
@@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<model name="cmiscustom:model" xmlns="http://www.alfresco.org/model/dictionary/1.0">
|
||||
|
||||
<description>CMIS Custom Model</description>
|
||||
<author>Alfresco</author>
|
||||
<version>1.0</version>
|
||||
|
||||
<imports>
|
||||
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
|
||||
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
|
||||
<import uri="http://www.alfresco.org/model/system/1.0" prefix="sys"/>
|
||||
</imports>
|
||||
|
||||
<namespaces>
|
||||
<namespace uri="http://www.alfresco.org/model/cmis/custom" prefix="cmiscustom"/>
|
||||
</namespaces>
|
||||
|
||||
<types>
|
||||
<type name="cmiscustom:folder">
|
||||
<title>Custom Folder</title>
|
||||
<parent>cm:folder</parent>
|
||||
<properties>
|
||||
<property name="cmiscustom:folderprop_string">
|
||||
<title>Custom Folder Property (string)</title>
|
||||
<type>d:text</type>
|
||||
</property>
|
||||
</properties>
|
||||
</type>
|
||||
|
||||
<type name="cmiscustom:document">
|
||||
<title>Custom Document</title>
|
||||
<parent>cm:content</parent>
|
||||
<properties>
|
||||
<property name="cmiscustom:docprop_string">
|
||||
<title>Custom Document Property (string)</title>
|
||||
<type>d:text</type>
|
||||
</property>
|
||||
<property name="cmiscustom:docprop_boolean_multi">
|
||||
<title>Custom Document Property (multi-valued boolean)</title>
|
||||
<type>d:boolean</type>
|
||||
<multiple>true</multiple>
|
||||
</property>
|
||||
</properties>
|
||||
<associations>
|
||||
<association name="cmiscustom:assoc">
|
||||
<source>
|
||||
<mandatory>false</mandatory>
|
||||
<many>false</many>
|
||||
</source>
|
||||
<target>
|
||||
<class>cm:content</class>
|
||||
<mandatory>false</mandatory>
|
||||
<many>true</many>
|
||||
</target>
|
||||
</association>
|
||||
</associations>
|
||||
</type>
|
||||
</types>
|
||||
|
||||
</model>
|
@@ -11,11 +11,11 @@ version.label=r2
|
||||
|
||||
# Edition label
|
||||
|
||||
version.edition=Enterprise
|
||||
version.edition=Community
|
||||
|
||||
# Build number
|
||||
|
||||
version.build=r17008
|
||||
version.build=@build-number@
|
||||
|
||||
# Schema number
|
||||
|
||||
|
45
source/java/org/alfresco/cmis/CMISObjectReference.java
Normal file
45
source/java/org/alfresco/cmis/CMISObjectReference.java
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* 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.alfresco.cmis;
|
||||
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
|
||||
/**
|
||||
* CMIS Object Reference (mapping to Node Ref)
|
||||
*
|
||||
* @author davidc
|
||||
*/
|
||||
public interface CMISObjectReference
|
||||
{
|
||||
/**
|
||||
* @return repository reference
|
||||
*/
|
||||
public CMISRepositoryReference getRepositoryReference();
|
||||
|
||||
/**
|
||||
* @return node reference
|
||||
*/
|
||||
public NodeRef getNodeRef();
|
||||
}
|
46
source/java/org/alfresco/cmis/CMISRelationshipReference.java
Normal file
46
source/java/org/alfresco/cmis/CMISRelationshipReference.java
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* 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.alfresco.cmis;
|
||||
|
||||
import org.alfresco.service.cmr.repository.AssociationRef;
|
||||
|
||||
|
||||
/**
|
||||
* CMIS Relationship Reference (mapping to Association Ref)
|
||||
*
|
||||
* @author davidc
|
||||
*/
|
||||
public interface CMISRelationshipReference
|
||||
{
|
||||
/**
|
||||
* @return repository reference
|
||||
*/
|
||||
public CMISRepositoryReference getRepositoryReference();
|
||||
|
||||
/**
|
||||
* @return association reference
|
||||
*/
|
||||
public AssociationRef getAssocRef();
|
||||
}
|
41
source/java/org/alfresco/cmis/CMISRepositoryReference.java
Normal file
41
source/java/org/alfresco/cmis/CMISRepositoryReference.java
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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.alfresco.cmis;
|
||||
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
|
||||
|
||||
/**
|
||||
* CMIS Repository Reference (mapping to Store Ref)
|
||||
*
|
||||
* @author davidc
|
||||
*/
|
||||
public interface CMISRepositoryReference
|
||||
{
|
||||
/**
|
||||
* @return store reference
|
||||
*/
|
||||
public abstract StoreRef getStoreRef();
|
||||
}
|
@@ -67,6 +67,15 @@ public interface CMISServices
|
||||
*/
|
||||
public StoreRef getDefaultRootStoreRef();
|
||||
|
||||
/**
|
||||
* Finds a NodeRef given a repository reference
|
||||
*
|
||||
* @param referenceType node, path
|
||||
* @param reference node => id, path => path
|
||||
* @return nodeRef (or null, if not found)
|
||||
*/
|
||||
public NodeRef getNode(String referenceType, String[] reference);
|
||||
|
||||
/**
|
||||
* Query for node children
|
||||
*
|
||||
|
@@ -116,6 +116,7 @@ public class CMISServicesImpl implements CMISServices, ApplicationContextAware,
|
||||
private String cmisVersion = "[undefined]";
|
||||
|
||||
// default CMIS store and path
|
||||
private StoreRef defaultStoreRef;
|
||||
private String defaultRootPath;
|
||||
private Map<String, NodeRef> defaultRootNodeRefs;
|
||||
|
||||
@@ -134,12 +135,20 @@ public class CMISServicesImpl implements CMISServices, ApplicationContextAware,
|
||||
this.cmisVersion = cmisVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the default root store
|
||||
*
|
||||
* @param store store_type://store_id
|
||||
*/
|
||||
public void setDefaultStore(String store)
|
||||
{
|
||||
this.defaultStoreRef = new StoreRef(store);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the default root path
|
||||
*
|
||||
* store_type/store_id/path...
|
||||
*
|
||||
* @param path store_type/store_id/path...
|
||||
* @param path path within default store
|
||||
*/
|
||||
public void setDefaultRootPath(String path)
|
||||
{
|
||||
@@ -312,8 +321,9 @@ public class CMISServicesImpl implements CMISServices, ApplicationContextAware,
|
||||
return retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback<NodeRef>()
|
||||
{
|
||||
public NodeRef execute() throws Exception
|
||||
{
|
||||
return repository.findNodeRef("path", defaultRootPath.split("/"));
|
||||
{
|
||||
String path = defaultStoreRef.getProtocol() + "/" + defaultStoreRef.getIdentifier() + defaultRootPath;
|
||||
return repository.findNodeRef("path", path.split("/"));
|
||||
};
|
||||
});
|
||||
}
|
||||
@@ -337,6 +347,16 @@ public class CMISServicesImpl implements CMISServices, ApplicationContextAware,
|
||||
return getDefaultRootNodeRef().getStoreRef();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.alfresco.cmis.CMISServices#getNode(java.lang.String, java.lang.String[])
|
||||
*/
|
||||
public NodeRef getNode(String referenceType, String[] reference)
|
||||
{
|
||||
NodeRef nodeRef = repository.findNodeRef(referenceType, reference);
|
||||
return nodeRef;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.alfresco.cmis.CMISServices#getChildren(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.cmis.CMISTypesFilterEnum)
|
||||
|
@@ -78,7 +78,7 @@ public class ObjectIdProperty extends AbstractProperty
|
||||
String versionLabel = DefaultTypeConverter.INSTANCE.convert(String.class, value);
|
||||
StringBuilder builder = new StringBuilder(128);
|
||||
builder.append(nodeRef.toString());
|
||||
builder.append("/");
|
||||
builder.append(";");
|
||||
builder.append(versionLabel);
|
||||
return builder.toString();
|
||||
}
|
||||
|
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 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.alfresco.cmis.reference;
|
||||
|
||||
import org.alfresco.cmis.CMISRepositoryReference;
|
||||
import org.alfresco.cmis.CMISServices;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
|
||||
|
||||
/**
|
||||
* AVM Path Reference
|
||||
*
|
||||
* @author davidc
|
||||
*/
|
||||
public class AVMPathReference extends ObjectPathReference
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param cmisServices
|
||||
* @param repo
|
||||
* @param path
|
||||
*/
|
||||
public AVMPathReference(CMISServices cmisServices, CMISRepositoryReference repo, String path)
|
||||
{
|
||||
super(cmisServices, repo, path);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.alfresco.cmis.reference.ObjectPathReference#getNodeRef()
|
||||
*/
|
||||
public NodeRef getNodeRef()
|
||||
{
|
||||
return cmisServices.getNode("avmpath", reference);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "AVMPathReference[storeRef=" + repo.getStoreRef() + ",path=" + path + "]";
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 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.alfresco.cmis.reference;
|
||||
|
||||
import org.alfresco.cmis.CMISObjectReference;
|
||||
import org.alfresco.cmis.CMISRepositoryReference;
|
||||
import org.alfresco.cmis.CMISServices;
|
||||
|
||||
|
||||
/**
|
||||
* Abstract Object Reference
|
||||
*
|
||||
* @author davidc
|
||||
*/
|
||||
public abstract class AbstractObjectReference implements CMISObjectReference
|
||||
{
|
||||
protected CMISServices cmisServices;
|
||||
protected CMISRepositoryReference repo;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param cmisServices
|
||||
* @param repo
|
||||
*/
|
||||
public AbstractObjectReference(CMISServices cmisServices, CMISRepositoryReference repo)
|
||||
{
|
||||
this.cmisServices = cmisServices;
|
||||
this.repo = repo;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.alfresco.cmis.CMISObjectReference#getRepositoryReference()
|
||||
*/
|
||||
public CMISRepositoryReference getRepositoryReference()
|
||||
{
|
||||
return repo;
|
||||
}
|
||||
}
|
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 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.alfresco.cmis.reference;
|
||||
|
||||
import org.alfresco.cmis.CMISRepositoryReference;
|
||||
import org.alfresco.cmis.CMISServices;
|
||||
|
||||
|
||||
/**
|
||||
* Abstract Repository Reference
|
||||
*
|
||||
* @author davidc
|
||||
*/
|
||||
public abstract class AbstractRepositoryReference implements CMISRepositoryReference
|
||||
{
|
||||
protected CMISServices cmisServices;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param cmisServices
|
||||
*/
|
||||
public AbstractRepositoryReference(CMISServices cmisServices)
|
||||
{
|
||||
this.cmisServices = cmisServices;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return getStoreRef().toString();
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 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.alfresco.cmis.reference;
|
||||
|
||||
import org.alfresco.cmis.CMISServices;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
|
||||
|
||||
/**
|
||||
* Default Repository Reference
|
||||
*
|
||||
* @author davidc
|
||||
*/
|
||||
public class DefaultRepositoryReference extends AbstractRepositoryReference
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param cmisServices
|
||||
*/
|
||||
public DefaultRepositoryReference(CMISServices cmisServices)
|
||||
{
|
||||
super(cmisServices);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.alfresco.cmis.CMISRepositoryReference#getStoreRef()
|
||||
*/
|
||||
public StoreRef getStoreRef()
|
||||
{
|
||||
return cmisServices.getDefaultRootStoreRef();
|
||||
}
|
||||
|
||||
}
|
110
source/java/org/alfresco/cmis/reference/NodeRefReference.java
Normal file
110
source/java/org/alfresco/cmis/reference/NodeRefReference.java
Normal file
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 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.alfresco.cmis.reference;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.alfresco.cmis.CMISObjectReference;
|
||||
import org.alfresco.cmis.CMISRepositoryReference;
|
||||
import org.alfresco.cmis.CMISServices;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
|
||||
/**
|
||||
* NodeRef Object Reference
|
||||
*
|
||||
* NOTE: Also takes into account versioned NodeRefs - protocol://store/id;version
|
||||
*
|
||||
* @author davidc
|
||||
*/
|
||||
public class NodeRefReference implements CMISObjectReference
|
||||
{
|
||||
// versioned objectId pattern
|
||||
// TODO: encapsulate elsewhere
|
||||
private static final Pattern versionedNodeRefPattern = Pattern.compile(".+://.+/.+;.+");
|
||||
private ObjectIdReference reference;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param cmisServices
|
||||
* @param nodeRef
|
||||
* @param version
|
||||
*/
|
||||
public NodeRefReference(CMISServices cmisServices, NodeRef nodeRef, String version)
|
||||
{
|
||||
CMISRepositoryReference repo = new StoreRepositoryReference(cmisServices, nodeRef.getStoreRef());
|
||||
reference = new ObjectIdReference(cmisServices, repo, nodeRef.getId() + ";" + version);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param cmisServices
|
||||
* @param nodeRefStr
|
||||
*/
|
||||
public NodeRefReference(CMISServices cmisServices, String nodeRefStr)
|
||||
{
|
||||
NodeRef nodeRef;
|
||||
String version = null;
|
||||
if (versionedNodeRefPattern.matcher(nodeRefStr).matches())
|
||||
{
|
||||
int vIdx = nodeRefStr.lastIndexOf(";");
|
||||
nodeRef = new NodeRef(nodeRefStr.substring(0, vIdx));
|
||||
version = nodeRefStr.substring(vIdx +1);
|
||||
}
|
||||
else
|
||||
{
|
||||
nodeRef = new NodeRef(nodeRefStr);
|
||||
}
|
||||
|
||||
CMISRepositoryReference repo = new StoreRepositoryReference(cmisServices, nodeRef.getStoreRef());
|
||||
reference = new ObjectIdReference(cmisServices, repo, nodeRef.getId() + ";" + version);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.alfresco.cmis.CMISObjectReference#getRepositoryReference()
|
||||
*/
|
||||
public CMISRepositoryReference getRepositoryReference()
|
||||
{
|
||||
return reference.getRepositoryReference();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.alfresco.cmis.CMISObjectReference#getNodeRef()
|
||||
*/
|
||||
public NodeRef getNodeRef()
|
||||
{
|
||||
return reference.getNodeRef();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return reference.toString();
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 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.alfresco.cmis.reference;
|
||||
|
||||
import org.alfresco.cmis.CMISRepositoryReference;
|
||||
import org.alfresco.cmis.CMISServices;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
|
||||
|
||||
/**
|
||||
* GUID Object Reference
|
||||
*
|
||||
* @author davidc
|
||||
*/
|
||||
public class ObjectIdReference extends AbstractObjectReference
|
||||
{
|
||||
private String id;
|
||||
private String version;
|
||||
private String[] reference;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param cmisServices
|
||||
* @param repo
|
||||
* @param id
|
||||
*/
|
||||
public ObjectIdReference(CMISServices cmisServices, CMISRepositoryReference repo, String id)
|
||||
{
|
||||
super(cmisServices, repo);
|
||||
|
||||
int vIdx = id.lastIndexOf(";");
|
||||
if (vIdx != -1)
|
||||
{
|
||||
this.id = id.substring(0, vIdx);
|
||||
this.version = id.substring(vIdx +1);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.id = id;
|
||||
this.version = null;
|
||||
}
|
||||
|
||||
StoreRef storeRef = repo.getStoreRef();
|
||||
reference = new String[] {storeRef.getProtocol(), storeRef.getIdentifier(), this.id};
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.alfresco.cmis.CMISObjectReference#getNodeRef()
|
||||
*/
|
||||
public NodeRef getNodeRef()
|
||||
{
|
||||
return cmisServices.getNode("node", reference);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return id
|
||||
*/
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "ObjectIdReference[storeRef=" + repo.getStoreRef() + ",id=" + id + ",v=" + (version == null ? "<unspecified>" : version) + "]";
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 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.alfresco.cmis.reference;
|
||||
|
||||
import org.alfresco.cmis.CMISRepositoryReference;
|
||||
import org.alfresco.cmis.CMISServices;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
|
||||
|
||||
/**
|
||||
* Path Object Reference
|
||||
*
|
||||
* @author davidc
|
||||
*/
|
||||
public class ObjectPathReference extends AbstractObjectReference
|
||||
{
|
||||
protected String path;
|
||||
protected String[] reference;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param cmisServices
|
||||
* @param repo
|
||||
* @param path
|
||||
*/
|
||||
public ObjectPathReference(CMISServices cmisServices, CMISRepositoryReference repo, String path)
|
||||
{
|
||||
super(cmisServices, repo);
|
||||
this.path = path.startsWith("/") ? path : "/" + path;
|
||||
this.path = (!cmisServices.getDefaultRootPath().equals("/")) ? cmisServices.getDefaultRootPath() + this.path : this.path;
|
||||
String[] splitPath = this.path.split("/");
|
||||
String[] pathSegments = new String[splitPath.length -1];
|
||||
System.arraycopy(splitPath, 1, pathSegments, 0, splitPath.length -1);
|
||||
this.reference = new String[2 + pathSegments.length];
|
||||
StoreRef storeRef = repo.getStoreRef();
|
||||
reference[0] = storeRef.getProtocol();
|
||||
reference[1] = storeRef.getIdentifier();
|
||||
System.arraycopy(pathSegments, 0, reference, 2, pathSegments.length);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.alfresco.cmis.CMISObjectReference#getNodeRef()
|
||||
*/
|
||||
public NodeRef getNodeRef()
|
||||
{
|
||||
return cmisServices.getNode("path", reference);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return path
|
||||
*/
|
||||
public String getPath()
|
||||
{
|
||||
return path;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "ObjectPathReference[storeRef=" + repo.getStoreRef() + ",path=" + path + "]";
|
||||
}
|
||||
|
||||
}
|
180
source/java/org/alfresco/cmis/reference/ReferenceFactory.java
Normal file
180
source/java/org/alfresco/cmis/reference/ReferenceFactory.java
Normal file
@@ -0,0 +1,180 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 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.alfresco.cmis.reference;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.cmis.CMISDictionaryModel;
|
||||
import org.alfresco.cmis.CMISDictionaryService;
|
||||
import org.alfresco.cmis.CMISObjectReference;
|
||||
import org.alfresco.cmis.CMISRelationshipReference;
|
||||
import org.alfresco.cmis.CMISRepositoryReference;
|
||||
import org.alfresco.cmis.CMISServices;
|
||||
import org.alfresco.cmis.CMISTypeDefinition;
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
|
||||
|
||||
/**
|
||||
* Reference Factory
|
||||
*
|
||||
* @author davidc
|
||||
*/
|
||||
public class ReferenceFactory
|
||||
{
|
||||
private CMISServices cmisService;
|
||||
private CMISDictionaryService cmisDictionary;
|
||||
|
||||
/**
|
||||
* @param cmisService
|
||||
*/
|
||||
public void setCMISService(CMISServices cmisService)
|
||||
{
|
||||
this.cmisService = cmisService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cmisDictionary
|
||||
*/
|
||||
public void setCMISDictionaryService(CMISDictionaryService cmisDictionary)
|
||||
{
|
||||
this.cmisDictionary = cmisDictionary;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create CMIS Repository Reference from URL segments
|
||||
*
|
||||
* @param args url arguments
|
||||
* @param templateArgs url template arguments
|
||||
* @return Repository Reference (or null, in case of bad url)
|
||||
*/
|
||||
public CMISRepositoryReference createRepoReferenceFromUrl(Map<String, String> args, Map<String, String> templateArgs)
|
||||
{
|
||||
String store_type = templateArgs.get("store_type");
|
||||
String store_id = templateArgs.get("store_id");
|
||||
if (store_type != null && store_id != null)
|
||||
{
|
||||
return new StoreRepositoryReference(cmisService, store_type + ":" + store_id);
|
||||
}
|
||||
|
||||
String store = templateArgs.get("store");
|
||||
if (store != null)
|
||||
{
|
||||
return new StoreRepositoryReference(cmisService, store);
|
||||
}
|
||||
|
||||
// TODO: repository id
|
||||
// String repoId = templateArgs.get("repo");
|
||||
// else if (repoId != null)
|
||||
// {
|
||||
// }
|
||||
|
||||
return new DefaultRepositoryReference(cmisService);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create CMIS Object Reference from URL segments
|
||||
*
|
||||
* @param args url arguments
|
||||
* @param templateArgs url template arguments
|
||||
* @return Repository Reference (or null, in case of bad url)
|
||||
*/
|
||||
public CMISObjectReference createObjectReferenceFromUrl(Map<String, String> args, Map<String, String> templateArgs)
|
||||
{
|
||||
String nodeRef = args.get("noderef");
|
||||
if (nodeRef != null)
|
||||
{
|
||||
return new NodeRefReference(cmisService, nodeRef);
|
||||
}
|
||||
|
||||
CMISRepositoryReference repo = createRepoReferenceFromUrl(args, templateArgs);
|
||||
String id = templateArgs.get("id");
|
||||
if (id != null)
|
||||
{
|
||||
return new ObjectIdReference(cmisService, repo, id);
|
||||
}
|
||||
|
||||
String path = templateArgs.get("path");
|
||||
if (path == null)
|
||||
{
|
||||
path = args.get("path");
|
||||
}
|
||||
if (path != null)
|
||||
{
|
||||
return new ObjectPathReference(cmisService, repo, path);
|
||||
}
|
||||
|
||||
String avmPath = templateArgs.get("avmpath");
|
||||
if (avmPath != null)
|
||||
{
|
||||
return new AVMPathReference(cmisService, repo, avmPath);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create CMIS Relationship Reference from URL segments
|
||||
*
|
||||
* @param args url arguments
|
||||
* @param templateArgs url template arguments
|
||||
* @return Repository Reference (or null, in case of bad url)
|
||||
*/
|
||||
public CMISRelationshipReference createRelationshipReferenceFromUrl(Map<String, String> args, Map<String, String> templateArgs)
|
||||
{
|
||||
// retrieve relationship type definition
|
||||
CMISTypeDefinition typeDefinition = null;
|
||||
String relType = templateArgs.get("rel_type");
|
||||
if (relType != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
typeDefinition = cmisDictionary.findType(relType);
|
||||
}
|
||||
catch(AlfrescoRuntimeException e) {}
|
||||
}
|
||||
if (typeDefinition == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (!typeDefinition.getBaseType().getTypeId().equals(CMISDictionaryModel.RELATIONSHIP_TYPE_ID))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// retrieve source / target nodes
|
||||
String srcStore = templateArgs.get("store");
|
||||
String srcId = templateArgs.get("id");
|
||||
String tgtStore = templateArgs.get("target_store");
|
||||
String tgtId = templateArgs.get("target_id");
|
||||
|
||||
if (srcStore != null && srcId != null && tgtStore != null && tgtId != null)
|
||||
{
|
||||
return new SourceTypeTargetRelationshipReference(cmisService, typeDefinition, srcStore, srcId, tgtStore, tgtId);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 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.alfresco.cmis.reference;
|
||||
|
||||
import org.alfresco.cmis.CMISRelationshipReference;
|
||||
import org.alfresco.cmis.CMISRepositoryReference;
|
||||
import org.alfresco.cmis.CMISServices;
|
||||
import org.alfresco.cmis.CMISTypeDefinition;
|
||||
import org.alfresco.service.cmr.repository.AssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
|
||||
|
||||
/**
|
||||
* Source Node / Rel Type / Target Node Relationship Reference
|
||||
*
|
||||
* @author davidc
|
||||
*/
|
||||
public class SourceTypeTargetRelationshipReference implements CMISRelationshipReference
|
||||
{
|
||||
protected CMISServices cmisServices;
|
||||
protected StoreRepositoryReference repo;
|
||||
protected CMISTypeDefinition type;
|
||||
protected NodeRef source;
|
||||
protected NodeRef target;
|
||||
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param cmisServices
|
||||
* @param type
|
||||
* @param srcStore
|
||||
* @param srcId
|
||||
* @param tgtStore
|
||||
* @param tgtId
|
||||
*/
|
||||
public SourceTypeTargetRelationshipReference(CMISServices cmisServices, CMISTypeDefinition type, String srcStore, String srcId, String tgtStore, String tgtId)
|
||||
{
|
||||
this.cmisServices = cmisServices;
|
||||
this.repo = new StoreRepositoryReference(cmisServices, srcStore);
|
||||
this.type = type;
|
||||
this.source = new NodeRef(repo.getStoreRef(), srcId);
|
||||
StoreRepositoryReference tgtStoreRef = new StoreRepositoryReference(cmisServices, tgtStore);
|
||||
this.target = new NodeRef(tgtStoreRef.getStoreRef(), tgtId);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.alfresco.cmis.CMISRelationshipReference#getRepositoryReference()
|
||||
*/
|
||||
public CMISRepositoryReference getRepositoryReference()
|
||||
{
|
||||
return repo;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.alfresco.cmis.CMISRelationshipReference#getAssocRef()
|
||||
*/
|
||||
public AssociationRef getAssocRef()
|
||||
{
|
||||
return cmisServices.getRelationship(type, source, target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "SourceTypeTargetRelationshipReference[type=" + type.getTypeId().getId() + ",source=" + source.toString() + ",target=" + target.toString() + "]";
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2007 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.alfresco.cmis.reference;
|
||||
|
||||
import org.alfresco.cmis.CMISServices;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
|
||||
|
||||
/**
|
||||
* Store Ref Repository Reference
|
||||
*
|
||||
* @author davidc
|
||||
*/
|
||||
public class StoreRepositoryReference extends AbstractRepositoryReference
|
||||
{
|
||||
private StoreRef storeRef;
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param cmisServices
|
||||
* @param storeRef
|
||||
*/
|
||||
public StoreRepositoryReference(CMISServices cmisServices, StoreRef storeRef)
|
||||
{
|
||||
super(cmisServices);
|
||||
this.storeRef = storeRef;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param cmisServices
|
||||
* @param store accept storeType://storeId, storeType:storeId, storeId
|
||||
*/
|
||||
public StoreRepositoryReference(CMISServices cmisServices, String store)
|
||||
{
|
||||
super(cmisServices);
|
||||
|
||||
if (store.indexOf(StoreRef.URI_FILLER) != -1)
|
||||
{
|
||||
storeRef = new StoreRef(store);
|
||||
}
|
||||
else if (store.indexOf(':') != -1)
|
||||
{
|
||||
String[] storeParts = store.split(":");
|
||||
storeRef = new StoreRef(storeParts[0], storeParts[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
storeRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, store);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.alfresco.cmis.CMISRepositoryReference#getStoreRef()
|
||||
*/
|
||||
public StoreRef getStoreRef()
|
||||
{
|
||||
return storeRef;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user