/** * Checks if at least one ACE list is not empty. */ protected boolean isAclMergeRequired(Acl addAces, Acl removeAces) { return (addAces != null && isNotEmpty(addAces.getAces())) || (removeAces != null && isNotEmpty(removeAces.getAces())); }
protected final void checkProperties(Map<String, ?> properties) { if (isNullOrEmpty(properties)) { throw new IllegalArgumentException("Properties must not be empty!"); } }
/** * Calculate the list of allowed values for this property definition by * recursively collecting all choice values from property definition * * @param propDef * property definition * @return list of possible values in complete hierarchy */ private List<T> getAllowedValues(List<Choice<T>> choices) { List<T> allowedValues = new ArrayList<T>(choices.size()); for (Choice<T> choice : choices) { if (isNotEmpty(choice.getValue())) { allowedValues.add(choice.getValue().get(0)); } if (isNotEmpty(choice.getChoice())) { List<Choice<T>> x = choice.getChoice(); allowedValues.addAll(getAllowedValues(x)); } } return allowedValues; } }
protected final void checkProperties(Map<String, ?> properties) { if (isNullOrEmpty(properties)) { throw new IllegalArgumentException("Properties must not be empty!"); } }
if (isNotEmpty(objectTypeIdsValues)) { TypeDefinition typeDef = typeCache.getTypeDefinition(objectTypeIdsValues.get(0)); if (typeDef == null) { if (isNotEmpty(secondaryObjectTypeIdsValues)) { for (String secTypeId : secondaryObjectTypeIdsValues) { TypeDefinition typeDef = typeCache.getTypeDefinition(secTypeId);
public String getHeader(String name) { List<String> list = headers.get(name.toLowerCase(Locale.US)); if (isNullOrEmpty(list)) { return null; } return list.get(0); }
BigInteger.valueOf(Integer.MAX_VALUE), BigInteger.ZERO, null); if (children != null && isNotEmpty(children.getList())) { for (TypeDefinition td : children.getList()) { TypeDefinitionContainerImpl tdc = new TypeDefinitionContainerImpl(td);
public String getHeader(String name) { List<String> list = headers.get(name.toLowerCase(Locale.US)); if (isNullOrEmpty(list)) { return null; } return list.get(0); }
BigInteger.valueOf(Integer.MAX_VALUE), BigInteger.ZERO, null); if (children != null && isNotEmpty(children.getList())) { for (TypeDefinition td : children.getList()) { TypeDefinitionContainerImpl tdc = new TypeDefinitionContainerImpl(td);
private void addSecondaryTypeIdParameters(List<String> secondaryTypeIds, String secondaryTypeIdControl) { if (isNullOrEmpty(secondaryTypeIds)) { return; } int idx = 0; for (String typeId : secondaryTypeIds) { if (typeId == null || typeId.length() == 0) { continue; } String idxStr = "[" + idx + "]"; addParameter(secondaryTypeIdControl + idxStr, typeId); idx++; } }
if (ftd != null && isNotEmpty(ftd.getIds())) {
private void addSecondaryTypeIdParameters(List<String> secondaryTypeIds, String secondaryTypeIdControl) { if (isNullOrEmpty(secondaryTypeIds)) { return; } int idx = 0; for (String typeId : secondaryTypeIds) { if (typeId == null || typeId.length() == 0) { continue; } String idxStr = "[" + idx + "]"; addParameter(secondaryTypeIdControl + idxStr, typeId); idx++; } }
/** * Helper method for * {@link #getTypeDescendants(String, String, BigInteger, Boolean, ExtensionsData)} * . */ private void addTypeChildren(String repositoryId, Boolean includePropertyDefinitions, int depth, TypeDefinitionContainerImpl container) { if (depth == 0) { return; } TypeDefinitionList children = getTypeChildren(repositoryId, container.getTypeDefinition().getId(), includePropertyDefinitions, BigInteger.valueOf(Integer.MAX_VALUE), BigInteger.ZERO, null); if (children != null && isNotEmpty(children.getList())) { List<TypeDefinitionContainer> list = new ArrayList<TypeDefinitionContainer>(); container.setChildren(list); for (TypeDefinition td : children.getList()) { TypeDefinitionContainerImpl tdc = new TypeDefinitionContainerImpl(td); addTypeChildren(repositoryId, includePropertyDefinitions, (depth > 0 ? depth - 1 : -1), tdc); list.add(tdc); } } }
@Override public List<ContentStreamHash> getContentStreamHashes() { List<String> hashes = getPropertyValue(PropertyIds.CONTENT_STREAM_HASH); if (isNullOrEmpty(hashes)) { return null; } List<ContentStreamHash> result = new ArrayList<ContentStreamHash>(hashes.size()); for (String hash : hashes) { result.add(new ContentStreamHashImpl(hash)); } return result; }
@Override public List<TypeDefinitionContainer> getTypeDescendants(String repositoryId, String typeId, BigInteger depth, Boolean includePropertyDefinitions, ExtensionsData extension) { List<TypeDefinitionContainer> result = null; boolean hasExtension = (extension != null) && isNotEmpty(extension.getExtensions()); boolean propDefs = includePropertyDefinitions == null ? false : includePropertyDefinitions.booleanValue(); // get the SPI and fetch the type definitions CmisSpi spi = CmisBindingsHelper.getSPI(session); result = spi.getRepositoryService().getTypeDescendants(repositoryId, typeId, depth, includePropertyDefinitions, extension); // put it into the cache if (!hasExtension && propDefs && (result != null)) { TypeDefinitionCache cache = CmisBindingsHelper.getTypeDefinitionCache(session); addToTypeCache(cache, repositoryId, result); } return result; }
@Override public List<ContentStreamHash> getContentStreamHashes() { List<String> hashes = getPropertyValue(PropertyIds.CONTENT_STREAM_HASH); if (isNullOrEmpty(hashes)) { return null; } List<ContentStreamHash> result = new ArrayList<ContentStreamHash>(hashes.size()); for (String hash : hashes) { result.add(new ContentStreamHashImpl(hash)); } return result; }
/** * Helper method for * {@link #getTypeDescendants(String, String, BigInteger, Boolean, ExtensionsData)} * . */ private void addTypeChildren(String repositoryId, Boolean includePropertyDefinitions, int depth, TypeDefinitionContainerImpl container) { if (depth == 0) { return; } TypeDefinitionList children = getTypeChildren(repositoryId, container.getTypeDefinition().getId(), includePropertyDefinitions, BigInteger.valueOf(Integer.MAX_VALUE), BigInteger.ZERO, null); if (children != null && isNotEmpty(children.getList())) { List<TypeDefinitionContainer> list = new ArrayList<TypeDefinitionContainer>(); container.setChildren(list); for (TypeDefinition td : children.getList()) { TypeDefinitionContainerImpl tdc = new TypeDefinitionContainerImpl(td); addTypeChildren(repositoryId, includePropertyDefinitions, (depth > 0 ? depth - 1 : -1), tdc); list.add(tdc); } } }
protected static void validateAllowedTypes(TypeDefinition typeDef, List<String> allowedTypes, String description) { if (isNullOrEmpty(allowedTypes)) { return; // all types are allowed } for (String allowedType : allowedTypes) { if (allowedType.equals(typeDef.getId())) { return; } } throw new CmisConstraintException("The requested type " + typeDef.getId() + " is not allowed " + description); }
@Override public List<TypeDefinitionContainer> getTypeDescendants(String repositoryId, String typeId, BigInteger depth, Boolean includePropertyDefinitions, ExtensionsData extension) { List<TypeDefinitionContainer> result = null; boolean hasExtension = (extension != null) && isNotEmpty(extension.getExtensions()); boolean propDefs = includePropertyDefinitions == null ? false : includePropertyDefinitions.booleanValue(); // get the SPI and fetch the type definitions CmisSpi spi = CmisBindingsHelper.getSPI(session); result = spi.getRepositoryService().getTypeDescendants(repositoryId, typeId, depth, includePropertyDefinitions, extension); // put it into the cache if (!hasExtension && propDefs && (result != null)) { TypeDefinitionCache cache = CmisBindingsHelper.getTypeDefinitionCache(session); addToTypeCache(cache, repositoryId, result); } return result; }
@Override public Folder getFolderParent() { if (isRootFolder()) { return null; } List<Folder> parents = getParents(getSession().getDefaultContext()); if (isNullOrEmpty(parents)) { return null; } return parents.get(0); }