diff --git a/config/alfresco/opencmis-context.xml b/config/alfresco/opencmis-context.xml
index dc13a17ead..34f159c8d5 100644
--- a/config/alfresco/opencmis-context.xml
+++ b/config/alfresco/opencmis-context.xml
@@ -60,12 +60,12 @@
-
-
-
-
-
-
+
+
+
+
+
+
-
-
+
diff --git a/config/alfresco/repository.properties b/config/alfresco/repository.properties
index 8379f9fced..cc0652f703 100644
--- a/config/alfresco/repository.properties
+++ b/config/alfresco/repository.properties
@@ -598,6 +598,15 @@ nfs.user.mappings.default.gid=0
protocols.storeName=${spaces.store}
protocols.rootPath=/${spaces.company_home.childname}
+# OpenCMIS
+opencmis.connector.default.store=${spaces.store}
+opencmis.connector.default.rootPath=/${spaces.company_home.childname}
+opencmis.connector.default.typesDefaultMaxItems=500
+opencmis.connector.default.typesDefaultDepth=-1
+opencmis.connector.default.objectsDefaultMaxItems=10000
+opencmis.connector.default.objectsDefaultDepth=100
+opencmis.connector.default.openHttpSession=false
+
# IMAP
imap.server.enabled=false
imap.server.port=143
diff --git a/source/java/org/alfresco/opencmis/CMISConnector.java b/source/java/org/alfresco/opencmis/CMISConnector.java
index 19de2b6d9f..363de4e2ae 100644
--- a/source/java/org/alfresco/opencmis/CMISConnector.java
+++ b/source/java/org/alfresco/opencmis/CMISConnector.java
@@ -842,7 +842,8 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
nodeService.addAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE, props);
}
getCheckOutCheckInService().checkout(nodeRef);
- } else if ((versioningState == VersioningState.MAJOR) || (versioningState == VersioningState.MINOR))
+ }
+ else if ((versioningState == VersioningState.MAJOR) || (versioningState == VersioningState.MINOR))
{
if (!nodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE))
{
@@ -853,7 +854,8 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
}
Map versionProperties = new HashMap(5);
- versionProperties.put(VersionModel.PROP_VERSION_TYPE,
+ versionProperties.put(
+ VersionModel.PROP_VERSION_TYPE,
versioningState == VersioningState.MAJOR ? VersionType.MAJOR : VersionType.MINOR);
versionProperties.put(VersionModel.PROP_DESCRIPTION, "Initial Version");
@@ -948,7 +950,8 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
// association have no ACL - return an empty list of ACEs
result.setAcl(new AccessControlListImpl((List) Collections.EMPTY_LIST));
}
- } else
+ }
+ else
{
// set properties
result.setProperties(nodeProps);
@@ -1016,7 +1019,8 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
{
// render root path
displayPath.append("/");
- } else
+ }
+ else
{
// render CMIS scoped path
i++;
@@ -1080,7 +1084,8 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
{
result.setStream(contentReader.getContentInputStream());
result.setLength(BigInteger.valueOf(contentReader.getSize()));
- } else
+ }
+ else
{
long off = (offset == null ? 0 : offset.longValue());
long len = (length == null ? contentReader.getSize() : length.longValue()) - off;
@@ -1092,12 +1097,14 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
result.setStream(new RangeInputStream(contentReader.getContentInputStream(), off, len));
result.setLength(BigInteger.valueOf(len));
}
- } catch (Exception e)
+ }
+ catch (Exception e)
{
if (e instanceof CmisBaseException)
{
throw (CmisBaseException) e;
- } else
+ }
+ else
{
throw new CmisRuntimeException("Failed to retrieve content: " + e.getMessage(), e);
}
@@ -1173,7 +1180,8 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
if (accessor instanceof DirectProperty)
{
value = nodeProps.get(accessor.getMappedProperty());
- } else
+ }
+ else
{
value = propDef.getPropertyAccessor().getValue(info);
}
@@ -1301,7 +1309,8 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
propertyValues.add(new CmisExtensionElementImpl(CMIS_NAMESPACE, "value", null,
convertAspectPropertyValue(o)));
}
- } else
+ }
+ else
{
propertyValues.add(new CmisExtensionElementImpl(CMIS_NAMESPACE, "value", null,
convertAspectPropertyValue(value)));
@@ -1326,7 +1335,8 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
try
{
df = DatatypeFactory.newInstance();
- } catch (DatatypeConfigurationException e)
+ }
+ catch (DatatypeConfigurationException e)
{
throw new IllegalArgumentException("Aspect conversation exception: " + e.getMessage(), e);
}
@@ -1348,7 +1358,8 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
if (value instanceof List)
{
((PropertyBooleanImpl) result).setValues((List) value);
- } else
+ }
+ else
{
((PropertyBooleanImpl) result).setValue((Boolean) value);
}
@@ -1359,7 +1370,8 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
{
((PropertyDateTimeImpl) result).setValues((List) DefaultTypeConverter.INSTANCE
.convert(GregorianCalendar.class, (List>) value));
- } else
+ }
+ else
{
((PropertyDateTimeImpl) result).setValue(DefaultTypeConverter.INSTANCE.convert(GregorianCalendar.class,
value));
@@ -1371,7 +1383,8 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
{
((PropertyDecimalImpl) result).setValues((List) DefaultTypeConverter.INSTANCE.convert(
BigDecimal.class, (List>) value));
- } else
+ }
+ else
{
((PropertyDecimalImpl) result).setValue(DefaultTypeConverter.INSTANCE.convert(BigDecimal.class, value));
}
@@ -1381,7 +1394,8 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
if (value instanceof List)
{
((PropertyHtmlImpl) result).setValues((List) value);
- } else
+ }
+ else
{
((PropertyHtmlImpl) result).setValue((String) value);
}
@@ -1391,12 +1405,14 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
if (value instanceof List)
{
((PropertyIdImpl) result).setValues((List) value);
- } else
+ }
+ else
{
if (value instanceof NodeRef)
{
((PropertyIdImpl) result).setValue(value.toString());
- } else
+ }
+ else
{
((PropertyIdImpl) result).setValue((String) value);
}
@@ -1408,7 +1424,8 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
{
((PropertyIntegerImpl) result).setValues((List) DefaultTypeConverter.INSTANCE.convert(
BigInteger.class, (List>) value));
- } else
+ }
+ else
{
((PropertyIntegerImpl) result).setValue(DefaultTypeConverter.INSTANCE.convert(BigInteger.class, value));
}
@@ -1418,7 +1435,8 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
if (value instanceof List)
{
((PropertyStringImpl) result).setValues((List) value);
- } else
+ }
+ else
{
((PropertyStringImpl) result).setValue((String) value);
}
@@ -1428,7 +1446,8 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
if (value instanceof List)
{
((PropertyUriImpl) result).setValues((List) value);
- } else
+ }
+ else
{
((PropertyUriImpl) result).setValue((String) value);
}
@@ -1467,7 +1486,8 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
if (s.equals("*"))
{
return null;
- } else if (s.length() > 0)
+ }
+ else if (s.length() > 0)
{
result.add(s);
}
@@ -1599,7 +1619,8 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
result.getObjects().add(
createCMISObject(createNodeInfo(assocRef), filter, includeAllowableActions,
IncludeRelationships.NONE, RENDITION_NONE, false, false));
- } else
+ }
+ else
{
hasMore = true;
}
@@ -1655,7 +1676,8 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
}
ace.getPermissions().add(entry.getPermission());
- } else if (entry.getAccessStatus() == AccessStatus.DENIED)
+ }
+ else if (entry.getAccessStatus() == AccessStatus.DENIED)
{
// remove denied entries
Map directAce = aceMap.get(entry.getAuthority());
@@ -1734,10 +1756,12 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
if (PermissionService.READ.equals(perm))
{
result.add(BasicPermissions.READ);
- } else if (PermissionService.WRITE.equals(perm))
+ }
+ else if (PermissionService.WRITE.equals(perm))
{
result.add(BasicPermissions.WRITE);
- } else if (PermissionService.ALL_PERMISSIONS.equals(perm))
+ }
+ else if (PermissionService.ALL_PERMISSIONS.equals(perm))
{
result.add(BasicPermissions.READ);
result.add(BasicPermissions.WRITE);
@@ -1749,10 +1773,12 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
if (PermissionService.READ.equals(permission))
{
result.add(BasicPermissions.READ);
- } else if (PermissionService.WRITE.equals(permission))
+ }
+ else if (PermissionService.WRITE.equals(permission))
{
result.add(BasicPermissions.WRITE);
- } else if (PermissionService.ALL_PERMISSIONS.equals(permission))
+ }
+ else if (PermissionService.ALL_PERMISSIONS.equals(permission))
{
result.add(BasicPermissions.READ);
result.add(BasicPermissions.WRITE);
@@ -1765,7 +1791,8 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
if (permission.startsWith("{"))
{
result.add(permission);
- } else
+ }
+ else
{
result.add(permissionReference.toString());
}
@@ -1782,18 +1809,21 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
if (left.getPosition() != right.getPosition())
{
return right.getPosition() - left.getPosition();
- } else
+ }
+ else
{
if (left.getAccessStatus() != right.getAccessStatus())
{
return (left.getAccessStatus() == AccessStatus.DENIED) ? -1 : 1;
- } else
+ }
+ else
{
int compare = left.getAuthority().compareTo(right.getAuthority());
if (compare != 0)
{
return compare;
- } else
+ }
+ else
{
return (left.getPermission().compareTo(right.getPermission()));
}
@@ -1923,22 +1953,27 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
if (BasicPermissions.READ.equals(permission))
{
result.add(PermissionService.READ);
- } else if (BasicPermissions.WRITE.equals(permission))
+ }
+ else if (BasicPermissions.WRITE.equals(permission))
{
result.add(PermissionService.WRITE);
- } else if (BasicPermissions.ALL.equals(permission))
+ }
+ else if (BasicPermissions.ALL.equals(permission))
{
result.add(PermissionService.ALL_PERMISSIONS);
- } else if (!permission.startsWith("{"))
+ }
+ else if (!permission.startsWith("{"))
{
result.add(permission);
- } else
+ }
+ else
{
int sepIndex = permission.lastIndexOf('.');
if (sepIndex == -1)
{
result.add(permission);
- } else
+ }
+ else
{
result.add(permission.substring(sepIndex + 1));
}
@@ -2111,10 +2146,12 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
if (ASPECTS_TO_ADD.equals(extension.getName()) && (extension.getValue() != null))
{
aspectsToAdd.add(extension.getValue());
- } else if (ASPECTS_TO_REMOVE.equals(extension.getName()) && (extension.getValue() != null))
+ }
+ else if (ASPECTS_TO_REMOVE.equals(extension.getName()) && (extension.getValue() != null))
{
aspectsToRemove.add(extension.getValue());
- } else if (PROPERTIES.equals(extension.getName()) && (extension.getChildren() != null))
+ }
+ else if (PROPERTIES.equals(extension.getName()) && (extension.getChildren() != null))
{
for (CmisExtensionElement property : extension.getChildren())
{
@@ -2135,20 +2172,24 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
if (property.getName().equals("propertyBoolean"))
{
propertyType = PropertyType.BOOLEAN;
- } else if (property.getName().equals("propertyInteger"))
+ }
+ else if (property.getName().equals("propertyInteger"))
{
propertyType = PropertyType.INTEGER;
- } else if (property.getName().equals("propertyDateTime"))
+ }
+ else if (property.getName().equals("propertyDateTime"))
{
propertyType = PropertyType.DATETIME;
try
{
df = DatatypeFactory.newInstance();
- } catch (DatatypeConfigurationException e)
+ }
+ catch (DatatypeConfigurationException e)
{
throw new CmisRuntimeException("Aspect conversation exception: " + e.getMessage(), e);
}
- } else if (property.getName().equals("propertyDecimal"))
+ }
+ else if (property.getName().equals("propertyDecimal"))
{
propertyType = PropertyType.DECIMAL;
}
@@ -2182,7 +2223,8 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
}
}
}
- } catch (Exception e)
+ }
+ catch (Exception e)
{
throw new CmisInvalidArgumentException("Invalid property aspect value: " + propertyId, e);
}
@@ -2209,10 +2251,12 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
nodeService.addAspect(nodeRef, getType(aspect).getAlfrescoName(),
Collections. emptyMap());
}
- } catch (InvalidAspectException e)
+ }
+ catch (InvalidAspectException e)
{
throw new CmisInvalidArgumentException("Invalid aspect: " + aspectType);
- } catch (InvalidNodeRefException e)
+ }
+ catch (InvalidNodeRefException e)
{
throw new CmisInvalidArgumentException("Invalid node: " + nodeRef);
}
@@ -2223,7 +2267,8 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
if (property.getValue().isEmpty())
{
nodeService.removeProperty(nodeRef, property.getKey());
- } else
+ }
+ else
{
nodeService.setProperty(nodeRef, property.getKey(), property.getValue().size() == 1 ? property
.getValue().get(0) : (Serializable) property.getValue());
@@ -2273,19 +2318,23 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
try
{
fileFolderService.rename(nodeRef, value.toString());
- } catch (FileExistsException e)
+ }
+ catch (FileExistsException e)
{
throw new CmisContentAlreadyExistsException("An object with this name already exists!", e);
- } catch (FileNotFoundException e)
+ }
+ catch (FileNotFoundException e)
{
throw new CmisInvalidArgumentException("Object with id " + nodeRef.toString() + " not found!");
}
- } else
+ }
+ else
{
if (value == null)
{
nodeService.removeProperty(nodeRef, propertyQName);
- } else
+ }
+ else
{
nodeService.setProperty(nodeRef, propertyQName, value);
}
@@ -2331,7 +2380,8 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
try
{
from = Long.parseLong(changeLogToken.getValue());
- } catch (NumberFormatException e)
+ }
+ catch (NumberFormatException e)
{
throw new CmisInvalidArgumentException("Invalid change log token: " + changeLogToken);
}
@@ -2354,7 +2404,8 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
{
newChangeLogToken = result.getObjects().remove(result.getObjects().size() - 1).getId();
result.setHasMoreItems(true);
- } else
+ }
+ else
{
result.setHasMoreItems(false);
}
@@ -2527,7 +2578,8 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
if (fallback == null)
{
throw new CmisInvalidArgumentException("Property " + PropertyIds.NAME + " must be set!");
- } else
+ }
+ else
{
name = fallback;
}
diff --git a/source/java/org/alfresco/opencmis/OpenCmisLocalTest.java b/source/java/org/alfresco/opencmis/OpenCmisLocalTest.java
index b8f1368bdc..7f7d39a1c7 100644
--- a/source/java/org/alfresco/opencmis/OpenCmisLocalTest.java
+++ b/source/java/org/alfresco/opencmis/OpenCmisLocalTest.java
@@ -117,7 +117,7 @@ public class OpenCmisLocalTest extends TestCase
assertNotNull("No repository available for testing", repository);
}
- public void DISABLED_testBasicFileOps()
+ public void testBasicFileOps()
{
Repository repository = getRepository("admin", "admin");
Session session = repository.createSession();
diff --git a/source/java/org/alfresco/opencmis/mapping/CanCancelCheckOutActionEvaluator.java b/source/java/org/alfresco/opencmis/mapping/CanCancelCheckOutActionEvaluator.java
index 23fc161a0d..4450506eb7 100644
--- a/source/java/org/alfresco/opencmis/mapping/CanCancelCheckOutActionEvaluator.java
+++ b/source/java/org/alfresco/opencmis/mapping/CanCancelCheckOutActionEvaluator.java
@@ -34,14 +34,13 @@ public class CanCancelCheckOutActionEvaluator extends AbstractActionEvaluator
/**
* Construct
- *
- * @param serviceRegistry
- * @param permission
*/
protected CanCancelCheckOutActionEvaluator(ServiceRegistry serviceRegistry)
{
super(serviceRegistry, Action.CAN_CANCEL_CHECK_OUT);
- permissionEvaluator = new PermissionActionEvaluator(serviceRegistry, Action.CAN_CANCEL_CHECK_OUT,
+ permissionEvaluator = new PermissionActionEvaluator(
+ serviceRegistry,
+ Action.CAN_CANCEL_CHECK_OUT,
PermissionService.CANCEL_CHECK_OUT);
}
diff --git a/source/java/org/alfresco/opencmis/mapping/CanCheckInActionEvaluator.java b/source/java/org/alfresco/opencmis/mapping/CanCheckInActionEvaluator.java
index 444528f9eb..bf12716134 100644
--- a/source/java/org/alfresco/opencmis/mapping/CanCheckInActionEvaluator.java
+++ b/source/java/org/alfresco/opencmis/mapping/CanCheckInActionEvaluator.java
@@ -34,14 +34,13 @@ public class CanCheckInActionEvaluator extends AbstractActionEvaluator
/**
* Construct
- *
- * @param serviceRegistry
- * @param permission
*/
protected CanCheckInActionEvaluator(ServiceRegistry serviceRegistry)
{
super(serviceRegistry, Action.CAN_CHECK_IN);
- permissionEvaluator = new PermissionActionEvaluator(serviceRegistry, Action.CAN_CHECK_IN,
+ permissionEvaluator = new PermissionActionEvaluator(
+ serviceRegistry,
+ Action.CAN_CHECK_IN,
PermissionService.CHECK_IN);
}
diff --git a/source/java/org/alfresco/opencmis/mapping/CanCheckOutActionEvaluator.java b/source/java/org/alfresco/opencmis/mapping/CanCheckOutActionEvaluator.java
index 5c8aa3734c..c85c6619ff 100644
--- a/source/java/org/alfresco/opencmis/mapping/CanCheckOutActionEvaluator.java
+++ b/source/java/org/alfresco/opencmis/mapping/CanCheckOutActionEvaluator.java
@@ -22,6 +22,7 @@ import org.alfresco.opencmis.dictionary.CMISNodeInfo;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.lock.LockService;
import org.alfresco.service.cmr.lock.LockType;
+import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.security.PermissionService;
import org.apache.chemistry.opencmis.commons.enums.Action;
@@ -37,26 +38,28 @@ public class CanCheckOutActionEvaluator extends AbstractActionEvaluator
/**
* Construct
- *
- * @param serviceRegistry
- * @param permission
*/
protected CanCheckOutActionEvaluator(ServiceRegistry serviceRegistry)
{
super(serviceRegistry, Action.CAN_CHECK_OUT);
- permissionEvaluator = new PermissionActionEvaluator(serviceRegistry, Action.CAN_CHECK_OUT,
+ permissionEvaluator = new PermissionActionEvaluator(
+ serviceRegistry,
+ Action.CAN_CHECK_OUT,
PermissionService.CHECK_OUT);
lockService = serviceRegistry.getLockService();
}
+ /**
+ * Node must be versionable, must not have a Private Working Copy and must not be locked.
+ */
public boolean isAllowed(CMISNodeInfo nodeInfo)
{
- if (nodeInfo.hasPWC() || lockService.getLockType(nodeInfo.getNodeRef()) == LockType.READ_ONLY_LOCK)
+ NodeRef nodeRef = nodeInfo.getNodeRef();
+ if (nodeInfo.hasPWC() || lockService.getLockType(nodeRef) == LockType.READ_ONLY_LOCK)
{
return false;
}
return permissionEvaluator.isAllowed(nodeInfo);
}
-
}