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


Java Folder类代码示例

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


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

示例1: getObjectParents

import org.apache.chemistry.opencmis.client.api.Folder; //导入依赖的package包/类
public List<Folder> getObjectParents(String objectId)
{
    CmisObject o = session.getObject(objectId);
    if(o instanceof FileableCmisObject)
    {
        FileableCmisObject f = (FileableCmisObject)o;

        OperationContextImpl ctx = new OperationContextImpl();
        List<Folder> res = f.getParents(ctx);
        return res;
    }
    else
    {
        throw new IllegalArgumentException("Object does not exist or is not a fileable cmis object");
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:17,代码来源:PublicApiClient.java

示例2: createFolder

import org.apache.chemistry.opencmis.client.api.Folder; //导入依赖的package包/类
/**
 * Creates a new folder with the given name under the given folder.
 * 
 * @param name
 *            the name of the folder.
 * @param rootFolder
 *            the root folder.
 * @return the created folder.
 */
public Folder createFolder(String name, Folder folder) {
	logger.debug(DEBUG_CREATING_NEW_FOLDER, name, folder.getName());

	Folder newFolder = null;

	Map<String, String> newFolderProps = new HashMap<String, String>();
	newFolderProps.put(PropertyIds.OBJECT_TYPE_ID, CMIS_FOLDER_TYPE);
	newFolderProps.put(PropertyIds.NAME, name);
	try {
		newFolder = folder.createFolder(newFolderProps);
	} catch (CmisNameConstraintViolationException e) {
		String errorMessage = MessageFormat.format(ERROR_FOLDER_ALREADY_EXISTS, name);
		logger.error(errorMessage);
		throw new IllegalArgumentException(errorMessage, e);
	}
	logger.debug(DEBUG_FOLDER_CREATED, name);

	return newFolder;
}
 
开发者ID:SAP,项目名称:cloud-ariba-partner-flow-extension-ext,代码行数:29,代码来源:EcmRepository.java

示例3: getDescendants

import org.apache.chemistry.opencmis.client.api.Folder; //导入依赖的package包/类
public FolderNode getDescendants(String folderId, int depth)
{
    Session session = getCMISSession();

    CmisObject o = session.getObject(folderId);
    if(o instanceof Folder)
    {
        Folder f = (Folder)o;

        OperationContextImpl ctx = new OperationContextImpl();
        List<Tree<FileableCmisObject>> res = f.getDescendants(depth, ctx);
        FolderNode ret = (FolderNode)CMISNode.createNode(f);
        for(Tree<FileableCmisObject> t : res)
        {
            addChildren(ret, t);
        }

        return ret;
    }
    else
    {
        throw new IllegalArgumentException("Folder does not exist or is not a folder");
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:25,代码来源:PublicApiClient.java

示例4: updateDescriptorFile

import org.apache.chemistry.opencmis.client.api.Folder; //导入依赖的package包/类
@Override
public void updateDescriptorFile(String tenantId, String uuid, CMISEvidenceFile cmisFile) {
	Session session = createSession();
	Folder multitenantRootFolder = (Folder) session.getObjectByPath("/" + tenantId);
	Folder uuidFolder = getUuidFolder(session, uuid, multitenantRootFolder, repoFolderNestingLevels, true);
	for (CmisObject cmisObject : uuidFolder.getChildren()) {
		if (cmisObject.getType().getId().equals(CMISEvidenceFile.PROPERTY_DOC_ID)) {
			Document doc = (Document) cmisObject;
			if (doc.getName().equals(cmisFile.getFileName())) {
				Map<String, String> newDocProps = new HashMap<String, String>();
				newDocProps.put(CMISEvidenceFile.PROPERTY_TRANSACTION_STATUS, cmisFile.getTransactionStatus());
				doc.updateProperties(newDocProps);
				// Recover mime type from stored content
				ContentStream contentStream = new ContentStreamImpl(cmisFile.getFileName(), null, doc.getContentStreamMimeType(), cmisFile.getInputStream());
				doc.setContentStream(contentStream, true);
			} else {
				log.warn("Found unexpected CMIS object type in descriptor folder: " + cmisObject.getName() + " - " + cmisObject.getType().getId() + 
						" (expected " + cmisFile.getFileName() + ")");
			}
		}
	}
	
}
 
开发者ID:keensoft,项目名称:icearchiva,代码行数:24,代码来源:AtomBindingCMISClientImpl.java

示例5: createDocument

import org.apache.chemistry.opencmis.client.api.Folder; //导入依赖的package包/类
/**
 * Creates a new document with the given name and content under the given
 * folder.
 * 
 * @param name
 *            the name of the document.
 * @param rootFolder
 *            the root folder.
 * @param content
 *            the content of the document.
 * @return the created document.
 */
public Document createDocument(Folder rootFolder, String fileName, InputStream inputStream) {
	logger.debug(DEBUG_CREATING_NEW_DOCUMENT, fileName, rootFolder);

	Document document = null;

	Map<String, Object> properties = new HashMap<String, Object>();
	properties.put(PropertyIds.OBJECT_TYPE_ID, CMIS_DOCUMENT_TYPE);
	properties.put(PropertyIds.NAME, fileName);
	ContentStream contentStream = cmisSession.getObjectFactory().createContentStream(fileName, -1,
			MIME_TYPE_TEXT_PLAIN_UTF_8, inputStream);
	try {
		document = rootFolder.createDocument(properties, contentStream, VersioningState.NONE);
	} catch (CmisNameConstraintViolationException e) {
		String errorMessage = MessageFormat.format(ERROR_FILE_ALREADY_EXISTS, fileName);
		logger.error(errorMessage);
		throw new CmisNameConstraintViolationException(errorMessage, e);
	}
	logger.debug(DEBUG_DOCUMENT_CREATED, fileName);

	return document;
}
 
开发者ID:SAP,项目名称:cloud-ariba-partner-flow-extension-ext,代码行数:34,代码来源:EcmRepository.java

示例6: createDocument

import org.apache.chemistry.opencmis.client.api.Folder; //导入依赖的package包/类
private static Document createDocument(Folder target, String newDocName, Session session)
{
    Map<String, String> props = new HashMap<String, String>();
    props.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document");
    props.put(PropertyIds.NAME, newDocName);
    String content = "aegif Mind Share Leader Generating New Paradigms by aegif corporation.";
    byte[] buf = null;
    try
    {
        buf = content.getBytes("ISO-8859-1"); // set the encoding here for the content stream
    }
    catch (UnsupportedEncodingException e)
    {
        e.printStackTrace();
    }

    ByteArrayInputStream input = new ByteArrayInputStream(buf);

    ContentStream contentStream = session.getObjectFactory().createContentStream(newDocName, buf.length,
            "text/plain; charset=UTF-8", input); // additionally set the charset here
    // NOTE that we intentionally specified the wrong charset here (as UTF-8)
    // because Alfresco does automatic charset detection, so we will ignore this explicit request
    return target.createDocument(props, contentStream, VersioningState.MAJOR);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:25,代码来源:OpenCmisLocalTest.java

示例7: directoryExistCMIS

import org.apache.chemistry.opencmis.client.api.Folder; //导入依赖的package包/类
/** Verifie qu'un dossier existe en mode CMIS
 * @param idFolder
 * @return
 */
private Boolean directoryExistCMIS(String idFolder, Session cmisSession) {
	if (idFolder == null || idFolder.equals("")) {
		return false;
	}
	try{
		CmisObject object = cmisSession.getObject(cmisSession.createObjectId(idFolder));
		if (!(object instanceof Folder)){
			logger.error("Stockage de fichier - CMIS : l'object CMIS "+idFolder+" n'est pas un dossier");
			return false;
		}
	}catch(Exception e){
		logger.error("Stockage de fichier - CMIS : erreur sur l'object CMIS "+idFolder, e);
		return false;
	}
	return true;
}
 
开发者ID:EsupPortail,项目名称:esup-ecandidat,代码行数:21,代码来源:FileManagerCmisImpl.java

示例8: deleteCampagneFolder

import org.apache.chemistry.opencmis.client.api.Folder; //导入依赖的package包/类
@Override
public Boolean deleteCampagneFolder(String codCampagne){
	logger.debug("Suppression du dossier de campagne : "+codCampagne);
	Session session = getCmisSession();		
	try{
		/*Dossier de base pour les candidats*/
		Folder master = getFolderCandidat();
		/*Le dossier de la campagne*/
		Folder folderCampagne = FileUtils.getFolder(master.getPath()+"/"+codCampagne, session);
		logger.debug("Suppression du dossier de campagne, path="+folderCampagne.getPath()+", id="+folderCampagne.getId());
		List<String> liste = folderCampagne.deleteTree(true, UnfileObject.DELETE, true);
		if (liste !=null && liste.size()>0){
			return false;
		}
		return true;
	}catch(Exception e){
		logger.error("Impossible de supprimer le dossier de campagne : "+codCampagne+", vous devez le supprimer à la main",e);
		return false;
	}
}
 
开发者ID:EsupPortail,项目名称:esup-ecandidat,代码行数:21,代码来源:FileManagerCmisImpl.java

示例9: getFolderTree

import org.apache.chemistry.opencmis.client.api.Folder; //导入依赖的package包/类
public List<Tree<FileableCmisObject>> getFolderTree(String folderId, int depth)
{
    CmisObject o = session.getObject(folderId);
    if(o instanceof Folder)
    {
        Folder f = (Folder)o;

        OperationContextImpl ctx = new OperationContextImpl();
        List<Tree<FileableCmisObject>> res = f.getFolderTree(depth, ctx);
        return res;
    }
    else
    {
        throw new IllegalArgumentException("Object does not exist or is not a folder");
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:17,代码来源:PublicApiClient.java

示例10: renameFolder

import org.apache.chemistry.opencmis.client.api.Folder; //导入依赖的package包/类
public static void renameFolder(Session pSession, String pStrNodeRef, String pStrNewName) {
	mLog.debug("ENTER renameFolder(<Session>, " + pStrNodeRef + ", " + pStrNewName + ")");

	Folder lFolder = (Folder) pSession.getObject(pStrNodeRef);

	Map<String, String> lMapProperties = new HashMap<String, String>();
	lMapProperties.put(PropertyIds.NAME, pStrNewName);

	try {
		lFolder.updateProperties(lMapProperties, true);
	} catch (CmisContentAlreadyExistsException e) {
		mLog.error("Impossibile aggiornare le proprietà del documento", e);
		throw new AlfrescoException(e, AlfrescoException.FOLDER_ALREADY_EXISTS_EXCEPTION);
	}

	mLog.debug("EXIT renameFolder(<Session>, " + pStrNodeRef + ", " + pStrNewName + ")");
}
 
开发者ID:MakeITBologna,项目名称:zefiro,代码行数:18,代码来源:AlfrescoHelper.java

示例11: createNode

import org.apache.chemistry.opencmis.client.api.Folder; //导入依赖的package包/类
private CmisObject createNode(Exchange exchange) throws Exception {
    validateRequiredHeader(exchange, PropertyIds.NAME);

    Message message = exchange.getIn();
    String parentFolderPath = parentFolderPathFor(message);
    Folder parentFolder = getFolderOnPath(exchange, parentFolderPath);
    Map<String, Object> cmisProperties = filterTypeProperties(message.getHeaders());

    if (isDocument(exchange)) {
        String fileName = message.getHeader(PropertyIds.NAME, String.class);
        String mimeType = getMimeType(message);
        byte[] buf = getBodyData(message);
        ContentStream contentStream = getSessionFacade().createContentStream(fileName, buf, mimeType);
        return storeDocument(parentFolder, cmisProperties, contentStream);
    } else if (isFolder(message)) {
        return storeFolder(parentFolder, cmisProperties);
    } else { // other types
        return storeDocument(parentFolder, cmisProperties, null);
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:21,代码来源:CMISProducer.java

示例12: deleteAllContent

import org.apache.chemistry.opencmis.client.api.Folder; //导入依赖的package包/类
protected void deleteAllContent() {
    Session session = createSession();
    Folder rootFolder = session.getRootFolder();
    ItemIterable<CmisObject> children = rootFolder.getChildren();
    for (CmisObject cmisObject : children) {
        if ("cmis:folder".equals(cmisObject.getPropertyValue(PropertyIds.OBJECT_TYPE_ID))) {
            List<String> notDeltedIdList = ((Folder)cmisObject)
                    .deleteTree(true, UnfileObject.DELETE, true);
            if (notDeltedIdList != null && notDeltedIdList.size() > 0) {
                throw new RuntimeException("Cannot empty repo");
            }
        } else {
            cmisObject.delete(true);
        }
    }
    session.getBinding().close();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:18,代码来源:CMISTestSupport.java

示例13: createDocumentAtSpecificPath

import org.apache.chemistry.opencmis.client.api.Folder; //导入依赖的package包/类
@Test
public void createDocumentAtSpecificPath() throws Exception {
    Folder folder1 = createFolderWithName("Folder1");
    createChildFolderWithName(folder1, "Folder2");
    String existingFolderStructure = "/Folder1/Folder2";

    Exchange exchange = createExchangeWithInBody("Some content to be stored");
    exchange.getIn().getHeaders().put(PropertyIds.CONTENT_STREAM_MIME_TYPE, "text/plain; charset=UTF-8");
    exchange.getIn().getHeaders().put(PropertyIds.NAME, "test.file");
    exchange.getIn().getHeaders().put(CamelCMISConstants.CMIS_FOLDER_PATH, existingFolderStructure);

    template.send(exchange);
    String newNodeId = exchange.getOut().getBody(String.class);

    Document document = (Document) retrieveCMISObjectByIdFromServer(newNodeId);
    String documentFullPath = document.getPaths().get(0);
    assertEquals(existingFolderStructure + "/test.file", documentFullPath);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:19,代码来源:CMISProducerTest.java

示例14: getTargetFolder

import org.apache.chemistry.opencmis.client.api.Folder; //导入依赖的package包/类
private CmisObject getTargetFolder(final Session session, final BatchClassCmisConfiguration batchClassCmisConfiguration) {
	CmisObject targetFolder = null;
	LOGGER.info("Acquiring Root Folder.");
	final Folder root = session.getRootFolder();
	final ItemIterable<CmisObject> children = root.getChildren();
	LOGGER.info("Looping through Root Folder children.");
	for (final CmisObject cmisObject : children) {
		if (cmisObject != null && cmisObject.getName() != null
				&& cmisObject.getName().equalsIgnoreCase(batchClassCmisConfiguration.getFolderName())
				&& isObjectFolder(cmisObject)) {
			LOGGER.info("Verified that the target is of type cmis:folder.");
			LOGGER.info("Target folder, " + batchClassCmisConfiguration.getFolderName() + ", found.");
			targetFolder = cmisObject;
			break;
		}
	}
	return targetFolder;
}
 
开发者ID:kuzavas,项目名称:ephesoft,代码行数:19,代码来源:CmisImport.java

示例15: createFolder

import org.apache.chemistry.opencmis.client.api.Folder; //导入依赖的package包/类
private Folder createFolder(String path) throws Exception {
    String[] subFolderNames = path.split("/");
    Folder folder = getCmisSession().getRootFolder();
    for (String subfolder : subFolderNames){
        String folderPath = folder.getPath();
        if (folder.getPath().equals("/")){
            folderPath = "";
        }
        try{
            folder = FileUtils.getFolder(folderPath + "/" + subfolder, getCmisSession());
            logger.debug("Parent folder already exists, new folder value is: " + folder.getPath());
        }
        catch (CmisObjectNotFoundException e){
            // The folder does not existe, we create it here
            folder = FileUtils.createFolder(folder, subfolder, null);
            logger.debug("New folder created, new folder value is: " + folder.getPath());
        }
    }
    return folder;
}
 
开发者ID:Appverse,项目名称:appverse-server,代码行数:21,代码来源:CMISSimpleNonVersionedDocumentService.java


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