org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionContainer Java Examples
The following examples show how to use
org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionContainer.
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: IbisRepositoryService.java From iaf with Apache License 2.0 | 6 votes |
@Override public List<TypeDefinitionContainer> getTypeDescendants(String repositoryId, String typeId, BigInteger depth, Boolean includePropertyDefinitions, ExtensionsData extension) { if(!eventDispatcher.contains(CmisEvent.GET_TYPE_DESCENDANTS)) { return repositoryService.getTypeDescendants(repositoryId, typeId, depth, includePropertyDefinitions, extension); } else { XmlBuilder cmisXml = new XmlBuilder("cmis"); cmisXml.addSubElement(buildXml("repositoryId", repositoryId)); cmisXml.addSubElement(buildXml("typeId", typeId)); cmisXml.addSubElement(buildXml("depth", depth)); cmisXml.addSubElement(buildXml("includePropertyDefinitions", includePropertyDefinitions)); Element cmisResult = eventDispatcher.trigger(CmisEvent.GET_TYPE_DESCENDANTS, cmisXml.toXML(), callContext); Element typesXml = XmlUtils.getFirstChildTag(cmisResult, "typeDescendants"); return CmisUtils.xml2TypeDescendants(typesXml, callContext.getCmisVersion()); } }
Example #2
Source File: TypeManager.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
/** * Gathers the type descendants tree * * @param depth depth specifications * @param tc the container * @param includePropertyDefinitions if the property definitions must be included * * @return the definition container */ private TypeDefinitionContainer getTypesDescendants(int depth, TypeDefinitionContainer tc, boolean includePropertyDefinitions) { TypeDefinitionContainerImpl result = new TypeDefinitionContainerImpl(); TypeDefinition type = copyTypeDefintion(tc.getTypeDefinition()); if (!includePropertyDefinitions) { type.getPropertyDefinitions().clear(); } result.setTypeDefinition(type); if (depth != 0) { if (tc.getChildren() != null) { result.setChildren(new ArrayList<TypeDefinitionContainer>()); for (TypeDefinitionContainer tdc : tc.getChildren()) { result.getChildren() .add(getTypesDescendants(depth < 0 ? -1 : depth - 1, tdc, includePropertyDefinitions)); } } } return result; }
Example #3
Source File: CmisTypeManager.java From document-management-system with GNU General Public License v2.0 | 6 votes |
/** * Gathers the type descendants tree. */ private TypeDefinitionContainer getTypesDescendants(int depth, TypeDefinitionContainer tc, boolean includePropertyDefinitions) { TypeDefinitionContainerImpl result = new TypeDefinitionContainerImpl(); TypeDefinition type = copyTypeDefintion(tc.getTypeDefinition()); if (!includePropertyDefinitions) { type.getPropertyDefinitions().clear(); } result.setTypeDefinition(type); if (depth != 0) { if (tc.getChildren() != null) { result.setChildren(new ArrayList<TypeDefinitionContainer>()); for (TypeDefinitionContainer tdc : tc.getChildren()) { result.getChildren().add(getTypesDescendants(depth < 0 ? -1 : depth - 1, tdc, includePropertyDefinitions)); } } } return result; }
Example #4
Source File: Converter.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
/** * Converts a type container list * * @param typeContainers the container that specifies the types * * @return the list of type definitions */ public static List<TypeDefinitionContainer> convertTypeContainerList(List<CmisTypeContainer> typeContainers) { if (typeContainers == null) { return null; } List<TypeDefinitionContainer> result = new ArrayList<TypeDefinitionContainer>(); for (CmisTypeContainer container : typeContainers) { TypeDefinitionContainerImpl newConatiner = new TypeDefinitionContainerImpl(); newConatiner.setTypeDefinition(convert(container.getType())); newConatiner.setChildren(convertTypeContainerList(container.getChildren())); convertExtension(container, newConatiner); result.add(newConatiner); } return result; }
Example #5
Source File: Converter.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
/** * Converts a type container list * * @param typeContainers the container of types * @param target the target list */ public static void convertTypeContainerList(List<TypeDefinitionContainer> typeContainers, List<CmisTypeContainer> target) { if (typeContainers == null) { return; } for (TypeDefinitionContainer container : typeContainers) { CmisTypeContainer newConatiner = new CmisTypeContainer(); newConatiner.setType(convert(container.getTypeDefinition())); convertTypeContainerList(container.getChildren(), newConatiner.getChildren()); convertExtension(container, newConatiner); target.add(newConatiner); } }
Example #6
Source File: AlfrescoCmisServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * Gathers the type descendants tree. */ private TypeDefinitionContainer getTypesDescendants( int depth, TypeDefinitionWrapper tdw, boolean includePropertyDefinitions) { TypeDefinitionContainerImpl result = new TypeDefinitionContainerImpl(); result.setTypeDefinition(tdw.getTypeDefinition(includePropertyDefinitions)); if (depth != 0) { String typeId = tdw.getTypeId(); List<TypeDefinitionWrapper> children = connector.getOpenCMISDictionaryService().getChildren(typeId); if (children != null) { result.setChildren(new ArrayList<TypeDefinitionContainer>()); for (TypeDefinitionWrapper tdc : children) { result.getChildren().add( getTypesDescendants(depth < 0 ? -1 : depth - 1, tdc, includePropertyDefinitions)); } } } return result; }
Example #7
Source File: CmisTypeManager.java From document-management-system with GNU General Public License v2.0 | 5 votes |
/** * CMIS getTypeDefinition. */ public TypeDefinition getTypeDefinition(CallContext context, String typeId) { TypeDefinitionContainer tc = types.get(typeId); if (tc == null) { throw new CmisObjectNotFoundException("Type '" + typeId + "' is unknown!"); } return copyTypeDefintion(tc.getTypeDefinition()); }
Example #8
Source File: CmisTypeManager.java From document-management-system with GNU General Public License v2.0 | 5 votes |
/** * For internal use. */ public TypeDefinition getType(String typeId) { TypeDefinitionContainer tc = types.get(typeId); if (tc == null) { return null; } return tc.getTypeDefinition(); }
Example #9
Source File: CmisTypeManager.java From document-management-system with GNU General Public License v2.0 | 5 votes |
/** * CMIS getTypesDescendants. */ public List<TypeDefinitionContainer> getTypesDescendants(CallContext context, String typeId, BigInteger depth, Boolean includePropertyDefinitions) { List<TypeDefinitionContainer> result = new ArrayList<TypeDefinitionContainer>(); // check depth int d = (depth == null ? -1 : depth.intValue()); if (d == 0) { throw new CmisInvalidArgumentException("Depth must not be 0!"); } if (typeId == null) { d = -1; } // set property definition flag to default value if not set boolean ipd = (includePropertyDefinitions == null ? false : includePropertyDefinitions.booleanValue()); if (typeId == null) { result.add(getTypesDescendants(d, types.get(FOLDER_TYPE_ID), ipd)); result.add(getTypesDescendants(d, types.get(DOCUMENT_TYPE_ID), ipd)); // result.add(getTypesDescendants(depth, // fTypes.get(RELATIONSHIP_TYPE_ID), includePropertyDefinitions)); // result.add(getTypesDescendants(depth, fTypes.get(POLICY_TYPE_ID), // includePropertyDefinitions)); } else { TypeDefinitionContainer tc = types.get(typeId); if (tc != null) { result.add(getTypesDescendants(d, tc, ipd)); } } return result; }
Example #10
Source File: CmisTypeManager.java From document-management-system with GNU General Public License v2.0 | 5 votes |
/** * Adds a type to collection. */ private void addTypeInteral(AbstractTypeDefinition type) { if (type == null) { return; } if (types.containsKey(type.getId())) { // can't overwrite a type return; } TypeDefinitionContainerImpl tc = new TypeDefinitionContainerImpl(); tc.setTypeDefinition(type); // add to parent if (type.getParentTypeId() != null) { TypeDefinitionContainerImpl tdc = types.get(type.getParentTypeId()); if (tdc != null) { if (tdc.getChildren() == null) { tdc.setChildren(new ArrayList<TypeDefinitionContainer>()); } tdc.getChildren().add(tc); } } types.put(type.getId(), tc); typesList.add(tc); }
Example #11
Source File: ConformanceCmisServiceWrapper.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
@Override public List<TypeDefinitionContainer> getTypeDescendants(String repositoryId, String typeId, BigInteger depth, Boolean includePropertyDefinitions, ExtensionsData extension) { checkRepositoryId(repositoryId); includePropertyDefinitions = getDefaultFalse(includePropertyDefinitions); depth = getTypesDepth(depth); try { return getWrappedService().getTypeDescendants(repositoryId, typeId, depth, includePropertyDefinitions, extension); } catch (Exception e) { throw createCmisException(e); } }
Example #12
Source File: TypeManager.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
/** * Adds a type to collection. */ private void addTypeInteral(AbstractTypeDefinition type) { if (type == null) { return; } if (types.containsKey(type.getId())) { // can't overwrite a type return; } TypeDefinitionContainerImpl tc = new TypeDefinitionContainerImpl(); tc.setTypeDefinition(type); // add to parent if (type.getParentTypeId() != null) { TypeDefinitionContainerImpl tdc = types.get(type.getParentTypeId()); if (tdc != null) { if (tdc.getChildren() == null) { tdc.setChildren(new ArrayList<TypeDefinitionContainer>()); } tdc.getChildren().add(tc); } } types.put(type.getId(), tc); typesList.add(tc); }
Example #13
Source File: CmisUtils.java From iaf with Apache License 2.0 | 5 votes |
public static List<TypeDefinitionContainer> xml2TypeDescendants(Element typeDefinitionsXml, CmisVersion cmisVersion) { List<TypeDefinitionContainer> typeDefinitionList = new ArrayList<TypeDefinitionContainer>(); Collection<Node> typeDescendantList = XmlUtils.getChildTags(typeDefinitionsXml, "typeDescendant"); for (Node node : typeDescendantList) { Element typeDefinition = XmlUtils.getFirstChildTag((Element) node, "typeDefinition"); TypeDefinition typeDef = CmisUtils.xml2TypeDefinition(typeDefinition, cmisVersion); TypeDefinitionContainerImpl typeDefinitionContainer = new TypeDefinitionContainerImpl(typeDef); Element children = XmlUtils.getFirstChildTag((Element) node, "children"); typeDefinitionContainer.setChildren(xml2TypeDescendants(children, cmisVersion)); typeDefinitionList.add(typeDefinitionContainer); } return typeDefinitionList; }
Example #14
Source File: TypeManager.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
/** * CMIS getTypeDefinition * * @param context call context * @param typeId identifier of the type * * @return definition of the type */ public TypeDefinition getTypeDefinition(CallContext context, String typeId) { TypeDefinitionContainer tc = types.get(typeId); if (tc == null) { throw new CmisObjectNotFoundException("Type '" + typeId + "' is unknown!"); } return copyTypeDefintion(tc.getTypeDefinition()); }
Example #15
Source File: TypeManager.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
/** * For internal use * * @param typeId identifier of the type * * @return the type definition */ public TypeDefinition getType(String typeId) { TypeDefinitionContainer tc = types.get(typeId); if (tc == null) { return null; } return tc.getTypeDefinition(); }
Example #16
Source File: TypeManager.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
/** * CMIS getTypesDescendants * * @param context call context * @param typeId id of the type * @param depth depth specification * @param includePropertyDefinitions if the properties definition must be included * * @return list of definitions */ public List<TypeDefinitionContainer> getTypesDescendants(CallContext context, String typeId, BigInteger depth, Boolean includePropertyDefinitions) { List<TypeDefinitionContainer> result = new ArrayList<TypeDefinitionContainer>(); // check depth int d = (depth == null ? -1 : depth.intValue()); if (d == 0) { throw new CmisInvalidArgumentException("Depth must not be 0!"); } // set property definition flag to default value if not set boolean ipd = (includePropertyDefinitions == null ? false : includePropertyDefinitions.booleanValue()); if (typeId == null) { result.add(getTypesDescendants(d, types.get(FOLDER_TYPE_ID), ipd)); result.add(getTypesDescendants(d, types.get(DOCUMENT_TYPE_ID), ipd)); // result.add(getTypesDescendants(depth, // fTypes.get(RELATIONSHIP_TYPE_ID), includePropertyDefinitions)); // result.add(getTypesDescendants(depth, fTypes.get(POLICY_TYPE_ID), // includePropertyDefinitions)); } else { TypeDefinitionContainer tc = types.get(typeId); if (tc != null) { result.add(getTypesDescendants(d, tc, ipd)); } } return result; }
Example #17
Source File: FilterCmisService.java From iaf with Apache License 2.0 | 4 votes |
@Override public List<TypeDefinitionContainer> getTypeDescendants(String repositoryId, String typeId, BigInteger depth, Boolean includePropertyDefinitions, ExtensionsData extension) { return getRepositoryService().getTypeDescendants(repositoryId, typeId, depth, includePropertyDefinitions, extension); }
Example #18
Source File: CmisServiceImpl.java From document-management-system with GNU General Public License v2.0 | 4 votes |
@Override public List<TypeDefinitionContainer> getTypeDescendants(String repositoryId, String typeId, BigInteger depth, Boolean includePropertyDefinitions, ExtensionsData extension) { log.debug("getTypeDescendants({}, {}, {})", new Object[]{repositoryId, typeId, depth}); return getRepository().getTypesDescendants(getCallContext(), typeId, depth, includePropertyDefinitions); }
Example #19
Source File: AbstractCmisServiceWrapper.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
@Override public List<TypeDefinitionContainer> getTypeDescendants(String repositoryId, String typeId, BigInteger depth, Boolean includePropertyDefinitions, ExtensionsData extension) { return service.getTypeDescendants(repositoryId, typeId, depth, includePropertyDefinitions, extension); }
Example #20
Source File: CmisTypeManager.java From document-management-system with GNU General Public License v2.0 | 4 votes |
/** * 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 #21
Source File: LDCmisService.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
@Override public List<TypeDefinitionContainer> getTypeDescendants(String repositoryId, String typeId, BigInteger depth, Boolean includePropertyDefinitions, ExtensionsData extension) { validateSession(); return getRepository().getTypesDescendants(getCallContext(), typeId, depth, includePropertyDefinitions); }
Example #22
Source File: TypeManager.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
/** * 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 #23
Source File: LDRepository.java From document-management-software with GNU Lesser General Public License v3.0 | 3 votes |
/** * CMIS getTypesDescendants * * @param context the call context * @param typeId identifier of the type * @param depth a depth specification * @param includePropertyDefinitions if property definitions must be * included * * @return the list of type definitions */ public List<TypeDefinitionContainer> getTypesDescendants(CallContext context, String typeId, BigInteger depth, Boolean includePropertyDefinitions) { debug("getTypesDescendants"); validatePermission(context.getRepositoryId(), context, null); return types.getTypesDescendants(context, typeId, depth, includePropertyDefinitions); }