org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException Java Examples
The following examples show how to use
org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException.
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: LDRepository.java From document-management-software with GNU Lesser General Public License v3.0 | 7 votes |
/** * Create dispatch for AtomPub * * @param context call context * @param properties the properties * @param folderId identifier of the parent folder * @param contentStream stream of the document to create * @param versioningState state of the version * @param objectInfos informations * * @return the newly created object */ public ObjectData create(CallContext context, Properties properties, String folderId, ContentStream contentStream, VersioningState versioningState, ObjectInfoHandler objectInfos) { debug("create " + folderId); validatePermission(folderId, context, Permission.WRITE); String typeId = getTypeId(properties); TypeDefinition type = types.getType(typeId); if (type == null) throw new CmisObjectNotFoundException("Type '" + typeId + "' is unknown!"); String objectId = null; if (type.getBaseTypeId() == BaseTypeId.CMIS_DOCUMENT) { objectId = createDocument(context, properties, folderId, contentStream, versioningState); return compileObjectType(context, getDocument(objectId), null, false, false, objectInfos); } else if (type.getBaseTypeId() == BaseTypeId.CMIS_FOLDER) { objectId = createFolder(context, properties, folderId); return compileObjectType(context, getFolder(objectId), null, false, false, objectInfos); } else { throw new CmisObjectNotFoundException("Cannot create object of type '" + typeId + "'!"); } }
Example #2
Source File: LDRepository.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
public String createDocumentFromSource(CallContext context, String sourceId, String folderId) { debug("createDocumentFromSource"); validatePermission(folderId, context, Permission.WRITE); try { Folder target = getFolder(folderId); if (target == null) throw new CmisObjectNotFoundException("Folder '" + folderId + "' is unknown!"); Document doc = (Document) getDocument(sourceId); if (doc == null) throw new CmisObjectNotFoundException("Document '" + sourceId + "' is unknown!"); DocumentHistory transaction = new DocumentHistory(); transaction.setSessionId(sid); transaction.setEvent(DocumentEvent.STORED.toString()); transaction.setUser(getSessionUser()); transaction.setComment(""); Document newDoc = documentManager.copyToFolder(doc, target, transaction); return getId(newDoc); } catch (Throwable t) { return (String) catchError(t); } }
Example #3
Source File: CmisSender.java From iaf with Apache License 2.0 | 6 votes |
private CmisObject getCmisObject(Element queryElement) throws SenderException, CmisObjectNotFoundException { String filter = XmlUtils.getChildTagAsString(queryElement, "filter"); boolean includeAllowableActions = XmlUtils.getChildTagAsBoolean(queryElement, "includeAllowableActions"); boolean includePolicies = XmlUtils.getChildTagAsBoolean(queryElement, "includePolicies"); boolean includeAcl = XmlUtils.getChildTagAsBoolean(queryElement, "includeAcl"); OperationContext operationContext = cmisSession.createOperationContext(); if (StringUtils.isNotEmpty(filter)) operationContext.setFilterString(filter); operationContext.setIncludeAllowableActions(includeAllowableActions); operationContext.setIncludePolicies(includePolicies); operationContext.setIncludeAcls(includeAcl); String objectIdstr = XmlUtils.getChildTagAsString(queryElement, "objectId"); if(objectIdstr == null) objectIdstr = XmlUtils.getChildTagAsString(queryElement, "id"); if(objectIdstr != null) { return cmisSession.getObject(cmisSession.createObjectId(objectIdstr), operationContext); } else { //Ok, id can still be null, perhaps its a path? String path = XmlUtils.getChildTagAsString(queryElement, "path"); return cmisSession.getObjectByPath(path, operationContext); } }
Example #4
Source File: CmisSender.java From iaf with Apache License 2.0 | 6 votes |
private String sendMessageForActionDelete(String message, IPipeLineSession session) throws SenderException, TimeOutException { if (StringUtils.isEmpty(message)) { throw new SenderException(getLogPrefix() + "input string cannot be empty but must contain a documentId"); } CmisObject object = null; try { object = getCmisObject(message); } catch (CmisObjectNotFoundException e) { if (StringUtils.isNotEmpty(getResultOnNotFound())) { log.info(getLogPrefix() + "document with id [" + message + "] not found", e); return getResultOnNotFound(); } else { throw new SenderException(e); } } if (object.hasAllowableAction(Action.CAN_DELETE_OBJECT)) { //// You can delete Document suppDoc = (Document) object; suppDoc.delete(true); String correlationID = session==null ? null : session.getMessageId(); return correlationID; } else { //// You can't delete throw new SenderException(getLogPrefix() + "Document cannot be deleted"); } }
Example #5
Source File: PublicApiAlfrescoCmisService.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 6 votes |
@Override public RepositoryInfo getRepositoryInfo(String repositoryId, ExtensionsData extension) { Network network = null; try { checkRepositoryId(repositoryId); network = networksService.getNetwork(repositoryId); } catch(Exception e) { // ACE-2540: Avoid information leak. Same response if repository does not exist or if user is not a member throw new CmisObjectNotFoundException("Unknown repository '" + repositoryId + "'!"); } return getRepositoryInfo(network); }
Example #6
Source File: AlfrescoCmisServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void removePolicy(String repositoryId, String policyId, String objectId, ExtensionsData extension) { checkRepositoryId(repositoryId); // what kind of object is it? CMISNodeInfo info = getOrCreateNodeInfo(objectId, "Object"); TypeDefinitionWrapper type = info.getType(); if (type == null) { throw new CmisObjectNotFoundException("No corresponding type found! Not a CMIS object?"); } throw new CmisConstraintException("Object is not policy controllable!"); }
Example #7
Source File: AlfrescoCmisServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void applyPolicy(String repositoryId, String policyId, String objectId, ExtensionsData extension) { checkRepositoryId(repositoryId); // what kind of object is it? CMISNodeInfo info = getOrCreateNodeInfo(objectId, "Object"); TypeDefinitionWrapper type = info.getType(); if (type == null) { throw new CmisObjectNotFoundException("No corresponding type found! Not a CMIS object?"); } connector.applyPolicies(info.getNodeRef(), type, Collections.singletonList(policyId)); }
Example #8
Source File: LDCmisService.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
@Override public RepositoryInfo getRepositoryInfo(String repositoryId, ExtensionsData extension) { log.debug("** getRepositoryInfo"); validateSession(); String latestChangeLogToken; if (cachedChangeLogToken != null) { latestChangeLogToken = cachedChangeLogToken; } else { latestChangeLogToken = getLatestChangeLogToken(repositoryId); cachedChangeLogToken = latestChangeLogToken; } for (LDRepository repo : repositories.values()) { if (repo.getId().equals(repositoryId)) { return repo.getRepositoryInfo(getCallContext(), latestChangeLogToken); } } throw new CmisObjectNotFoundException("Unknown repository '" + repositoryId + "'!"); }
Example #9
Source File: LDRepository.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
public void cancelCheckOut(String objectId) { debug("cancelCheckOut " + objectId); validatePermission(objectId, null, Permission.WRITE); try { // get the document PersistentObject object = getObject(objectId); if (object == null) throw new CmisObjectNotFoundException(String.format("Object %s not found!", objectId)); if (!(object instanceof Document)) throw new CmisObjectNotFoundException(String.format("Object %s is not a Document!", objectId)); Document doc = (Document) object; if (doc.getStatus() == Document.DOC_CHECKED_OUT && ((getSessionUser().getId() != doc.getLockUserId()) && (!getSessionUser().isMemberOf("admin")))) throw new CmisPermissionDeniedException("You can't change the checkout status on this object!"); // Create the document history event DocumentHistory transaction = new DocumentHistory(); transaction.setSessionId(sid); transaction.setEvent(DocumentEvent.UNLOCKED.toString()); transaction.setComment(""); transaction.setUser(getSessionUser()); documentDao.initialize(doc); doc.setStatus(Document.DOC_UNLOCKED); documentDao.store(doc, transaction); } catch (Throwable t) { catchError(t); } }
Example #10
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 #11
Source File: CmisSender.java From iaf with Apache License 2.0 | 5 votes |
private CmisObject getCmisObject(String message) throws SenderException, CmisObjectNotFoundException { if (XmlUtils.isWellFormed(message, "cmis")) { try { Element queryElement = XmlUtils.buildElement(message); return getCmisObject(queryElement); } catch (DomBuilderException e) { throw new SenderException("unable to build cmis xml from sender input message", e); } } throw new SenderException("unable to build cmis xml from sender input message"); }
Example #12
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 #13
Source File: PublicApiAlfrescoCmisService.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void checkRepositoryId(String repositoryId) { if(repositoryId.equals(TenantUtil.DEFAULT_TENANT) || repositoryId.equals(TenantUtil.SYSTEM_TENANT)) { // TODO check for super admin return; } if(!tenantAdminService.existsTenant(repositoryId) || !tenantAdminService.isEnabledTenant(repositoryId)) { throw new CmisObjectNotFoundException("Unknown repository '" + repositoryId + "'!"); } }
Example #14
Source File: AlfrescoCmisServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
protected void checkRepositoryId(String repositoryId) { if (!connector.getRepositoryId().equals(repositoryId)) { throw new CmisObjectNotFoundException("Unknown repository '" + repositoryId + "'!"); } }
Example #15
Source File: LDRepository.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
public void deleteObjectOrCancelCheckOut(CallContext context, String objectId) { // get the file or folder PersistentObject object = getObject(objectId); if (object == null) throw new CmisObjectNotFoundException(String.format("Object %s not found!", objectId)); if (object instanceof Document) { Document doc = (Document) object; if (doc.getStatus() != Document.DOC_UNLOCKED) cancelCheckOut(objectId); else deleteObject(context, objectId); } else deleteObject(context, objectId); }
Example #16
Source File: LDRepository.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
/** * CMIS deleteObject * * @param context call context * @param objectId identifier of the file/folder */ public void deleteObject(CallContext context, String objectId) { debug("deleteObject " + objectId); validatePermission(objectId, context, Permission.DELETE); try { // get the file or folder PersistentObject object = getObject(objectId); if (object == null) throw new CmisObjectNotFoundException(String.format("Object %s not found!", objectId)); if (object instanceof Folder) { Folder folder = (Folder) object; List<Document> docs = documentDao.findByFolder(folder.getId(), 2); List<Folder> folders = folderDao.findByParentId(folder.getId()); // check if it is a folder and if it is empty if (!docs.isEmpty() || !folders.isEmpty()) throw new CmisConstraintException(String.format("Folder %s is not empty!", objectId)); } if (!delete(object)) throw new CmisStorageException("Deletion failed!"); } catch (Throwable t) { catchError(t); } }
Example #17
Source File: AlfrescoCmisServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
@Override public TypeDefinition getTypeDefinition(String repositoryId, String typeId, ExtensionsData extension) { checkRepositoryId(repositoryId); // find the type TypeDefinitionWrapper tdw = connector.getOpenCMISDictionaryService().findType(typeId); if (tdw == null) { throw new CmisObjectNotFoundException("Type '" + typeId + "' is unknown!"); } // return type definition return tdw.getTypeDefinition(true); }
Example #18
Source File: CMISConnector.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
private void checkDocumentTypeForContent(TypeDefinitionWrapper type) { if (type == null) { throw new CmisObjectNotFoundException("No corresponding type found! Not a CMIS object?"); } if (!(type instanceof DocumentTypeDefinitionWrapper)) { throw new CmisStreamNotSupportedException("Object is not a document!"); } if (((DocumentTypeDefinition) type.getTypeDefinition(false)).getContentStreamAllowed() == ContentStreamAllowed.NOTALLOWED) { throw new CmisConstraintException("Document cannot have content!"); } }
Example #19
Source File: CMISConnector.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * Creates the CMIS object for a node. */ public ObjectData createCMISObject(CMISNodeInfo info, String filter, boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter, boolean includePolicyIds, boolean includeAcl) { if (info.getType() == null) { throw new CmisObjectNotFoundException("No corresponding type found! Not a CMIS object?"); } Properties nodeProps = (info.isRelationship() ? getAssocProperties(info, filter) : getNodeProperties(info, filter)); return createCMISObjectImpl(info, nodeProps, filter, includeAllowableActions, includeRelationships, renditionFilter, includePolicyIds, includeAcl); }
Example #20
Source File: CMISConnector.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * Returns the root folder node ref. */ public NodeRef getRootNodeRef() { NodeRef rootNodeRef = (NodeRef)singletonCache.get(KEY_CMIS_ROOT_NODEREF); if (rootNodeRef == null) { rootNodeRef = AuthenticationUtil.runAs(new RunAsWork<NodeRef>() { public NodeRef doWork() throws Exception { return transactionService.getRetryingTransactionHelper().doInTransaction( new RetryingTransactionCallback<NodeRef>() { public NodeRef execute() throws Exception { NodeRef root = nodeService.getRootNode(storeRef); List<NodeRef> rootNodes = searchService.selectNodes(root, rootPath, null, namespaceService, false); if (rootNodes.size() != 1) { throw new CmisRuntimeException("Unable to locate CMIS root path " + rootPath); } return rootNodes.get(0); }; }, true); } }, AuthenticationUtil.getSystemUserName()); if (rootNodeRef == null) { throw new CmisObjectNotFoundException("Root folder path '" + rootPath + "' not found!"); } singletonCache.put(KEY_CMIS_ROOT_NODEREF, rootNodeRef); } return rootNodeRef; }
Example #21
Source File: LDRepository.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
private Object catchError(Throwable t) { if (t instanceof CmisObjectNotFoundException) log.debug(t.getMessage()); else if (t instanceof IllegalArgumentException) log.warn(t.getMessage()); else log.error(t.getMessage(), t); if (t instanceof CmisBaseException) throw (CmisBaseException) t; else throw new CmisStorageException("CMIS Error!", t); }
Example #22
Source File: LDRepository.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
public void checkOut(Holder<String> objectId, Holder<Boolean> contentCopied) { //debug("checkOut " + objectId.getValue()); log.debug("checkOut {}", objectId); validatePermission(objectId.getValue(), null, Permission.WRITE); try { // get the document PersistentObject object = getObject(objectId.getValue()); if (object == null) throw new CmisObjectNotFoundException(String.format("Object %s not found!", objectId.getValue())); if (!(object instanceof Document)) throw new CmisObjectNotFoundException( String.format("Object %s is not a Document!", objectId.getValue())); // Create the document history event DocumentHistory transaction = new DocumentHistory(); transaction.setSessionId(sid); transaction.setEvent(DocumentEvent.CHECKEDOUT.toString()); transaction.setComment(""); transaction.setUser(getSessionUser()); documentManager.checkout(object.getId(), transaction); objectId.setValue(getId(object)); if (contentCopied != null) contentCopied.setValue(Boolean.TRUE); } catch (Throwable t) { catchError(t); } }
Example #23
Source File: LDRepository.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
public void checkIn(Holder<String> objectId, Boolean major, ContentStream contentStream, Properties properties, String checkinComment) { //debug("checkin " + objectId); log.debug("checkin {}", objectId); validatePermission(objectId.getValue(), null, Permission.WRITE); try { PersistentObject object = getObject(objectId.getValue()); if (object == null) throw new CmisObjectNotFoundException(String.format("Object %s not found!", objectId.getValue())); if (!(object instanceof Document)) throw new CmisObjectNotFoundException( String.format("Object %s is not a Document!", objectId.getValue())); Document doc = (Document) object; if (doc.getStatus() == Document.DOC_CHECKED_OUT && ((getSessionUser().getId() != doc.getLockUserId()) && (!getSessionUser().isMemberOf("admin")))) { throw new CmisPermissionDeniedException( String.format("You can't do a checkin on object %s!", objectId.getValue())); } DocumentHistory transaction = new DocumentHistory(); transaction.setSessionId(sid); transaction.setEvent(DocumentEvent.CHECKEDIN.toString()); transaction.setUser(getSessionUser()); transaction.setComment(checkinComment); if (properties != null) { updateDocumentMetadata(doc, properties, false); } documentManager.checkin(doc.getId(), contentStream.getStream(), doc.getFileName(), major, null, transaction); } catch (Throwable t) { catchError(t); } }
Example #24
Source File: LDRepository.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
/** * CMIS getObject * * @param context the call context * @param objectId identifier of the file/foler * @param versionServicesId version specification * @param filter optional filter * @param includeAllowableActions if the allowable actions must be included * @param includeAcl if the ACL must be included * @param objectInfos informations * * @return the file/folder */ public ObjectData getObject(CallContext context, String objectId, String versionServicesId, String filter, Boolean includeAllowableActions, Boolean includeAcl, ObjectInfoHandler objectInfos) { debug("getObject " + objectId); try { validatePermission(objectId, context, null); if (objectId == null) { // this works only because there are no versions in a file // system // and the object id and version series id are the same objectId = versionServicesId; } PersistentObject obj = getObject(objectId); if (obj == null) throw new CmisObjectNotFoundException(String.format("Object ID %s not found", objectId)); // set defaults if values not set boolean iaa = (includeAllowableActions == null ? false : includeAllowableActions.booleanValue()); boolean iacl = (includeAcl == null ? false : includeAcl.booleanValue()); // split filter Set<String> filterCollection = splitFilter(filter); // gather properties return compileObjectType(context, obj, filterCollection, iaa, iacl, objectInfos); } catch (Throwable t) { t.printStackTrace(); return (ObjectData) catchError(t); } }
Example #25
Source File: CMISNodeInfoImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
public void checkIfUseful(String what) { switch (objecVariant) { case INVALID_ID: throw new CmisInvalidArgumentException(what + " id is invalid: " + objectId); case NOT_EXISTING: throw new CmisObjectNotFoundException(what + " not found: " + objectId); case NOT_A_CMIS_OBJECT: throw new CmisObjectNotFoundException(what + " is not a CMIS object: " + objectId); case PERMISSION_DENIED: throw new CmisPermissionDeniedException("Permission denied!"); } }
Example #26
Source File: LDRepository.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
/** * CMIS deleteTree * * @param context call context * @param folderId identifier of the folder * @param continueOnFailure if the execution must continue even in presence * of an issue * * @return informations about the failure */ public FailedToDeleteData deleteTree(CallContext context, String folderId, Boolean continueOnFailure) { debug("deleteTree " + folderId); validatePermission(folderId, context, Permission.DELETE); boolean cof = (continueOnFailure == null ? false : continueOnFailure.booleanValue()); // get the document or folder PersistentObject object = getObject(folderId); if (object == null) throw new CmisObjectNotFoundException(String.format("Object %s not found!", folderId)); FailedToDeleteDataImpl result = new FailedToDeleteDataImpl(); result.setIds(new ArrayList<String>()); try { if (object instanceof Folder) { Folder folder = (Folder) object; deleteFolder(folder, cof, result); } else { Document doc = (Document) object; DocumentHistory transaction = new DocumentHistory(); transaction.setUser(getSessionUser()); transaction.setEvent(FolderEvent.DELETED.toString()); transaction.setSessionId(sid); if (!documentDao.delete(doc.getId(), transaction)) throw new Exception("Unable to delete document"); } } catch (Throwable t) { log.error(t.getMessage(), t); throw new CmisStorageException("Deletion failed!"); } return result; }
Example #27
Source File: SampleClient.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
/** * Clean up test folder before executing test * * @param target * @param delFolderName */ private static void cleanup(Folder target, String delFolderName) { try { CmisObject object = session.getObjectByPath(target.getPath() + delFolderName); Folder delFolder = (Folder) object; delFolder.deleteTree(true, UnfileObject.DELETE, true); } catch (CmisObjectNotFoundException e) { System.err.println("No need to clean up."); } }
Example #28
Source File: SampleClient.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
/** * Delete test document * * @param target * @param delDocName */ private static void deleteDocument(Folder target, String delDocName) { try { CmisObject object = session.getObjectByPath(target.getPath() + delDocName); Document delDoc = (Document) object; delDoc.delete(true); } catch (CmisObjectNotFoundException e) { System.err.println("Document is not found: " + delDocName); } }
Example #29
Source File: CMISNodeInfoImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
public NodeRef getLatestVersionNodeRef(boolean major) { if (!major) { return getLatestNonMajorVersionNodeRef(); } VersionHistory versionHistory = getVersionHistory(); // if there is no history, return the current version if (versionHistory == null) { // there are no versions return getLatestNonMajorVersionNodeRef(); } // find the latest major version for (Version version : versionHistory.getAllVersions()) { if (version.getVersionType() == VersionType.MAJOR) { return version.getFrozenStateNodeRef(); } } throw new CmisObjectNotFoundException("There is no major version!"); }
Example #30
Source File: AlfrescoCmisServiceImpl.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
@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; }