当前位置: 首页>>代码示例>>Java>>正文


Java CmisRuntimeException类代码示例

本文整理汇总了Java中org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException的典型用法代码示例。如果您正苦于以下问题:Java CmisRuntimeException类的具体用法?Java CmisRuntimeException怎么用?Java CmisRuntimeException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CmisRuntimeException类属于org.apache.chemistry.opencmis.commons.exceptions包,在下文中一共展示了CmisRuntimeException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createPolicy

import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException; //导入依赖的package包/类
@Override
public String createPolicy(
        String repositoryId, Properties properties, String folderId, List<String> policies,
        Acl addAces, Acl removeAces, ExtensionsData extension)
{
    checkRepositoryId(repositoryId);

    // get the parent folder
    getOrCreateFolderInfo(folderId, "Parent Folder");

    String objectTypeId = connector.getObjectTypeIdProperty(properties);
    connector.getTypeForCreate(objectTypeId, BaseTypeId.CMIS_POLICY);

    // we should never get here - policies are not creatable!
    throw new CmisRuntimeException("Polcies cannot be created!");
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:17,代码来源:AlfrescoCmisServiceImpl.java

示例2: copy

import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static <T> T copy(T source)
{
    T target = null;
    try
    {
        CopyOutputStream cos = new CopyOutputStream();
        ObjectOutputStream out = new ObjectOutputStream(cos);
        out.writeObject(source);
        out.flush();
        out.close();

        ObjectInputStream in = new ObjectInputStream(cos.getInputStream());
        target = (T) in.readObject();
    } catch (Exception e)
    {
        throw new CmisRuntimeException("Object copy failed!", e);
    }

    return target;
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:22,代码来源:CMISUtils.java

示例3: skipBytes

import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException; //导入依赖的package包/类
private void skipBytes() {
    long remainingSkipBytes = offset;

    try {
        while (remainingSkipBytes > 0) {
            long skipped = super.skip(remainingSkipBytes);
            remainingSkipBytes -= skipped;

            if (skipped == 0) {
                // stream might not support skipping
                skipBytesByReading(remainingSkipBytes);
                break;
            }
        }
    } catch (IOException e) {
        throw new CmisRuntimeException("Skipping the stream failed!", e);
    }
}
 
开发者ID:cmisdocs,项目名称:ServerDevelopmentGuideV2,代码行数:19,代码来源:ContentRangeInputStream.java

示例4: checkout

import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException; //导入依赖的package包/类
/**
 * See CMIS 1.0 section 2.2.7.1 checkOut
 *
 * @throws CmisRuntimeException
 */
public RegistryPrivateWorkingCopy checkout() {
    Resource node = getNode();
    try {
        if (isCheckedOut(node)) {
            throw new CmisConstraintException("Document is already checked out " + node.getId());
        }

        return getPwc(checkout(getRepository(), node));
    }
    catch (RegistryException e) {
        String msg = "Failed checkout the node with path " + node.getPath();
        log.error(msg, e);
        throw new CmisRuntimeException(msg, e);
    }
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:21,代码来源:RegistryVersionBase.java

示例5: getVersion

import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException; //导入依赖的package包/类
/**
 * Get a specific version by name
 * @param name  name of the version to get
 * @return  a {@link RegistryVersion} instance for <code>name</code>
 * @throws CmisObjectNotFoundException  if a version <code>name</code> does not exist
 * @throws CmisRuntimeException
 */
public RegistryVersion getVersion(String name) {
    try {
        Resource node = getNode();
        String[] versions = getRepository().getVersions(node.getPath());
        if(versions == null){
            throw new CmisObjectNotFoundException("No versions exist");
        }
        String gotVersion = null;
        for (String version: versions){
        	if(version.equals(name)){
        		gotVersion = version;
        	}
        }
        if(gotVersion == null){
        	throw new CmisObjectNotFoundException("No version found");
        }
        return new RegistryVersion(getRepository(), node, gotVersion, typeManager, pathManager);
    }
    catch (RegistryException e) {
        String msg = "Unable to get the version for " + name;
        log.error(msg, e);
        throw new CmisRuntimeException(msg, e);
    }
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:32,代码来源:RegistryVersionBase.java

示例6: delete

import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException; //导入依赖的package包/类
/**
 * See CMIS 1.0 section 2.2.4.14 deleteObject
 *
 * @throws CmisRuntimeException
 */
@Override
public void delete(boolean allVersions, boolean isPwc) {
    try {
        if (getNode().getChildCount()>0) {
            throw new CmisConstraintException("Folder is not empty!");
        } else {
            super.delete(allVersions, isPwc);
        }
    }
    catch (RegistryException e) {
        String msg = "Failed to delete the object " + getNode().getPath();
        log.error(msg, e);
        throw new CmisRuntimeException(msg, e);
    }
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:21,代码来源:RegistryFolder.java

示例7: getRootNodeRef

import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:41,代码来源:CMISConnector.java

示例8: getFolderParent

import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException; //导入依赖的package包/类
@Override
public ObjectData getFolderParent(String repositoryId, String folderId, String filter, ExtensionsData extension)
{
    checkRepositoryId(repositoryId);

    // get the node ref
    CMISNodeInfo info = getOrCreateFolderInfo(folderId, "Folder");

    // the root folder has no parent
    if (info.isRootFolder())
    {
        throw new CmisInvalidArgumentException("Root folder has no parent!");
    }

    // get the parent
    List<CMISNodeInfo> parentInfos = info.getParents();
    if (parentInfos.isEmpty())
    {
        throw new CmisRuntimeException("Folder has no parent and is not the root folder?!");
    }

    CMISNodeInfo parentInfo = addNodeInfo(parentInfos.get(0));

    ObjectData result = connector.createCMISObject(
            parentInfo, filter, false, IncludeRelationships.NONE,
            CMISConnector.RENDITION_NONE, false, false);
	boolean isObjectInfoRequired = getContext().isObjectInfoRequired();
    if (isObjectInfoRequired)
    {
        getObjectInfo(
                repositoryId,
                parentInfo.getObjectId(),
                IncludeRelationships.NONE);
    }

    return result;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:38,代码来源:AlfrescoCmisServiceImpl.java

示例9: testGetRepositoryInfos

import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException; //导入依赖的package包/类
/**
 * ALF-20389 Test Alfresco cmis stream interceptor that checks content stream for mimetype. Only ContentStreamImpl extensions should take palace.
 */
@Test
public void testGetRepositoryInfos()
{
    boolean cmisEx = false;
    List<RepositoryInfo> infoDataList = null;
    try
    {
        infoDataList = withCmisService(new CmisServiceCallback<List<RepositoryInfo>>()
        {
            @Override
            public List<RepositoryInfo> execute(CmisService cmisService)
            {
                ExtensionDataImpl result = new ExtensionDataImpl();
                List<CmisExtensionElement> extensions = new ArrayList<CmisExtensionElement>();
                result.setExtensions(extensions);

                return cmisService.getRepositoryInfos(result);
            }
        });
    }
    catch (CmisRuntimeException e)
    {
        cmisEx = true;
    }

    assertNotNull(cmisEx ? "CmisRuntimeException was thrown. Please, take a look on ALF-20389" : "No CMIS repository information was retrieved", infoDataList);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:31,代码来源:CMISTest.java

示例10: getCmisTypeId

import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException; //导入依赖的package包/类
/**
 * Gets the CMIS Type Id given the Alfresco QName for the type in any
 * Alfresco model
 * 
 * @param scope BaseTypeId
 * @param typeQName QName
 * @return String
 */
public String getCmisTypeId(BaseTypeId scope, QName typeQName)
{
    String typeId = mapAlfrescoQNameToTypeId.get(typeQName);
    if (typeId == null)
    {
        String p = null;
        switch (scope)
        {
        case CMIS_DOCUMENT:
            p = "D";
            break;
        case CMIS_FOLDER:
            p = "F";
            break;
        case CMIS_RELATIONSHIP:
            p = "R";
            break;
        case CMIS_SECONDARY:
            p = "P";
            break;
        case CMIS_POLICY:
            p = "P";
            break;
        case CMIS_ITEM:
            p = "I";
            break;
        default:
            throw new CmisRuntimeException("Invalid base type!");
        }

        return p + ":" + typeQName.toPrefixString(namespaceService);
    } 
    else
    {
        return typeId;
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:46,代码来源:CMISMapping.java

示例11: getRepositoryInfos

import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException; //导入依赖的package包/类
@Override
public List<RepositoryInfo> getRepositoryInfos(ExtensionsData extension) {
	log.debug("getRepositoryInfos({})", extension);

	try {
		List<RepositoryInfo> infos = new ArrayList<RepositoryInfo>();
		infos.add(getRepository().getRepositoryInfo(getCallContext()));
		return infos;
	} catch (Exception e) {
		throw new CmisRuntimeException(e.getMessage(), e);
	}
}
 
开发者ID:openkm,项目名称:document-management-system,代码行数:13,代码来源:CmisServiceImpl.java

示例12: getId

import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException; //导入依赖的package包/类
/**
 * Returns the id of a File object or throws an appropriate exception.
 */
private String getId(File file) {
    try {
        return fileToId(file);
    } catch (Exception e) {
        throw new CmisRuntimeException(e.getMessage(), e);
    }
}
 
开发者ID:cmisdocs,项目名称:ServerDevelopmentGuideV2,代码行数:11,代码来源:FileBridgeRepository.java

示例13: skipBytesByReading

import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException; //导入依赖的package包/类
private void skipBytesByReading(long remainingSkipBytes) {
    try {
        final byte[] buffer = new byte[BUFFER_SIZE];
        while (remainingSkipBytes > 0) {
            long skipped = super.read(buffer, 0, (int) Math.min(buffer.length, remainingSkipBytes));
            if (skipped == -1) {
                break;
            }

            remainingSkipBytes -= skipped;
        }
    } catch (IOException e) {
        throw new CmisRuntimeException("Reading the stream failed!", e);
    }
}
 
开发者ID:cmisdocs,项目名称:ServerDevelopmentGuideV2,代码行数:16,代码来源:ContentRangeInputStream.java

示例14: getContentStream

import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException; //导入依赖的package包/类
public ContentStream getContentStream(){

    	// compile data
        ContentStreamImpl result = new ContentStreamImpl();
        result.setFileName(getName());
            
        try {
            result.setLength(BigInteger.valueOf(getPropertyLength(getNode(), CMISConstants.GREG_DATA)));
            if(getNode().getContent() != null){
                String mimeType = getNode().getProperty(CMISConstants.GREG_MIMETYPE);
                result.setMimeType(mimeType);
                //result.setMimeType(getNode().getMediaType());
            } else {
                result.setMimeType(null);
            }
            if(getNode().getContent() != null){

                InputStream inputStream = getNode().getContentStream();
                result.setStream(new BufferedInputStream(inputStream));  // stream closed by consumer
            } else {
                result.setStream(null);
            }
        } catch (RegistryException e) {
            throw new CmisRuntimeException(e.getMessage(), e);
        }

        return result;
    }
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:29,代码来源:RegistryDocument.java

示例15: checkin

import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException; //导入依赖的package包/类
/**
 * See CMIS 1.0 section 2.2.7.3 checkedIn
 *
 * @throws CmisRuntimeException
 */
public RegistryVersion checkin(Properties properties, ContentStream contentStream, String checkinComment) {
    Resource node = getNode();

    try {
        if (!isCheckedOut(node)) {
            throw new CmisStorageException("Not checked out: " + node.getId());
        }

        if (properties != null && !properties.getPropertyList().isEmpty()) {
            updateProperties(properties);
        }

        if (contentStream != null) {
            setContentStream(contentStream, true);
        }

        // todo handle checkinComment
        Resource resource = checkin();
        String pathOfLatestVersion = getRepository().getVersions(resource.getPath())[0];
        return new RegistryVersion(getRepository(), resource, pathOfLatestVersion, typeManager, pathManager);
    }
    catch (RegistryException e) {
        String msg = "Failed checkin";
        log.error(msg, e);
        throw new CmisRuntimeException(msg, e);
    }
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:33,代码来源:RegistryVersionBase.java


注:本文中的org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。