Package org.apache.chemistry.opencmis.commons.definitions

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


        } catch (CmisObjectNotFoundException e) {
            log.info("getTypeDefinition() with unknown type raised expected exception: " + e);
        }

        try {
            TypeDefinitionList types = fRepSvc.getTypeChildren(wrongRepositoryId, "CMISDocument", Boolean.TRUE,
                    BigInteger.valueOf(100), BigInteger.ZERO, null);
            log.debug("getTypeChildren(): " + types);
            fail("getTypeDescendants() with unknown type should throw InvalidArgumentException.");
        } catch (CmisInvalidArgumentException e) {
            log.info("getTypeDescendants() with unknown repository id raised expected exception: " + e);
        }

        try {
            TypeDefinitionList types = fRepSvc.getTypeChildren(repositoryId, wrongTypeId, Boolean.TRUE, BigInteger
                    .valueOf(100), BigInteger.ZERO, null);
            log.debug("getTypeChildren(): " + types);
            fail("getTypeDescendants() with unknown type should throw exception.");
        } catch (CmisInvalidArgumentException e) {
            log.info("getTypeDescendants() with unknown type raised expected exception: " + e);
View Full Code Here


        boolean includePropertyDefinitions = getBooleanParameter(request, Constants.PARAM_PROPERTY_DEFINITIONS, false);
        BigInteger maxItems = getBigIntegerParameter(request, Constants.PARAM_MAX_ITEMS);
        BigInteger skipCount = getBigIntegerParameter(request, Constants.PARAM_SKIP_COUNT);

        // execute
        TypeDefinitionList typeList = service.getTypeChildren(repositoryId, typeId, includePropertyDefinitions,
                maxItems, skipCount, null);

        BigInteger numItems = (typeList == null ? null : typeList.getNumItems());
        Boolean hasMoreItems = (typeList == null ? null : typeList.hasMoreItems());

        String parentTypeId = null;
        String typeName = "Type Children";

        // in order to get the parent type, we need the type definition of this
        // type as well
        if (typeId != null) {
            TypeDefinition typeDefinition = service.getTypeDefinition(repositoryId, typeId, null);

            parentTypeId = (typeDefinition == null ? null : typeDefinition.getParentTypeId());
            typeName = (typeDefinition == null ? typeId : typeDefinition.getDisplayName());
        }

        // write XML
        response.setStatus(HttpServletResponse.SC_OK);
        response.setContentType(Constants.MEDIATYPE_FEED);

        AtomFeed feed = new AtomFeed();
        feed.startDocument(response.getOutputStream());
        feed.startFeed(true);

        // write basic Atom feed elements
        feed.writeFeedElements(typeId, TYPE_AUTHOR, typeName, new GregorianCalendar(), null, numItems);

        // write links
        UrlBuilder baseUrl = compileBaseUrl(request, repositoryId);

        feed.writeServiceLink(baseUrl.toString(), repositoryId);

        UrlBuilder selfLink = compileUrlBuilder(baseUrl, RESOURCE_TYPES, null);
        selfLink.addParameter(Constants.PARAM_TYPE_ID, typeId);
        selfLink.addParameter(Constants.PARAM_PROPERTY_DEFINITIONS, includePropertyDefinitions);
        feed.writeSelfLink(selfLink.toString(), typeId);

        feed.writeViaLink(compileUrl(baseUrl, RESOURCE_TYPE, typeId));

        UrlBuilder downLink = compileUrlBuilder(baseUrl, RESOURCE_TYPESDESC, null);
        downLink.addParameter(Constants.PARAM_TYPE_ID, typeId);
        feed.writeDownLink(downLink.toString(), Constants.MEDIATYPE_DESCENDANTS);

        if (parentTypeId != null) {
            feed.writeUpLink(compileUrl(baseUrl, RESOURCE_TYPE, parentTypeId), Constants.MEDIATYPE_ENTRY);
        }

        // write paging links
        UrlBuilder pagingUrl = compileUrlBuilder(baseUrl, RESOURCE_TYPES, null);
        pagingUrl.addParameter(Constants.PARAM_TYPE_ID, typeId);
        pagingUrl.addParameter(Constants.PARAM_PROPERTY_DEFINITIONS, includePropertyDefinitions);
        feed.writePagingLinks(pagingUrl, maxItems, skipCount, numItems, hasMoreItems, PAGE_SIZE);

        // write collection
        UrlBuilder collectionUrl = compileUrlBuilder(baseUrl, RESOURCE_TYPES, null);
        collectionUrl.addParameter(Constants.PARAM_TYPE_ID, typeId);
        feed.writeCollection(collectionUrl.toString(), null, "Types Collection", "");

        // write type entries
        if ((typeList != null) && (typeList.getList() != null)) {
            AtomEntry entry = new AtomEntry(feed.getWriter());
            for (TypeDefinition type : typeList.getList()) {
                writeTypeEntry(entry, type, null, repositoryId, baseUrl, false);
            }
        }

        // we are done
View Full Code Here

            @Override
            protected AbstractPageFetcher.Page<ObjectType> fetchPage(long skipCount) {

                // fetch the data
                TypeDefinitionList tdl = repositoryService.getTypeChildren(SessionImpl.this.getRepositoryId(), typeId,
                        includePropertyDefinitions, BigInteger.valueOf(this.maxNumItems),
                        BigInteger.valueOf(skipCount), null);

                // convert type definitions
                List<ObjectType> page = new ArrayList<ObjectType>(tdl.getList().size());
                for (TypeDefinition typeDefinition : tdl.getList()) {
                    page.add(convertTypeDefinition(typeDefinition));
                }

                return new AbstractPageFetcher.Page<ObjectType>(page, tdl.getNumItems(), tdl.hasMoreItems()) {
                };
            }
        });
    }
View Full Code Here

            @Override
            protected AbstractPageFetcher.Page<ObjectType> fetchPage(long skipCount) {

                // fetch the data
                TypeDefinitionList tdl = repositoryService.getTypeChildren(SessionImpl.this.getRepositoryId(), typeId,
                        includePropertyDefinitions, BigInteger.valueOf(this.maxNumItems),
                        BigInteger.valueOf(skipCount), null);

                // convert type definitions
                List<ObjectType> page = new ArrayList<ObjectType>(tdl.getList().size());
                for (TypeDefinition typeDefinition : tdl.getList()) {
                    page.add(objectFactory.convertTypeDefinition(typeDefinition));
                }

                return new AbstractPageFetcher.Page<ObjectType>(page, tdl.getNumItems(), tdl.hasMoreItems()) {
                };
            }
        });
    }
View Full Code Here

        boolean includePropertyDefinitions = getBooleanParameter(request, PARAM_PROPERTY_DEFINITIONS, false);
        BigInteger maxItems = getBigIntegerParameter(request, PARAM_MAX_ITEMS);
        BigInteger skipCount = getBigIntegerParameter(request, PARAM_SKIP_COUNT);

        // execute
        TypeDefinitionList typeList = service.getTypeChildren(repositoryId, typeId, includePropertyDefinitions,
                maxItems, skipCount, null);
        JSONObject jsonTypeList = JSONConverter.convert(typeList);

        response.setStatus(HttpServletResponse.SC_OK);
        BrowserBindingUtils.writeJSON(jsonTypeList, request, response);
View Full Code Here

            d = -1;
        }

        List<TypeDefinitionContainer> result = new ArrayList<TypeDefinitionContainer>();

        TypeDefinitionList children = getTypeChildren(repositoryId, typeId, includePropertyDefinitions,
                BigInteger.valueOf(Integer.MAX_VALUE), BigInteger.ZERO, null);

        if (children != null && children.getList() != null && children.getList().size() > 0) {
            for (TypeDefinition td : children.getList()) {
                TypeDefinitionContainerImpl tdc = new TypeDefinitionContainerImpl(td);
                addTypeChildren(repositoryId, includePropertyDefinitions, (d > 0 ? d - 1 : -1), tdc);
                result.add(tdc);
            }
        }
View Full Code Here

        if (depth == 0) {
            return;
        }

        TypeDefinitionList children = getTypeChildren(repositoryId, container.getTypeDefinition().getId(),
                includePropertyDefinitions, BigInteger.valueOf(Integer.MAX_VALUE), BigInteger.ZERO, null);

        if (children != null && children.getList() != null && children.getList().size() > 0) {
            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);
            }
        }
View Full Code Here

        // policies and relationships
        info.setSupportsRelationships(false);
        info.setSupportsPolicies(false);

        TypeDefinitionList baseTypesList = getTypeChildren(repositoryId, null, Boolean.FALSE, BigInteger.valueOf(4),
                BigInteger.ZERO, null);
        for (TypeDefinition type : baseTypesList.getList()) {
            if (BaseTypeId.CMIS_RELATIONSHIP.value().equals(type.getId())) {
                info.setSupportsRelationships(true);
            } else if (BaseTypeId.CMIS_POLICY.value().equals(type.getId())) {
                info.setSupportsPolicies(true);
            }
View Full Code Here

            @Override
            protected AbstractPageFetcher.Page<ObjectType> fetchPage(long skipCount) {

                // fetch the data
                TypeDefinitionList tdl = repositoryService.getTypeChildren(SessionImpl.this.getRepositoryId(), typeId,
                        includePropertyDefinitions, BigInteger.valueOf(this.maxNumItems),
                        BigInteger.valueOf(skipCount), null);

                // convert type definitions
                List<ObjectType> page = new ArrayList<ObjectType>(tdl.getList().size());
                for (TypeDefinition typeDefinition : tdl.getList()) {
                    page.add(objectFactory.convertTypeDefinition(typeDefinition));
                }

                return new AbstractPageFetcher.Page<ObjectType>(page, tdl.getNumItems(), tdl.hasMoreItems()) {
                };
            }
        });
    }
View Full Code Here

            @Override
            protected AbstractPageFetcher.Page<ObjectType> fetchPage(long skipCount) {

                // fetch the data
                TypeDefinitionList tdl = repositoryService.getTypeChildren(SessionImpl.this.getRepositoryId(), typeId,
                        includePropertyDefinitions, BigInteger.valueOf(this.maxNumItems),
                        BigInteger.valueOf(skipCount), null);

                // convert type definitions
                List<ObjectType> page = new ArrayList<ObjectType>(tdl.getList().size());
                for (TypeDefinition typeDefinition : tdl.getList()) {
                    page.add(convertTypeDefinition(typeDefinition));
                }

                return new AbstractPageFetcher.Page<ObjectType>(page, tdl.getNumItems(), tdl.hasMoreItems()) {
                };
            }
        });
    }
View Full Code Here

TOP

Related Classes of org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.