org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionList Java Examples

The following examples show how to use org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionList. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Converter.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Converts a type list
 * 
 * @param typeList the list to convert
 * 
 * @return the converted definition list
 */
public static TypeDefinitionList convert(CmisTypeDefinitionListType typeList) {
	if (typeList == null) {
		return null;
	}

	TypeDefinitionListImpl result = new TypeDefinitionListImpl();
	List<TypeDefinition> types = new ArrayList<TypeDefinition>();
	for (CmisTypeDefinitionType typeDefinition : typeList.getTypes()) {
		types.add(convert(typeDefinition));
	}

	result.setList(types);
	result.setHasMoreItems(typeList.isHasMoreItems());
	result.setNumItems(typeList.getNumItems());

	// handle extensions
	convertExtension(typeList, result);

	return result;
}
 
Example #2
Source File: Converter.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Converts a type list
 * 
 * @param typeList list of types
 * 
 * @return the CMIS definitions
 */
public static CmisTypeDefinitionListType convert(TypeDefinitionList typeList) {
	if (typeList == null) {
		return null;
	}

	CmisTypeDefinitionListType result = new CmisTypeDefinitionListType();

	if (typeList.getList() != null) {
		for (TypeDefinition tdd : typeList.getList()) {
			result.getTypes().add(convert(tdd));
		}
	}

	result.setHasMoreItems(convertBoolean(typeList.hasMoreItems(), false));
	result.setNumItems(typeList.getNumItems());

	// handle extensions
	convertExtension(typeList, result);

	return result;
}
 
Example #3
Source File: CmisServiceImpl.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
@Override
public TypeDefinitionList getTypeChildren(String repositoryId, String typeId, Boolean includePropertyDefinitions, BigInteger maxItems,
                                          BigInteger skipCount, ExtensionsData extension) {
	log.debug("getTypeChildren({}, {}, {}, {}, {}, {})", new Object[]{repositoryId, typeId, includePropertyDefinitions, maxItems,
			skipCount, extension});
	return getRepository().getTypesChildren(getCallContext(), typeId, includePropertyDefinitions, maxItems, skipCount);
}
 
Example #4
Source File: ContentCmisService.java    From spring-content with Apache License 2.0 5 votes vote down vote up
@Override
public TypeDefinitionList getTypeChildren(String repositoryId,
										  String typeId,
										  Boolean includePropertyDefinitions,
										  BigInteger maxItems,
										  BigInteger skipCount,
										  ExtensionsData extension) {

	return bridge.getTypeChildren(config,
			typeId,
			includePropertyDefinitions,
			maxItems,
			skipCount,
			extension);
}
 
Example #5
Source File: CmisServiceBridge.java    From spring-content with Apache License 2.0 5 votes vote down vote up
public TypeDefinitionList getTypeChildren(CmisRepositoryConfiguration config,
		String typeId,
		Boolean includePropertyDefinitions,
		BigInteger maxItems,
		BigInteger skipCount,
		ExtensionsData extension) {
	if (typeId == null) {
		return cmisRepositoryConfiguration.getCmisTypeDefinitionList();
	}
	return new TypeDefinitionListImpl(Collections.EMPTY_LIST);
}
 
Example #6
Source File: ConformanceCmisServiceWrapper.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public TypeDefinitionList getTypeChildren(String repositoryId, String typeId, Boolean includePropertyDefinitions,
        BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
    checkRepositoryId(repositoryId);
    includePropertyDefinitions = getDefaultFalse(includePropertyDefinitions);
    maxItems = getTypesMaxItems(maxItems);
    skipCount = getSkipCount(skipCount);

    try {
        return getWrappedService().getTypeChildren(repositoryId, typeId, includePropertyDefinitions, maxItems,
                skipCount, extension);
    } catch (Exception e) {
        throw createCmisException(e);
    }
}
 
Example #7
Source File: LDCmisService.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public TypeDefinitionList getTypeChildren(String repositoryId, String typeId, Boolean includePropertyDefinitions,
		BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
	validateSession();
	return getRepository().getTypesChildren(getCallContext(), typeId, includePropertyDefinitions, maxItems,
			skipCount);
}
 
Example #8
Source File: AbstractCmisServiceWrapper.java    From alfresco-repository with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public TypeDefinitionList getTypeChildren(String repositoryId, String typeId, Boolean includePropertyDefinitions,
        BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
    return service
            .getTypeChildren(repositoryId, typeId, includePropertyDefinitions, maxItems, skipCount, extension);
}
 
Example #9
Source File: AlfrescoCmisServiceImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
    public TypeDefinitionList getTypeChildren(
            String repositoryId, String typeId, Boolean includePropertyDefinitions,
            BigInteger maxItems, BigInteger skipCount, ExtensionsData extension)
    {
        checkRepositoryId(repositoryId);

        // convert BigIntegers to int
        int max = (maxItems == null ? Integer.MAX_VALUE : maxItems.intValue());
        int skip = (skipCount == null || skipCount.intValue() < 0 ? 0 : skipCount.intValue());

        // set up the result
        TypeDefinitionListImpl result = new TypeDefinitionListImpl();
        List<TypeDefinition> list = new ArrayList<TypeDefinition>();
        result.setList(list);

        // get the types from the dictionary
        List<TypeDefinitionWrapper> childrenList;
        if (typeId == null)
        {
            childrenList = connector.getOpenCMISDictionaryService().getBaseTypes(true);
        }
        else
        {
        	TypeDefinitionWrapper tdw = connector.getOpenCMISDictionaryService().findType(typeId);
        	if (tdw == null)
        	{
        		throw new CmisObjectNotFoundException("Type '" + typeId + "' is unknown!");
        	}
        	childrenList = connector.getOpenCMISDictionaryService().getChildren(typeId);
//            childrenList = tdw.getChildren();
        }

        // create result
        if (max > 0)
        {
            int lastIndex = (max + skip > childrenList.size() ? childrenList.size() : max + skip) - 1;
            for (int i = skip; i <= lastIndex; i++)
            {
                list.add(childrenList.get(i).getTypeDefinition(includePropertyDefinitions));
            }
        }

        result.setHasMoreItems(childrenList.size() - skip > result.getList().size());
        result.setNumItems(BigInteger.valueOf(childrenList.size()));

        return result;
    }
 
Example #10
Source File: CmisTypeManager.java    From document-management-system with GNU General Public License v2.0 4 votes vote down vote up
/**
 * CMIS getTypesChildren.
 */
public TypeDefinitionList getTypesChildren(CallContext context, String typeId, boolean includePropertyDefinitions, BigInteger maxItems,
                                           BigInteger skipCount) {
	TypeDefinitionListImpl result = new TypeDefinitionListImpl(new ArrayList<TypeDefinition>());

	int skip = (skipCount == null ? 0 : skipCount.intValue());
	if (skip < 0) {
		skip = 0;
	}

	int max = (maxItems == null ? Integer.MAX_VALUE : maxItems.intValue());
	if (max < 1) {
		return result;
	}

	if (typeId == null) {
		if (skip < 1) {
			result.getList().add(copyTypeDefintion(types.get(FOLDER_TYPE_ID).getTypeDefinition()));
			max--;
		}

		if ((skip < 2) && (max > 0)) {
			result.getList().add(copyTypeDefintion(types.get(DOCUMENT_TYPE_ID).getTypeDefinition()));
			max--;
		}

		result.setHasMoreItems((result.getList().size() + skip) < 2);
		result.setNumItems(BigInteger.valueOf(2));
	} else {
		TypeDefinitionContainer tc = types.get(typeId);

		if ((tc == null) || (tc.getChildren() == null)) {
			return result;
		}

		for (TypeDefinitionContainer child : tc.getChildren()) {
			if (skip > 0) {
				skip--;
				continue;
			}

			result.getList().add(copyTypeDefintion(child.getTypeDefinition()));

			max--;
			if (max == 0) {
				break;
			}
		}

		result.setHasMoreItems((result.getList().size() + skip) < tc.getChildren().size());
		result.setNumItems(BigInteger.valueOf(tc.getChildren().size()));
	}

	if (!includePropertyDefinitions) {
		for (TypeDefinition type : result.getList()) {
			type.getPropertyDefinitions().clear();
		}
	}

	return result;
}
 
Example #11
Source File: TypeManager.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * CMIS getTypesChildren
 * 
 * @param context the call context
 * @param typeId identifier of the type
 * @param includePropertyDefinitions if the property definition must be
 *        included
 * @param maxItems maximum number of items
 * @param skipCount if the counting of children must be avoided
 * 
 * @return list of definitions
 */
public TypeDefinitionList getTypesChildren(CallContext context, String typeId, boolean includePropertyDefinitions,
		BigInteger maxItems, BigInteger skipCount) {
	TypeDefinitionListImpl result = new TypeDefinitionListImpl(new ArrayList<TypeDefinition>());

	int skip = (skipCount == null ? 0 : skipCount.intValue());
	if (skip < 0) {
		skip = 0;
	}

	int max = (maxItems == null ? Integer.MAX_VALUE : maxItems.intValue());
	if (max < 1) {
		return result;
	}

	if (typeId == null) {
		if (skip < 1) {
			result.getList().add(copyTypeDefintion(types.get(FOLDER_TYPE_ID).getTypeDefinition()));
			max--;
		}
		if ((skip < 2) && (max > 0)) {
			result.getList().add(copyTypeDefintion(types.get(DOCUMENT_TYPE_ID).getTypeDefinition()));
			max--;
		}

		result.setHasMoreItems((result.getList().size() + skip) < 2);
		result.setNumItems(BigInteger.valueOf(2));
	} else {
		TypeDefinitionContainer tc = types.get(typeId);
		if ((tc == null) || (tc.getChildren() == null)) {
			return result;
		}

		for (TypeDefinitionContainer child : tc.getChildren()) {
			if (skip > 0) {
				skip--;
				continue;
			}

			result.getList().add(copyTypeDefintion(child.getTypeDefinition()));

			max--;
			if (max == 0) {
				break;
			}
		}

		result.setHasMoreItems((result.getList().size() + skip) < tc.getChildren().size());
		result.setNumItems(BigInteger.valueOf(tc.getChildren().size()));
	}

	if (!includePropertyDefinitions) {
		for (TypeDefinition type : result.getList()) {
			type.getPropertyDefinitions().clear();
		}
	}

	return result;
}
 
Example #12
Source File: CmisRepositoryConfigurationImpl.java    From spring-content with Apache License 2.0 4 votes vote down vote up
public TypeDefinitionList getCmisTypeDefinitionList() {
	return cmisTypeDefinitionList;
}
 
Example #13
Source File: CmisRepositoryConfigurationImpl.java    From spring-content with Apache License 2.0 4 votes vote down vote up
public void setCmisTypeDefinitionList(TypeDefinitionList cmisTypeDefinitionList) {
	this.cmisTypeDefinitionList = cmisTypeDefinitionList;
}
 
Example #14
Source File: FilterCmisService.java    From iaf with Apache License 2.0 4 votes vote down vote up
@Override
public TypeDefinitionList getTypeChildren(String repositoryId, String typeId, Boolean includePropertyDefinitions,
		BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
	return getRepositoryService().getTypeChildren(repositoryId, typeId, includePropertyDefinitions, maxItems,
			skipCount, extension);
}
 
Example #15
Source File: IbisRepositoryService.java    From iaf with Apache License 2.0 4 votes vote down vote up
@Override
public TypeDefinitionList getTypeChildren(String repositoryId, String typeId, Boolean includePropertyDefinitions, 
		BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
	// TODO Auto-generated method stub
	return repositoryService.getTypeChildren(repositoryId, typeId, includePropertyDefinitions, maxItems, skipCount, extension);
}
 
Example #16
Source File: LDRepository.java    From document-management-software with GNU Lesser General Public License v3.0 3 votes vote down vote up
/**
 * CMIS getTypesChildren
 * 
 * @param context call context
 * @param typeId identifier of the type
 * @param includePropertyDefinitions id the property definitions must be
 *        included
 * @param maxItems maximum number of children
 * @param skipCount if the children must be counted
 * 
 * @return the list of type definitions
 */
public TypeDefinitionList getTypesChildren(CallContext context, String typeId, boolean includePropertyDefinitions,
		BigInteger maxItems, BigInteger skipCount) {
	debug("getTypesChildren " + typeId);
	validatePermission(context.getRepositoryId(), context, null);
	return types.getTypesChildren(context, typeId, includePropertyDefinitions, maxItems, skipCount);
}
 
Example #17
Source File: CmisRepositoryConfiguration.java    From spring-content with Apache License 2.0 votes vote down vote up
TypeDefinitionList getCmisTypeDefinitionList(); 
Example #18
Source File: CmisRepositoryConfiguration.java    From spring-content with Apache License 2.0 votes vote down vote up
void setCmisTypeDefinitionList(TypeDefinitionList cmisTypeDefinitionList);