You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by je...@apache.org on 2013/08/15 16:46:49 UTC
svn commit: r1514303 [2/2] - in
/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src:
main/java/org/apache/chemistry/opencmis/inmemory/
main/java/org/apache/chemistry/opencmis/inmemory/query/
main/java/org/apache/c...
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryServiceValidatorImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryServiceValidatorImpl.java?rev=1514303&r1=1514302&r2=1514303&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryServiceValidatorImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/InMemoryServiceValidatorImpl.java Thu Aug 15 14:46:48 2013
@@ -285,8 +285,9 @@ public class InMemoryServiceValidatorImp
ExtensionsData extension) {
StoredObject so = super.getCheckedOutDocs(context, repositoryId, folderId, extension);
- if (null != so)
+ if (null != so) {
checkReadAccess(repositoryId, context.getUsername(), so);
+ }
return so;
}
@@ -304,8 +305,9 @@ public class InMemoryServiceValidatorImp
List<String> policyIds, ExtensionsData extension) {
StoredObject folder = super.createDocument(context, repositoryId, folderId, policyIds, extension);
- if (null != folder) // not if unfiled
+ if (null != folder) {
checkWriteAccess(repositoryId, context.getUsername(), folder);
+ }
return folder;
}
@@ -380,12 +382,15 @@ public class InMemoryServiceValidatorImp
public StoredObject createPolicy(CallContext context, String repositoryId, String folderId, Acl addAces,
Acl removeAces, List<String> policyIds, ExtensionsData extension) {
- if (policyIds != null && policyIds.size() > 0)
+ if (policyIds != null && policyIds.size() > 0) {
throw new CmisConstraintException("Applying policies to policies is not supported.");
- if (folderId != null && folderId.length() > 0)
+ }
+ if (folderId != null && folderId.length() > 0) {
throw new CmisConstraintException("Policies cannot be created in folders.");
- if (addAces != null || removeAces != null)
+ }
+ if (addAces != null || removeAces != null) {
throw new CmisConstraintException("ACLs on policies are not suported.");
+ }
StoredObject so = super
.createPolicy(context, repositoryId, folderId, addAces, removeAces, policyIds, extension);
@@ -398,8 +403,9 @@ public class InMemoryServiceValidatorImp
List<String> policyIds, Acl addAces, Acl removeAces, ExtensionsData extension) {
StoredObject folder = super.createItem(context, repositoryId, properties, folderId, policyIds, addAces,
removeAces, extension);
- if (null != folder) // not if unfiled
+ if (null != folder) {
checkWriteAccess(repositoryId, context.getUsername(), folder);
+ }
return folder;
}
@@ -683,9 +689,10 @@ public class InMemoryServiceValidatorImp
StoredObject so = super.checkIn(context, repositoryId, objectId, addAces, removeAces, policyIds, extension);
- if (null != addAces || null != removeAces)
+ if (null != addAces || null != removeAces) {
throw new CmisInvalidArgumentException(
"version specific ACLs are not supported, addAces and removeAces must be null.");
+ }
checkWriteAccess(repositoryId, context.getUsername(), so);
return so;
@@ -815,8 +822,9 @@ public class InMemoryServiceValidatorImp
StoredObject[] sos = super.removeObjectFromFolder(context, repositoryId, objectId, folderId, extension);
checkWriteAccess(repositoryId, context.getUsername(), sos[0]);
- if (null != folderId)
+ if (null != folderId) {
checkWriteAccess(repositoryId, context.getUsername(), sos[1]);
+ }
return sos;
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java?rev=1514303&r1=1514302&r2=1514303&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/ObjectStoreImpl.java Thu Aug 15 14:46:48 2013
@@ -146,7 +146,7 @@ public class ObjectStoreImpl implements
@Override
public StoredObject getObjectByPath(String path, String user) {
- StoredObject so = findObjectWithPathInDescendents(path, user, Folder.PATH_SEPARATOR, fRootFolder);
+ StoredObject so = findObjectWithPathInDescendents(path, user, Filing.PATH_SEPARATOR, fRootFolder);
return so;
}
@@ -156,12 +156,14 @@ public class ObjectStoreImpl implements
} else if (fo instanceof Folder) {
List<Fileable> children = getChildren((Folder) fo);
for (Fileable child : children) {
- String foundPath = prefix.length() == 1 ? prefix + child.getName() : prefix + Folder.PATH_SEPARATOR
+ String foundPath = prefix.length() == 1 ? prefix + child.getName() : prefix + Filing.PATH_SEPARATOR
+ child.getName();
if (path.startsWith(foundPath)) {
Fileable found = findObjectWithPathInDescendents(path, user, foundPath, child);
if (null != found)
+ {
return found; // note that there can be multiple folders with the same prefix like folder1, folder10
+ }
}
}
}
@@ -274,15 +276,17 @@ public class ObjectStoreImpl implements
doc.setRepositoryId(fRepositoryId);
doc.setName(name);
if (null != folder) {
- if (hasChild(folder, name))
+ if (hasChild(folder, name)) {
throw new CmisNameConstraintViolationException("Cannot create document an object with name " + name
+ " already exists in folder " + getFolderPath(folder.getId()));
+ }
doc.addParentId(folder.getId());
}
int aclId = getAclId(((FolderImpl) folder), addACEs, removeACEs);
doc.setAclId(aclId);
- if (null != policies)
+ if (null != policies) {
doc.setAppliedPolicies(policies);
+ }
String id = storeObject(doc);
doc.setId(id);
return doc;
@@ -297,13 +301,15 @@ public class ObjectStoreImpl implements
item.setRepositoryId(fRepositoryId);
item.setName(name);
if (null != folder) {
- if (hasChild(folder, name))
+ if (hasChild(folder, name)) {
throw new CmisNameConstraintViolationException("Cannot create document an object with name " + name
+ " already exists in folder " + getFolderPath(folder.getId()));
+ }
item.addParentId(folder.getId());
}
- if (null != policies)
+ if (null != policies) {
item.setAppliedPolicies(policies);
+ }
int aclId = getAclId(((FolderImpl) folder), addACEs, removeACEs);
item.setAclId(aclId);
String id = storeObject(item);
@@ -326,15 +332,17 @@ public class ObjectStoreImpl implements
version.createSystemBasePropertiesWhenCreated(propMap, user);
version.setCustomProperties(propMap);
if (null != folder) {
- if (hasChild(folder, name))
+ if (hasChild(folder, name)) {
throw new CmisNameConstraintViolationException("Cannot create document an object with name " + name
+ " already exists in folder " + getFolderPath(folder.getId()));
+ }
doc.addParentId(folder.getId());
}
int aclId = getAclId(((FolderImpl) folder), addACEs, removeACEs);
doc.setAclId(aclId);
- if (null != policies)
+ if (null != policies) {
doc.setAppliedPolicies(policies);
+ }
id = storeObject(version);
version.setId(id);
return version;
@@ -356,8 +364,9 @@ public class ObjectStoreImpl implements
int aclId = getAclId(((FolderImpl) parent), addACEs, removeACEs);
folder.setAclId(aclId);
- if (null != policies)
+ if (null != policies) {
folder.setAppliedPolicies(policies);
+ }
String id = storeObject(folder);
folder.setId(id);
@@ -392,10 +401,12 @@ public class ObjectStoreImpl implements
rel.setCustomProperties(propMap);
rel.setRepositoryId(fRepositoryId);
rel.setName(name);
- if (null != sourceObject)
+ if (null != sourceObject) {
rel.setSource(sourceObject.getId());
- if (null != targetObject)
+ }
+ if (null != targetObject) {
rel.setTarget(targetObject.getId());
+ }
int aclId = getAclId(null, addACEs, removeACEs);
rel.setAclId(aclId);
String id = storeObject(rel);
@@ -461,8 +472,9 @@ public class ObjectStoreImpl implements
}
}
}
- } else
+ } else {
res = getAllRelationships(objectId, direction);
+ }
return res;
}
@@ -477,11 +489,11 @@ public class ObjectStoreImpl implements
Folder folder = (Folder) getObjectById(folderId);
if (null == folder.getParentId()) {
if (sb.length() == 0) {
- sb.insert(0, Folder.PATH_SEPARATOR);
+ sb.insert(0, Filing.PATH_SEPARATOR);
}
} else {
sb.insert(0, folder.getName());
- sb.insert(0, Folder.PATH_SEPARATOR);
+ sb.insert(0, Filing.PATH_SEPARATOR);
insertPathSegment(sb, folder.getParentId());
}
}
@@ -508,8 +520,9 @@ public class ObjectStoreImpl implements
public List<Integer> getAllAclsForUser(String principalId, Permission permission) {
List<Integer> acls = new ArrayList<Integer>();
for (InMemoryAcl acl : fAcls) {
- if (acl.hasPermission(principalId, permission))
+ if (acl.hasPermission(principalId, permission)) {
acls.add(acl.getId());
+ }
}
return acls;
}
@@ -531,49 +544,60 @@ public class ObjectStoreImpl implements
} else {
aclId = so.getAclId();
newAcl = getInMemoryAcl(aclId);
- if (null == newAcl)
+ if (null == newAcl) {
newAcl = new InMemoryAcl();
- else
+ } else {
// copy list so that we can safely change it without effecting
// the original
newAcl = new InMemoryAcl(newAcl.getAces());
+ }
}
- if (newAcl.size() == 0 && addACEs == null && removeACEs == null)
+ if (newAcl.size() == 0 && addACEs == null && removeACEs == null) {
return 0;
+ }
- if (null != removeACEs)
+ if (null != removeACEs) {
for (Ace ace : removeACEs.getAces()) {
InMemoryAce inMemAce = new InMemoryAce(ace);
- if (inMemAce.equals(InMemoryAce.getDefaultAce()))
+ if (inMemAce.equals(InMemoryAce.getDefaultAce())) {
removeDefaultAcl = true;
+ }
}
+ }
if (so != null && 0 == aclId && !removeDefaultAcl)
+ {
return 0; // if object grants full access to everyone and it will
// not be removed we do nothing
+ }
// add ACEs
- if (null != addACEs)
+ if (null != addACEs) {
for (Ace ace : addACEs.getAces()) {
InMemoryAce inMemAce = new InMemoryAce(ace);
if (inMemAce.equals(InMemoryAce.getDefaultAce()))
+ {
return 0; // if everyone has full access there is no need to
+ }
// add additional ACLs.
newAcl.addAce(inMemAce);
}
+ }
// remove ACEs
- if (null != removeACEs)
+ if (null != removeACEs) {
for (Ace ace : removeACEs.getAces()) {
InMemoryAce inMemAce = new InMemoryAce(ace);
newAcl.removeAce(inMemAce);
}
+ }
- if (newAcl.size() > 0)
+ if (newAcl.size() > 0) {
return addAcl(newAcl);
- else
+ } else {
return 0;
+ }
}
private void deleteFolder(String folderId, String user) {
@@ -627,8 +651,9 @@ public class ObjectStoreImpl implements
DocumentVersion ver;
if (usePwc) {
ver = ((VersionedDocument) pathObj).getPwc();
- if (null == ver)
+ if (null == ver) {
ver = ((VersionedDocument) pathObj).getLatestVersion(false);
+ }
} else {
ver = ((VersionedDocument) pathObj).getLatestVersion(false);
}
@@ -695,9 +720,10 @@ public class ObjectStoreImpl implements
}
for (String folderId : so.getParentIds()) {
Folder folder = (Folder) getObjectById(folderId);
- if (hasChild(folder, newName))
+ if (hasChild(folder, newName)) {
throw new CmisNameConstraintViolationException("Cannot rename object to " + newName
+ ". This path already exists in parent " + getFolderPath(folder.getId()) + ".");
+ }
}
so.setName(newName);
} finally {
@@ -707,10 +733,11 @@ public class ObjectStoreImpl implements
private boolean hasChild(Folder folder, String name) {
List<Fileable> children = getChildren(folder);
- for (Fileable child : children)
+ for (Fileable child : children) {
if (child.getName().equals(name)) {
return true;
}
+ }
return false;
}
@@ -752,14 +779,16 @@ public class ObjectStoreImpl implements
}
private void checkAccess(String principalId, StoredObject so, Permission permission) {
- if (!hasAccess(principalId, so, permission))
+ if (!hasAccess(principalId, so, permission)) {
throw new CmisPermissionDeniedException("Object with id " + so.getId() + " and name " + so.getName()
+ " does not grant " + permission.toString() + " access to principal " + principalId);
+ }
}
private boolean hasAccess(String principalId, StoredObject so, Permission permission) {
- if (null != principalId && principalId.equals(ADMIN_PRINCIPAL_ID))
+ if (null != principalId && principalId.equals(ADMIN_PRINCIPAL_ID)) {
return true;
+ }
List<Integer> aclIds = getAllAclsForUser(principalId, permission);
return aclIds.contains(((StoredObjectImpl) so).getAclId());
}
@@ -767,17 +796,18 @@ public class ObjectStoreImpl implements
private InMemoryAcl getInMemoryAcl(int aclId) {
for (InMemoryAcl acl : fAcls) {
- if (aclId == acl.getId())
+ if (aclId == acl.getId()) {
return acl;
+ }
}
return null;
}
private int setAcl(StoredObjectImpl so, Acl acl) {
int aclId;
- if (null == acl || acl.getAces().isEmpty())
+ if (null == acl || acl.getAces().isEmpty()) {
aclId = 0;
- else {
+ } else {
aclId = getAclId(null, acl, null);
}
so.setAclId(aclId);
@@ -793,8 +823,9 @@ public class ObjectStoreImpl implements
*/
private int hasAcl(InMemoryAcl acl) {
for (InMemoryAcl acl2 : fAcls) {
- if (acl2.equals(acl))
+ if (acl2.equals(acl)) {
return acl2.getId();
+ }
}
return -1;
}
@@ -802,8 +833,9 @@ public class ObjectStoreImpl implements
private int addAcl(InMemoryAcl acl) {
int aclId = -1;
- if (null == acl)
+ if (null == acl) {
return 0;
+ }
lock();
try {
@@ -896,8 +928,9 @@ public class ObjectStoreImpl implements
// iterate over all the objects and check for each if the type matches
for (String objectId : getIds()) {
StoredObject so = getObjectById(objectId);
- if (so.getTypeId().equals(typeId))
+ if (so.getTypeId().equals(typeId)) {
return true;
+ }
}
return false;
}
@@ -911,10 +944,11 @@ public class ObjectStoreImpl implements
"Cannot assign new parent folder, this name already exists in target folder.");
}
MultiFiling mfi;
- if (so instanceof MultiFiling)
+ if (so instanceof MultiFiling) {
mfi = (MultiFiling) so;
- else
+ } else {
throw new IllegalArgumentException("Object " + so.getId() + "is not fileable");
+ }
addParentIntern(mfi, parent);
} finally {
@@ -927,10 +961,11 @@ public class ObjectStoreImpl implements
try {
lock();
MultiFiling mfi;
- if (so instanceof MultiFiling)
+ if (so instanceof MultiFiling) {
mfi = (MultiFiling) so;
- else
+ } else {
throw new IllegalArgumentException("Object " + so.getId() + "is not fileable");
+ }
removeParentIntern(mfi, parent);
} finally {
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/Permission.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/Permission.java?rev=1514303&r1=1514302&r2=1514303&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/Permission.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/Permission.java Thu Aug 15 14:46:48 2013
@@ -73,25 +73,27 @@ public enum Permission {
public static Permission fromCmisString(String strPerm) {
Permission permission;
- if (strPerm.equals(EnumBasicPermissions.CMIS_READ.value()))
+ if (strPerm.equals(EnumBasicPermissions.CMIS_READ.value())) {
permission = Permission.READ;
- else if (strPerm.equals(EnumBasicPermissions.CMIS_WRITE.value()))
+ } else if (strPerm.equals(EnumBasicPermissions.CMIS_WRITE.value())) {
permission = Permission.WRITE;
- else if (strPerm.equals(EnumBasicPermissions.CMIS_ALL.value()))
+ } else if (strPerm.equals(EnumBasicPermissions.CMIS_ALL.value())) {
permission = Permission.ALL;
- else
+ } else {
throw new IllegalArgumentException("InMemory only supports CMIS basic permissions read, write, all.");
+ }
return permission;
}
public String toCmisString() {
- if (this.equals(READ))
+ if (this.equals(READ)) {
return EnumBasicPermissions.CMIS_READ.value();
- else if (this.equals(WRITE))
+ } else if (this.equals(WRITE)) {
return EnumBasicPermissions.CMIS_WRITE.value();
- else if (this.equals(ALL))
+ } else if (this.equals(ALL)) {
return EnumBasicPermissions.CMIS_ALL.value();
- else
+ } else {
return "";
+ }
}
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java?rev=1514303&r1=1514302&r2=1514303&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoreManagerImpl.java Thu Aug 15 14:46:48 2013
@@ -196,16 +196,19 @@ public class StoreManagerImpl implements
if (tc != null) {
if (depth == -1) {
- if (includePropertyDefinitions)
+ if (includePropertyDefinitions) {
return tc;
- else
+ } else {
depth = Integer.MAX_VALUE;
- } else if (depth == 0 || depth < -1)
+ }
+ } else if (depth == 0 || depth < -1) {
throw new CmisInvalidArgumentException("illegal depth value: " + depth);
+ }
return cloneTypeList(depth, includePropertyDefinitions, tc, null);
- } else
+ } else {
return null;
+ }
}
@Override
@@ -234,15 +237,19 @@ public class StoreManagerImpl implements
rootTypes = new ArrayList<TypeDefinitionContainer>(rootTypes);
TypeDefinitionContainer tcItem = null, tcSecondary = null;
for(TypeDefinitionContainer tc : rootTypes) {
- if (tc.getTypeDefinition().getId().equals(BaseTypeId.CMIS_ITEM.value()))
+ if (tc.getTypeDefinition().getId().equals(BaseTypeId.CMIS_ITEM.value())) {
tcItem = tc;
- if (tc.getTypeDefinition().getId().equals(BaseTypeId.CMIS_SECONDARY.value()))
+ }
+ if (tc.getTypeDefinition().getId().equals(BaseTypeId.CMIS_SECONDARY.value())) {
tcSecondary = tc;
+ }
}
- if (tcItem != null)
+ if (tcItem != null) {
rootTypes.remove(tcItem);
- if (tcSecondary != null)
+ }
+ if (tcSecondary != null) {
rootTypes.remove(tcSecondary);
+ }
}
if (includePropertyDefinitions) {
@@ -527,8 +534,9 @@ public class StoreManagerImpl implements
}
TypeDefinitionContainerImpl tdcClone = new TypeDefinitionContainerImpl(tdClone);
- if (null != parent)
+ if (null != parent) {
parent.getChildren().add(tdcClone);
+ }
if (depth > 0) {
List<TypeDefinitionContainer> children = tdc.getChildren();
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java?rev=1514303&r1=1514302&r2=1514303&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/StoredObjectImpl.java Thu Aug 15 14:46:48 2013
@@ -166,10 +166,11 @@ public class StoredObjectImpl implements
@Override
public List<String> getAppliedPolicies() {
- if (null == policyIds)
+ if (null == policyIds) {
return null;
- else
+ } else {
return Collections.unmodifiableList(policyIds);
+ }
}
public void setAppliedPolicies(List<String> newPolicies) {
@@ -336,9 +337,10 @@ public class StoredObjectImpl implements
// constructor.
setModifiedBy(user);
if (null != properties) {
- if (null != properties.get(PropertyIds.DESCRIPTION))
- setDescription((String) properties.get(PropertyIds.DESCRIPTION)
+ if (null != properties.get(PropertyIds.DESCRIPTION)) {
+ setDescription((String) properties.get(PropertyIds.DESCRIPTION)
.getFirstValue());
+ }
if (null != properties.get(PropertyIds.SECONDARY_OBJECT_TYPE_IDS)) {
secondaryTypeIds.clear();
@@ -534,17 +536,19 @@ public class StoredObjectImpl implements
}
protected boolean testRenditionFilterForImage(String[] formats) {
- if (formats.length == 1 && null != formats[0] && formats[0].equals("cmis:none"))
+ if (formats.length == 1 && null != formats[0] && formats[0].equals("cmis:none")) {
return false;
- else
+ } else {
return arrayContainsString(formats, "*") || arrayContainsString(formats, "image/*")
|| arrayContainsString(formats, "image/jpeg");
+ }
}
private boolean arrayContainsString(String[] formats, String val) {
for (String s : formats) {
- if (val.equals(s))
+ if (val.equals(s)) {
return true;
+ }
}
return false;
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/VersionedDocumentImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/VersionedDocumentImpl.java?rev=1514303&r1=1514302&r2=1514303&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/VersionedDocumentImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/storedobj/impl/VersionedDocumentImpl.java Thu Aug 15 14:46:48 2013
@@ -109,11 +109,13 @@ public class VersionedDocumentImpl exten
DocumentVersion pwc = getPwc();
- if (null != content)
+ if (null != content) {
pwc.setContent(content, false);
+ }
- if (null != properties && null != properties.getProperties())
+ if (null != properties && null != properties.getProperties()) {
((DocumentVersionImpl) pwc).setCustomProperties(properties.getProperties());
+ }
pwc.setCheckinComment(checkinComment);
pwc.commit(isMajor);
@@ -143,8 +145,9 @@ public class VersionedDocumentImpl exten
public DocumentVersion getLatestVersion(boolean major) {
DocumentVersion latest = null;
- if (fVersions.size() == 0)
+ if (fVersions.size() == 0) {
return null;
+ }
if (major) {
for (DocumentVersion ver : fVersions) {
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DocumentTypeCreationHelper.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DocumentTypeCreationHelper.java?rev=1514303&r1=1514302&r2=1514303&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DocumentTypeCreationHelper.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/DocumentTypeCreationHelper.java Thu Aug 15 14:46:48 2013
@@ -257,8 +257,9 @@ public final class DocumentTypeCreationH
}
private static String getQueryName(String id) {
- if (null == id)
+ if (null == id) {
return null;
+ }
StringBuffer sb = new StringBuffer(id);
for (int i=0; i<sb.length(); i++) {
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyCreationHelper.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyCreationHelper.java?rev=1514303&r1=1514302&r2=1514303&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyCreationHelper.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/PropertyCreationHelper.java Thu Aug 15 14:46:48 2013
@@ -240,8 +240,9 @@ public final class PropertyCreationHelpe
Map<String, PropertyDefinition<?>> propDefs = td.getPropertyDefinitions();
for (PropertyDefinition<?> propDef : propDefs.values()) {
if (!properties.containsKey(propDef.getId())
- && FilterParser.isContainedInFilter(propDef.getId(), requestedIds))
+ && FilterParser.isContainedInFilter(propDef.getId(), requestedIds)) {
properties.put(propDef.getId(), getEmptyValue(propDef));
+ }
}
// fill not-set properties from secondary types
@@ -251,8 +252,9 @@ public final class PropertyCreationHelpe
propDefs = td.getPropertyDefinitions();
for (PropertyDefinition<?> propDef : propDefs.values()) {
if (!properties.containsKey(propDef.getId())
- && FilterParser.isContainedInFilter(propDef.getId(), requestedIds))
+ && FilterParser.isContainedInFilter(propDef.getId(), requestedIds)) {
properties.put(propDef.getId(), getEmptyValue(propDef));
+ }
}
}
@@ -297,8 +299,9 @@ public final class PropertyCreationHelpe
// add all values that are not set:
Map<String, PropertyDefinition<?>> propDefs = primaryType.getPropertyDefinitions();
for (PropertyDefinition<?> propDef : propDefs.values()) {
- if (!mappedProperties.containsKey(propDef.getQueryName()))
+ if (!mappedProperties.containsKey(propDef.getQueryName())) {
mappedProperties.put(propDef.getId(), getEmptyValue(propDef));
+ }
}
} else {
@@ -324,8 +327,9 @@ public final class PropertyCreationHelpe
// add all values that are not set:
Map<String, PropertyDefinition<?>> propDefs = typeDef.getPropertyDefinitions();
for (PropertyDefinition<?> propDef : propDefs.values()) {
- if (!mappedProperties.containsKey(propDef.getQueryName()))
+ if (!mappedProperties.containsKey(propDef.getQueryName())) {
mappedProperties.put(propDef.getId(), getEmptyValue(propDef));
+ }
}
} else {
// replace all ids with query names or alias:
@@ -347,8 +351,9 @@ public final class PropertyCreationHelpe
String queryName;
if (funcEntry.getValue().equals("SCORE")) {
queryName = "SEARCH_SCORE";
- if (!funcEntry.getKey().equals("SCORE"))
+ if (!funcEntry.getKey().equals("SCORE")) {
queryName = funcEntry.getKey();
+ }
PropertyDecimalImpl pd = new PropertyDecimalImpl();
// fixed dummy value
@@ -419,8 +424,9 @@ public final class PropertyCreationHelpe
}
List<RenditionData> renditions = so.getRenditions(renditionFilter, 0, 0);
- if (null != renditions && renditions.size() > 0)
+ if (null != renditions && renditions.size() > 0) {
od.setRenditions(renditions);
+ }
if (null != includeACL && includeACL) {
int aclId = so instanceof DocumentVersion ? ((DocumentVersion) so).getParentDocument().getAclId() : so.getAclId();
@@ -478,8 +484,9 @@ public final class PropertyCreationHelpe
}
List<RenditionData> renditions = so.getRenditions(renditionFilter, 0, 0);
- if (null != renditions && renditions.size() > 0)
+ if (null != renditions && renditions.size() > 0) {
od.setRenditions(renditions);
+ }
od.setProperties(props);
@@ -536,24 +543,25 @@ public final class PropertyCreationHelpe
private static AbstractPropertyData<?> getEmptyValue(PropertyDefinition<?> propDef) {
AbstractPropertyData<?> emptyValue;
- if (propDef.getPropertyType().equals(PropertyType.BOOLEAN))
- emptyValue = new PropertyBooleanImpl(propDef.getId(), (Boolean) null);
- else if (propDef.getPropertyType().equals(PropertyType.DATETIME))
- emptyValue = new PropertyDateTimeImpl(propDef.getId(), (GregorianCalendar) null);
- else if (propDef.getPropertyType().equals(PropertyType.DECIMAL))
- emptyValue = new PropertyDecimalImpl(propDef.getId(), (BigDecimal) null);
- else if (propDef.getPropertyType().equals(PropertyType.HTML))
+ if (propDef.getPropertyType().equals(PropertyType.BOOLEAN)) {
+ emptyValue = new PropertyBooleanImpl(propDef.getId(), (Boolean) null);
+ } else if (propDef.getPropertyType().equals(PropertyType.DATETIME)) {
+ emptyValue = new PropertyDateTimeImpl(propDef.getId(), (GregorianCalendar) null);
+ } else if (propDef.getPropertyType().equals(PropertyType.DECIMAL)) {
+ emptyValue = new PropertyDecimalImpl(propDef.getId(), (BigDecimal) null);
+ } else if (propDef.getPropertyType().equals(PropertyType.HTML)) {
emptyValue = new PropertyHtmlImpl(propDef.getId(), (String) null);
- else if (propDef.getPropertyType().equals(PropertyType.ID))
- emptyValue = new PropertyIdImpl(propDef.getId(), (String) null);
- else if (propDef.getPropertyType().equals(PropertyType.INTEGER))
- emptyValue = new PropertyIntegerImpl(propDef.getId(), (BigInteger) null);
- else if (propDef.getPropertyType().equals(PropertyType.STRING))
- emptyValue = new PropertyStringImpl(propDef.getId(), (String) null);
- else if (propDef.getPropertyType().equals(PropertyType.URI))
- emptyValue = new PropertyUriImpl(propDef.getId(), (String) null);
- else
- emptyValue = null;
+ } else if (propDef.getPropertyType().equals(PropertyType.ID)) {
+ emptyValue = new PropertyIdImpl(propDef.getId(), (String) null);
+ } else if (propDef.getPropertyType().equals(PropertyType.INTEGER)) {
+ emptyValue = new PropertyIntegerImpl(propDef.getId(), (BigInteger) null);
+ } else if (propDef.getPropertyType().equals(PropertyType.STRING)) {
+ emptyValue = new PropertyStringImpl(propDef.getId(), (String) null);
+ } else if (propDef.getPropertyType().equals(PropertyType.URI)) {
+ emptyValue = new PropertyUriImpl(propDef.getId(), (String) null);
+ } else {
+ emptyValue = null;
+ }
emptyValue.setDisplayName(propDef.getDisplayName());
emptyValue.setQueryName(propDef.getQueryName());
emptyValue.setLocalName(propDef.getLocalName());
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/TypeUtil.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/TypeUtil.java?rev=1514303&r1=1514302&r2=1514303&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/TypeUtil.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/types/TypeUtil.java Thu Aug 15 14:46:48 2013
@@ -56,20 +56,21 @@ public final class TypeUtil {
}
public static TypeDefinition cloneType(TypeDefinition type) {
- if (type instanceof DocumentTypeDefinition)
+ if (type instanceof DocumentTypeDefinition) {
return cloneTypeDoc((DocumentTypeDefinition) type);
- else if (type instanceof FolderTypeDefinition)
+ } else if (type instanceof FolderTypeDefinition) {
return cloneTypeFolder((FolderTypeDefinition) type);
- else if (type instanceof PolicyTypeDefinition)
+ } else if (type instanceof PolicyTypeDefinition) {
return cloneTypePolicy((PolicyTypeDefinition) type);
- else if (type instanceof ItemTypeDefinition)
+ } else if (type instanceof ItemTypeDefinition) {
return cloneTypeItem((ItemTypeDefinition) type);
- else if (type instanceof RelationshipTypeDefinition)
+ } else if (type instanceof RelationshipTypeDefinition) {
return cloneTypeRelationship((RelationshipTypeDefinition) type);
- else if (type instanceof SecondaryTypeDefinition)
+ } else if (type instanceof SecondaryTypeDefinition) {
return cloneTypeSecondary((SecondaryTypeDefinition) type);
- else
- return null;
+ } else {
+ return null;
+ }
}
public static AbstractPropertyDefinition<?> clonePropertyDefinition(PropertyDefinition<?> pd) {
@@ -136,8 +137,9 @@ public final class TypeUtil {
pdUriDef.setChoices(pdSrc.getChoices());
pdUriDef.setDefaultValue(pdSrc.getDefaultValue());
return pdUriDef;
- } else
+ } else {
return null;
+ }
}
public static DocumentTypeDefinitionImpl cloneTypeDoc(DocumentTypeDefinition type) {
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/AbstractServiceTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/AbstractServiceTest.java?rev=1514303&r1=1514302&r2=1514303&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/AbstractServiceTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/AbstractServiceTest.java Thu Aug 15 14:46:48 2013
@@ -250,10 +250,11 @@ public class AbstractServiceTest {
ContentStreamDataImpl content = new ContentStreamDataImpl(maxSizeInKB);
content.setFileName("data.txt");
- if (null == mimeType)
+ if (null == mimeType) {
content.setMimeType("text/plain");
- else
+ } else {
content.setMimeType(mimeType);
+ }
int len = sizeInKB * 1024;
byte[] b = { 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x0c, 0x0a,
0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x0c, 0x0a }; // 32
@@ -426,7 +427,7 @@ public class AbstractServiceTest {
}
protected String getStringProperty(ObjectData objData, String propertyKey) {
- PropertyData<? extends Object> pd = (PropertyData<? extends Object>) objData.getProperties().getProperties()
+ PropertyData<? extends Object> pd = objData.getProperties().getProperties()
.get(PropertyIds.PATH);
assertNotNull(pd.getFirstValue());
assertTrue(pd.getFirstValue() instanceof String);
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/AclPermissionsTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/AclPermissionsTest.java?rev=1514303&r1=1514302&r2=1514303&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/AclPermissionsTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/AclPermissionsTest.java Thu Aug 15 14:46:48 2013
@@ -228,8 +228,9 @@ public class AclPermissionsTest extends
{
exceptionThrown = true;
}
- if (!exceptionThrown)
- fail("TestUser has no permissions)");
+ if (!exceptionThrown) {
+ fail("TestUser has no permissions)");
+ }
switchCallContext("Reader");
ObjectInFolderList list = fNavSvc.getChildren(fRepositoryId, folderId, null, null, false, IncludeRelationships.NONE, null, null,
@@ -246,8 +247,9 @@ public class AclPermissionsTest extends
{
exceptionThrown = true;
}
- if (!exceptionThrown)
- fail("TestUser has no permissions)");
+ if (!exceptionThrown) {
+ fail("TestUser has no permissions)");
+ }
switchCallContext("Reader");
List<ObjectInFolderContainer> list2 = fNavSvc.getDescendants(fRepositoryId, folderId, MINUS_ONE, null, null, null, null, null, null);
@@ -263,8 +265,9 @@ public class AclPermissionsTest extends
{
exceptionThrown = true;
}
- if (!exceptionThrown)
- fail("TestUser has no permissions)");
+ if (!exceptionThrown) {
+ fail("TestUser has no permissions)");
+ }
switchCallContext("Reader");
List<ObjectInFolderContainer> list3 = fNavSvc.getFolderTree(fRepositoryId, folderId, BigInteger.ONE, null, null, null, null, null, null);
@@ -279,8 +282,9 @@ public class AclPermissionsTest extends
{
exceptionThrown = true;
}
- if (!exceptionThrown)
- fail("TestUser has no permissions)");
+ if (!exceptionThrown) {
+ fail("TestUser has no permissions)");
+ }
switchCallContext("Reader");
List<ObjectParentData> list4 = fNavSvc.getObjectParents(fRepositoryId, folderId, null, null, null, null, null, null);
@@ -295,8 +299,9 @@ public class AclPermissionsTest extends
{
exceptionThrown = true;
}
- if (!exceptionThrown)
- fail("TestUser has no permissions)");
+ if (!exceptionThrown) {
+ fail("TestUser has no permissions)");
+ }
switchCallContext("Reader");
ObjectData list5 = fNavSvc.getFolderParent(fRepositoryId, folderId, null, null);
@@ -312,8 +317,9 @@ public class AclPermissionsTest extends
{
exceptionThrown = true;
}
- if (!exceptionThrown)
- fail("TestUser has no permissions)");
+ if (!exceptionThrown) {
+ fail("TestUser has no permissions)");
+ }
switchCallContext("Reader");
ObjectList list6 = fNavSvc.getCheckedOutDocs(fRepositoryId, folderId, null, null, null, IncludeRelationships.NONE,
@@ -363,8 +369,9 @@ public class AclPermissionsTest extends
{
exceptionThrown = true;
}
- if (!exceptionThrown)
- fail("TestUser has no permissions to get acl of folder");
+ if (!exceptionThrown) {
+ fail("TestUser has no permissions to get acl of folder");
+ }
switchCallContext("Reader");
Acl acl = fAclSvc.getAcl(fRepositoryId, folderId, null, null);
@@ -380,8 +387,9 @@ public class AclPermissionsTest extends
{
exceptionThrown = true;
}
- if (!exceptionThrown)
- fail("TestUser has no permissions to get acl of doc)");
+ if (!exceptionThrown) {
+ fail("TestUser has no permissions to get acl of doc)");
+ }
switchCallContext("Reader");
Acl docAcl = fAclSvc.getAcl(fRepositoryId, docId, true, null);
@@ -397,8 +405,9 @@ public class AclPermissionsTest extends
{
exceptionThrown = true;
}
- if (!exceptionThrown)
- fail("TestUser has no permissions)");
+ if (!exceptionThrown) {
+ fail("TestUser has no permissions)");
+ }
// switchCallContext("Writer");
switchCallContext("TestAdmin");
@@ -446,8 +455,9 @@ public class AclPermissionsTest extends
{
exceptionThrown = true;
}
- if (!exceptionThrown)
- fail("TestUser has no permissions to create a document");
+ if (!exceptionThrown) {
+ fail("TestUser has no permissions to create a document");
+ }
exceptionThrown = false;
try
@@ -458,8 +468,9 @@ public class AclPermissionsTest extends
{
exceptionThrown = true;
}
- if (!exceptionThrown)
- fail("TestUser has no permissions to create a folder");
+ if (!exceptionThrown) {
+ fail("TestUser has no permissions to create a folder");
+ }
/*
exceptionThrown = false;
@@ -498,8 +509,9 @@ public class AclPermissionsTest extends
{
exceptionThrown = true;
}
- if (!exceptionThrown)
- fail("TestUser has no permissions to get properties of the folder");
+ if (!exceptionThrown) {
+ fail("TestUser has no permissions to get properties of the folder");
+ }
exceptionThrown = false;
try
@@ -510,8 +522,9 @@ public class AclPermissionsTest extends
{
exceptionThrown = true;
}
- if (!exceptionThrown)
- fail("TestUser has no permissions to get properties of the document");
+ if (!exceptionThrown) {
+ fail("TestUser has no permissions to get properties of the document");
+ }
exceptionThrown = false;
try
@@ -523,8 +536,9 @@ public class AclPermissionsTest extends
{
exceptionThrown = true;
}
- if (!exceptionThrown)
- fail("TestUser has no permissions to get renditions of the document");
+ if (!exceptionThrown) {
+ fail("TestUser has no permissions to get renditions of the document");
+ }
exceptionThrown = false;
try
@@ -536,8 +550,9 @@ public class AclPermissionsTest extends
{
exceptionThrown = true;
}
- if (!exceptionThrown)
- fail("TestUser has no permissions to get contentStream of the document");
+ if (!exceptionThrown) {
+ fail("TestUser has no permissions to get contentStream of the document");
+ }
switchCallContext("Reader");
exceptionThrown = false;
@@ -551,8 +566,9 @@ public class AclPermissionsTest extends
{
exceptionThrown = true;
}
- if (!exceptionThrown)
- fail("Reader has no permissions to update properties of the document");
+ if (!exceptionThrown) {
+ fail("Reader has no permissions to update properties of the document");
+ }
exceptionThrown = false;
properties = createDocumentProperties( "name", "typeId");
@@ -565,8 +581,9 @@ public class AclPermissionsTest extends
{
exceptionThrown = true;
}
- if (!exceptionThrown)
- fail("Reader has no permissions to update properties of the document");
+ if (!exceptionThrown) {
+ fail("Reader has no permissions to update properties of the document");
+ }
exceptionThrown = false;
try
@@ -578,8 +595,9 @@ public class AclPermissionsTest extends
{
exceptionThrown = true;
}
- if (!exceptionThrown)
- fail("Reader has no permissions to move document");
+ if (!exceptionThrown) {
+ fail("Reader has no permissions to move document");
+ }
switchCallContext("Writer");
exceptionThrown = false;
@@ -592,8 +610,9 @@ public class AclPermissionsTest extends
{
exceptionThrown = true;
}
- if (!exceptionThrown)
- fail("Writer has no permissions to move document to admin folder");
+ if (!exceptionThrown) {
+ fail("Writer has no permissions to move document to admin folder");
+ }
switchCallContext("Reader");
exceptionThrown = false;
@@ -605,8 +624,9 @@ public class AclPermissionsTest extends
{
exceptionThrown = true;
}
- if (!exceptionThrown)
- fail("Reader has no permissions to delete document ");
+ if (!exceptionThrown) {
+ fail("Reader has no permissions to delete document ");
+ }
exceptionThrown = false;
try
@@ -617,8 +637,9 @@ public class AclPermissionsTest extends
{
exceptionThrown = true;
}
- if (!exceptionThrown)
- fail("Reader has no permissions to delete admin folder ");
+ if (!exceptionThrown) {
+ fail("Reader has no permissions to delete admin folder ");
+ }
exceptionThrown = false;
try
@@ -630,8 +651,9 @@ public class AclPermissionsTest extends
{
exceptionThrown = true;
}
- if (!exceptionThrown)
- fail("Reader has no permissions to set content ");
+ if (!exceptionThrown) {
+ fail("Reader has no permissions to set content ");
+ }
exceptionThrown = false;
try
@@ -643,8 +665,9 @@ public class AclPermissionsTest extends
{
exceptionThrown = true;
}
- if (!exceptionThrown)
- fail("Reader has no permissions to delete content ");
+ if (!exceptionThrown) {
+ fail("Reader has no permissions to delete content ");
+ }
exceptionThrown = false;
try
@@ -656,8 +679,9 @@ public class AclPermissionsTest extends
{
exceptionThrown = true;
}
- if (!exceptionThrown)
- fail("Reader has no permissions to delete tree ");
+ if (!exceptionThrown) {
+ fail("Reader has no permissions to delete tree ");
+ }
}
@Test
@@ -684,8 +708,9 @@ public class AclPermissionsTest extends
{
exceptionThrown = true;
}
- if (!exceptionThrown)
- fail("TestUser has no permissions at the document to add a parent");
+ if (!exceptionThrown) {
+ fail("TestUser has no permissions at the document to add a parent");
+ }
exceptionThrown = false;
switchCallContext("Reader"); // has no permission at the folder
@@ -698,8 +723,9 @@ public class AclPermissionsTest extends
{
exceptionThrown = true;
}
- if (!exceptionThrown)
- fail("Reader has no permission at the folder to add a parent");
+ if (!exceptionThrown) {
+ fail("Reader has no permission at the folder to add a parent");
+ }
switchCallContext("TestAdmin");
fMultiSvc.addObjectToFolder(fRepositoryId, docId, noReadFolderId, true, null);
@@ -715,8 +741,9 @@ public class AclPermissionsTest extends
{
exceptionThrown = true;
}
- if (!exceptionThrown)
- fail("Reader has no permission at the folder to remove a parent");
+ if (!exceptionThrown) {
+ fail("Reader has no permission at the folder to remove a parent");
+ }
switchCallContext("TestUser");
try
@@ -728,8 +755,9 @@ public class AclPermissionsTest extends
{
exceptionThrown = true;
}
- if (!exceptionThrown)
- fail("TestUser has no permission at the object to remove a parent");
+ if (!exceptionThrown) {
+ fail("TestUser has no permission at the object to remove a parent");
+ }
}
@Test
@@ -753,8 +781,9 @@ public class AclPermissionsTest extends
{
exceptionThrown = true;
}
- if (!exceptionThrown)
- fail("TestUser has no permission to checkout)");
+ if (!exceptionThrown) {
+ fail("TestUser has no permission to checkout)");
+ }
// Reader has only read permission
switchCallContext("Reader");
@@ -768,8 +797,9 @@ public class AclPermissionsTest extends
{
exceptionThrown = true;
}
- if (!exceptionThrown)
- fail("Reader has not enough permission to checkout)");
+ if (!exceptionThrown) {
+ fail("Reader has not enough permission to checkout)");
+ }
// checkout
switchCallContext("TestAdmin");
@@ -793,8 +823,9 @@ public class AclPermissionsTest extends
{
exceptionThrown = true;
}
- if (!exceptionThrown)
- fail("TestUser has no permission to cancelCheckOut)");
+ if (!exceptionThrown) {
+ fail("TestUser has no permission to cancelCheckOut)");
+ }
switchCallContext("TestAdmin");
fAclSvc.applyAcl(fRepositoryId, docId, testUserAcl, null, AclPropagation.OBJECTONLY, null);
switchCallContext("TestUser");
@@ -818,8 +849,9 @@ public class AclPermissionsTest extends
{
exceptionThrown = true;
}
- if (!exceptionThrown)
- fail("Reader has not enough permission to cancelCheckOut)");
+ if (!exceptionThrown) {
+ fail("Reader has not enough permission to cancelCheckOut)");
+ }
switchCallContext("TestAdmin");
fAclSvc.applyAcl(fRepositoryId, docId, readWriteAcl, null, AclPropagation.OBJECTONLY, null);
switchCallContext("Writer");
@@ -846,8 +878,9 @@ public class AclPermissionsTest extends
{
exceptionThrown = true;
}
- if (!exceptionThrown)
- fail("TestUser has no permission to checkIn)");
+ if (!exceptionThrown) {
+ fail("TestUser has no permission to checkIn)");
+ }
switchCallContext("TestAdmin");
fAclSvc.applyAcl(fRepositoryId, docId, testUserAcl, null, AclPropagation.OBJECTONLY, null);
switchCallContext("TestUser");
@@ -876,8 +909,9 @@ public class AclPermissionsTest extends
{
exceptionThrown = true;
}
- if (!exceptionThrown)
- fail("Writer has not enough permission to checkIn)");
+ if (!exceptionThrown) {
+ fail("Writer has not enough permission to checkIn)");
+ }
switchCallContext("TestAdmin");
fAclSvc.applyAcl(fRepositoryId, docId, readWriteAcl, null, AclPropagation.OBJECTONLY, null);
switchCallContext("Writer");
@@ -897,8 +931,9 @@ public class AclPermissionsTest extends
{
exceptionThrown = true;
}
- if (!exceptionThrown)
- fail("TestUser has not enough permission to getObjectOfLatestVersion)");
+ if (!exceptionThrown) {
+ fail("TestUser has not enough permission to getObjectOfLatestVersion)");
+ }
exceptionThrown = false;
try
@@ -910,8 +945,9 @@ public class AclPermissionsTest extends
{
exceptionThrown = true;
}
- if (!exceptionThrown)
- fail("TestUser has not enough permission to getAllVersions)");
+ if (!exceptionThrown) {
+ fail("TestUser has not enough permission to getAllVersions)");
+ }
exceptionThrown = false;
@@ -924,8 +960,9 @@ public class AclPermissionsTest extends
{
exceptionThrown = true;
}
- if (!exceptionThrown)
- fail("TestUser has not enough permission to getAllVersions)");
+ if (!exceptionThrown) {
+ fail("TestUser has not enough permission to getAllVersions)");
+ }
}
@@ -1154,15 +1191,17 @@ public class AclPermissionsTest extends
properties.add(fFactory.createPropertyIdData(PropertyIds.OBJECT_TYPE_ID, typeId));
Properties props = fFactory.createPropertiesData(properties);
- if (withContent)
- contentStream = createContent();
+ if (withContent) {
+ contentStream = createContent();
+ }
String id = null;
try {
id = fObjSvc.createDocument(fRepositoryId, props, folderId, contentStream, VersioningState.NONE, null,
null, null, null);
- if (null == id)
- fail("createDocument failed.");
+ if (null == id) {
+ fail("createDocument failed.");
+ }
} catch (Exception e) {
fail("createDocument() failed with exception: " + e);
}
@@ -1182,14 +1221,18 @@ public class AclPermissionsTest extends
}
private static boolean aclEquals(Acl acl1, Acl acl2) {
- if (acl1 == acl2)
- return true;
- if (acl1 == null || acl2 == null)
- return false;
- if (acl1.getClass() != acl2.getClass())
- return false;
- if (acl1.getAces().size() != acl2.getAces().size())
+ if (acl1 == acl2) {
+ return true;
+ }
+ if (acl1 == null || acl2 == null) {
+ return false;
+ }
+ if (acl1.getClass() != acl2.getClass()) {
+ return false;
+ }
+ if (acl1.getAces().size() != acl2.getAces().size()) {
return false;
+ }
for (int i=0; i<acl1.getAces().size(); i++) {
aclHasAce(acl1.getAces(), acl2.getAces().get(i));
}
@@ -1198,13 +1241,17 @@ public class AclPermissionsTest extends
private static boolean aclHasAce( List<Ace> aces, Ace ace) {
for (Ace ace2 : aces) {
- if (!ace.getPrincipalId().equals(ace2.getPrincipalId()))
+ if (!ace.getPrincipalId().equals(ace2.getPrincipalId())) {
continue;
- if (ace.getPermissions().size() != ace2.getPermissions().size())
+ }
+ if (ace.getPermissions().size() != ace2.getPermissions().size()) {
continue;
- for (int i=0; i<ace2.getPermissions().size(); i++)
- if (!aceHasPermission(ace.getPermissions(), ace2.getPermissions().get(i)))
+ }
+ for (int i=0; i<ace2.getPermissions().size(); i++) {
+ if (!aceHasPermission(ace.getPermissions(), ace2.getPermissions().get(i))) {
continue;
+ }
+ }
return true;
}
@@ -1212,9 +1259,11 @@ public class AclPermissionsTest extends
}
private static boolean aceHasPermission( List<String> permissions, String permission) {
- for (String permission2 : permissions)
- if (permission2.equals(permission))
- return true;
+ for (String permission2 : permissions) {
+ if (permission2.equals(permission)) {
+ return true;
+ }
+ }
return false;
}
@@ -1233,8 +1282,9 @@ public class AclPermissionsTest extends
boolean found = false;
for (ObjectInFolderData folder : folderData) {
LOG.info(" found folder id " + folder.getObject().getId());
- if (id.equals(folder.getObject().getId()))
- found = true;
+ if (id.equals(folder.getObject().getId())) {
+ found = true;
+ }
}
assertTrue("Failed to find folder id " + id, found);
}
@@ -1246,11 +1296,13 @@ public class AclPermissionsTest extends
private boolean objectInFolderContainerHasId(List<ObjectInFolderContainer> folderList, String id) {
for (ObjectInFolderContainer fc : folderList) {
- if (id.equals(fc.getObject().getObject().getId()))
+ if (id.equals(fc.getObject().getObject().getId())) {
return true;
+ }
List<ObjectInFolderContainer> children = fc.getChildren();
- if (children != null && objectInFolderContainerHasId(children, id))
+ if (children != null && objectInFolderContainerHasId(children, id)) {
return true;
+ }
}
return false;
}
@@ -1259,8 +1311,9 @@ public class AclPermissionsTest extends
boolean found = false;
for (ObjectData od : objList.getObjects()) {
LOG.info(" found object id " + od.getId());
- if (id.equals(od.getId()))
+ if (id.equals(od.getId())) {
found = true;
+ }
}
assertTrue("Failed to find object id " + id, found);
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/AclServiceTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/AclServiceTest.java?rev=1514303&r1=1514302&r2=1514303&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/AclServiceTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/AclServiceTest.java Thu Aug 15 14:46:48 2013
@@ -339,27 +339,32 @@ public class AclServiceTest extends Abst
private boolean aclHasPermission(Acl acl, String principalId, String permission) {
for (Ace ace : acl.getAces()) {
- if (ace.getPrincipalId().equals(principalId) && aceContainsPermission(ace, permission))
- return true;
+ if (ace.getPrincipalId().equals(principalId) && aceContainsPermission(ace, permission)) {
+ return true;
+ }
}
return false;
}
private boolean aclHasNoPermission(Acl acl, String principalId) {
- if (null == acl)
+ if (null == acl) {
return false;
+ }
for (Ace ace : acl.getAces()) {
- if (ace.getPrincipalId().equals(principalId))
+ if (ace.getPrincipalId().equals(principalId)) {
return false;
+ }
}
return true;
}
private boolean aceContainsPermission(Ace ace, String permission) {
- for (String acePerm : ace.getPermissions())
- if (permission.equals(acePerm))
+ for (String acePerm : ace.getPermissions()) {
+ if (permission.equals(acePerm)) {
return true;
+ }
+ }
return false;
}
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/AclTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/AclTest.java?rev=1514303&r1=1514302&r2=1514303&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/AclTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/AclTest.java Thu Aug 15 14:46:48 2013
@@ -296,8 +296,9 @@ public class AclTest {
private boolean hasCommonsAce(Acl acl, String principalId, String permission) {
for (Ace ace : acl.getAces()) {
- if (ace.getPrincipalId().equals(principalId) && ace.getPermissions().get(0).equals(permission))
+ if (ace.getPrincipalId().equals(principalId) && ace.getPermissions().get(0).equals(permission)) {
return true;
+ }
}
return false;
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java?rev=1514303&r1=1514302&r2=1514303&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectServiceTest.java Thu Aug 15 14:46:48 2013
@@ -81,6 +81,7 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.spi.Holder;
import org.apache.chemistry.opencmis.inmemory.storedobj.impl.ContentStreamDataImpl;
import org.apache.chemistry.opencmis.inmemory.storedobj.impl.DocumentImpl;
+import org.apache.chemistry.opencmis.inmemory.storedobj.impl.StoredObjectImpl;
import org.apache.chemistry.opencmis.inmemory.types.DocumentTypeCreationHelper;
import org.apache.chemistry.opencmis.inmemory.types.PropertyCreationHelper;
import org.apache.chemistry.opencmis.server.support.TypeDefinitionFactory;
@@ -1057,8 +1058,8 @@ public class ObjectServiceTest extends A
assertEquals(id, rd.getRenditionDocumentId());
assertNotNull(rd.getBigHeight());
assertNotNull(rd.getBigWidth());
- assertEquals(DocumentImpl.ICON_SIZE, rd.getBigHeight().longValue());
- assertEquals(DocumentImpl.ICON_SIZE, rd.getBigWidth().longValue());
+ assertEquals(StoredObjectImpl.ICON_SIZE, rd.getBigHeight().longValue());
+ assertEquals(StoredObjectImpl.ICON_SIZE, rd.getBigWidth().longValue());
assertNotNull(rd.getStreamId());
ContentStream renditionContent = fObjSvc.getContentStream(fRepositoryId, id, rd.getStreamId(), null, null, null);
assertEquals(rd.getMimeType(), renditionContent.getMimeType());
@@ -1090,8 +1091,8 @@ public class ObjectServiceTest extends A
assertEquals(id, rd.getRenditionDocumentId());
assertNotNull(rd.getBigHeight());
assertNotNull(rd.getBigWidth());
- assertEquals(DocumentImpl.ICON_SIZE, rd.getBigHeight().longValue());
- assertEquals(DocumentImpl.ICON_SIZE, rd.getBigWidth().longValue());
+ assertEquals(StoredObjectImpl.ICON_SIZE, rd.getBigHeight().longValue());
+ assertEquals(StoredObjectImpl.ICON_SIZE, rd.getBigWidth().longValue());
assertNotNull(rd.getStreamId());
ContentStream renditionContent = fObjSvc.getContentStream(fRepositoryId, id, rd.getStreamId(), null, null, null);
assertEquals(rd.getMimeType(), renditionContent.getMimeType());
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/RelationshipServiceTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/RelationshipServiceTest.java?rev=1514303&r1=1514302&r2=1514303&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/RelationshipServiceTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/RelationshipServiceTest.java Thu Aug 15 14:46:48 2013
@@ -26,7 +26,6 @@ import static org.junit.Assert.fail;
import java.math.BigInteger;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@@ -103,8 +102,9 @@ public class RelationshipServiceTest ext
List<PropertyData<?>> relProps2 = createRelationshipProperties(REL_CUSTOM_PROP_VALUE);
final String id2 = createRelationship("CrossReference2", ObjectServiceTest.TEST_RELATION_TYPE_ID, docId2,
targetId, relProps2);
- if (id2 != null)
+ if (id2 != null) {
log.info("createRelationship succeeded with created id: " + id2);
+ }
assertNotNull(id2);
List<String> relIds = new ArrayList<String>() {
@@ -195,8 +195,9 @@ public class RelationshipServiceTest ext
assertNotNull(id1);
final String id2 = createRelationship("CrossReference2", ObjectServiceTest.TEST_RELATION_TYPE_ID, docId2,
targetId, null);
- if (id2 != null)
+ if (id2 != null) {
log.info("createRelationship succeeded with created id: " + id2);
+ }
assertNotNull(id2);
List<String> relIds = new ArrayList<String>() {
@@ -585,12 +586,14 @@ public class RelationshipServiceTest ext
String relId = (String) objectData.getProperties().getProperties().get(PropertyIds.OBJECT_ID).getFirstValue();
assertTrue(expectedRelIds.remove(relId));
assertEquals(BaseTypeId.CMIS_RELATIONSHIP, objectData.getBaseTypeId());
- if (null != expectedTypeId)
+ if (null != expectedTypeId) {
assertEquals(expectedTypeId, objectData.getProperties().getProperties().get(PropertyIds.OBJECT_TYPE_ID)
.getFirstValue());
- if (expectedTypeId != null && expectedTypeId.equals(ObjectServiceTest.TEST_RELATION_TYPE_ID))
+ }
+ if (expectedTypeId != null && expectedTypeId.equals(ObjectServiceTest.TEST_RELATION_TYPE_ID)) {
assertEquals(REL_CUSTOM_PROP_VALUE,
objectData.getProperties().getProperties().get(ObjectServiceTest.REL_STRING_PROP).getFirstValue());
+ }
String sourceId = (String) objectData.getProperties().getProperties().get(PropertyIds.SOURCE_ID)
.getFirstValue();
String targetId = (String) objectData.getProperties().getProperties().get(PropertyIds.TARGET_ID)
@@ -623,8 +626,9 @@ public class RelationshipServiceTest ext
List<PropertyData<?>> additionalProperties) {
List<PropertyData<?>> properties = additionalProperties;
- if (null == additionalProperties)
+ if (null == additionalProperties) {
properties = new ArrayList<PropertyData<?>>();
+ }
properties.add(fFactory.createPropertyIdData(PropertyIds.NAME, name));
properties.add(fFactory.createPropertyIdData(PropertyIds.OBJECT_TYPE_ID, typeId));
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/RepositoryServiceTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/RepositoryServiceTest.java?rev=1514303&r1=1514302&r2=1514303&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/RepositoryServiceTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/RepositoryServiceTest.java Thu Aug 15 14:46:48 2013
@@ -21,7 +21,6 @@ package org.apache.chemistry.opencmis.in
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/UnitTestTypeSystemCreator.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/UnitTestTypeSystemCreator.java?rev=1514303&r1=1514302&r2=1514303&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/UnitTestTypeSystemCreator.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/UnitTestTypeSystemCreator.java Thu Aug 15 14:46:48 2013
@@ -36,7 +36,6 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition;
import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
-import org.apache.chemistry.opencmis.commons.enums.ContentStreamAllowed;
import org.apache.chemistry.opencmis.commons.enums.Updatability;
import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.ChoiceImpl;
@@ -96,9 +95,11 @@ public class UnitTestTypeSystemCreator i
}
public static TypeDefinition getTypeById(String typeId) {
- for (TypeDefinition typeDef : singletonTypes)
- if (typeDef.getId().equals(typeId))
+ for (TypeDefinition typeDef : singletonTypes) {
+ if (typeDef.getId().equals(typeId)) {
return typeDef;
+ }
+ }
return null;
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/VersioningTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/VersioningTest.java?rev=1514303&r1=1514302&r2=1514303&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/VersioningTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/VersioningTest.java Thu Aug 15 14:46:48 2013
@@ -507,10 +507,11 @@ public class VersioningTest extends Abst
PropertyBoolean pdb = (PropertyBoolean) props.get(PropertyIds.IS_LATEST_VERSION);
assertNotNull(pdb);
boolean bVal = pdb.getFirstValue();
- if (versioningState != VersioningState.CHECKEDOUT)
+ if (versioningState != VersioningState.CHECKEDOUT) {
assertTrue(bVal);
- else
+ } else {
assertFalse(bVal);
+ }
pdb = (PropertyBoolean) props.get(PropertyIds.IS_MAJOR_VERSION);
assertNotNull(pdb);
bVal = pdb.getFirstValue();
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/EvalQueryTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/EvalQueryTest.java?rev=1514303&r1=1514302&r2=1514303&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/EvalQueryTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/EvalQueryTest.java Thu Aug 15 14:46:48 2013
@@ -1105,10 +1105,11 @@ public class EvalQueryTest extends Abstr
log.debug("Query result, number of matching objects: " + res.getNumItems());
for (ObjectData od : res.getObjects()) {
PropertyData<?> propData = od.getProperties().getProperties().get(PropertyIds.NAME);
- if (null != propData)
+ if (null != propData) {
log.debug("Found matching object: " + propData.getFirstValue());
- else
+ } else {
log.debug("Found matching object: (unknown, no name)");
+ }
}
return res;
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/ProcessQueryTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/ProcessQueryTest.java?rev=1514303&r1=1514302&r2=1514303&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/ProcessQueryTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/ProcessQueryTest.java Thu Aug 15 14:46:48 2013
@@ -33,7 +33,6 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.inmemory.TypeManagerImpl;
import org.apache.chemistry.opencmis.server.support.query.CalendarHelper;
import org.apache.chemistry.opencmis.server.support.query.CmisQlStrictLexer;
-import org.apache.chemistry.opencmis.server.support.query.QueryObject;
import org.apache.chemistry.opencmis.server.support.query.TextSearchLexer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/QueryParseTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/QueryParseTest.java?rev=1514303&r1=1514302&r2=1514303&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/QueryParseTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/QueryParseTest.java Thu Aug 15 14:46:48 2013
@@ -494,7 +494,7 @@ public class QueryParseTest extends Abst
try {
checkTreeWhere(statement);
} catch (Exception e) {
- LOG.error("Exception is: ", e);
+ LOG.debug("Exception is: ", e);
assertTrue(e instanceof CmisInvalidArgumentException);
assertTrue(e.getMessage().contains("illegal tokens after end"));
}
@@ -645,8 +645,9 @@ public class QueryParseTest extends Abst
for (int i=0; i<count; i++) {
Tree child = node.getChild(i);
node = findTextSearchNode(child); // recursive descent
- if (null != node)
+ if (null != node) {
return node;
+ }
}
return null;
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/QueryTestDataCreator.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/QueryTestDataCreator.java?rev=1514303&r1=1514302&r2=1514303&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/QueryTestDataCreator.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/QueryTestDataCreator.java Thu Aug 15 14:46:48 2013
@@ -429,10 +429,12 @@ public class QueryTestDataCreator {
private Properties createDocumentProperties(String name, String typeId, Map<String, Object> propertyMap) {
List<PropertyData<?>> properties = new ArrayList<PropertyData<?>>();
- if (name != null)
+ if (name != null) {
properties.add(fFactory.createPropertyIdData(PropertyIds.NAME, name));
- if (typeId != null)
+ }
+ if (typeId != null) {
properties.add(fFactory.createPropertyIdData(PropertyIds.OBJECT_TYPE_ID, typeId));
+ }
for (Map.Entry<String,Object> propEntry :propertyMap.entrySet()) {
PropertyData<?> pd =
createPropertyData(propEntry.getKey(), propEntry.getValue());