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


Java ObjectId类代码示例

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


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

示例1: createFolder

import org.apache.chemistry.opencmis.client.api.ObjectId; //导入依赖的package包/类
private ObjectId createFolder(Session session, ObjectId parentId, String folderName) {
	ObjectId mainFolderID = null;

	Map<String, Object> properties = new HashMap<String, Object>();
	properties.put(PropertyIds.OBJECT_TYPE_ID, BaseTypeId.CMIS_FOLDER.value());

	properties.put(PropertyIds.NAME, folderName);

	List<Ace> addAces = new LinkedList<Ace>();
	List<Ace> removeAces = new LinkedList<Ace>();
	List<Policy> policies = new LinkedList<Policy>();

	// create the folder if it doesn't exists
	mainFolderID = session.createFolder(properties, parentId, policies, addAces, removeAces);
	// session.save();

	return mainFolderID;
}
 
开发者ID:kuzavas,项目名称:ephesoft,代码行数:19,代码来源:CMISExporter.java

示例2: checkAndCreateParentFolder

import org.apache.chemistry.opencmis.client.api.ObjectId; //导入依赖的package包/类
/**
 * Checks the parent folder of the object that should be created. If the
 * folder doesn't exits, it creates the folder.
 */
private ObjectId checkAndCreateParentFolder(String[] path) {
	// check for the application root folder
	if (path.length < 2) {
		return session.getObjectByPath((applicationRoot.length() == 0 ? "/"
				: applicationRoot), IMPORT_OPERATION_CONTEXT);
	}

	// prepare parent path
	String[] parentPath = new String[path.length - 1];
	System.arraycopy(path, 0, parentPath, 0, parentPath.length);

	try {
		// if parent folder exits, return its object id
		return session.getObjectByPath(buildRepositoryPath(parentPath),
				IMPORT_OPERATION_CONTEXT);
	} catch (CmisObjectNotFoundException notFound) {
		// parent folder doesn't exit -> create it
		ObjectId parent = checkAndCreateParentFolder(parentPath);
		return createFolder(parent, parentPath[parentPath.length - 1]);
	}
}
 
开发者ID:fmui,项目名称:ApacheChemistryInAction,代码行数:26,代码来源:CMISImporter.java

示例3: createRelationship

import org.apache.chemistry.opencmis.client.api.ObjectId; //导入依赖的package包/类
public ObjectId createRelationship(String sourceObjectId, String targetObjectId)
{
    Map<String, Serializable> relProps = new HashMap<String, Serializable>();
    relProps.put("cmis:sourceId", sourceObjectId);
    relProps.put("cmis:targetId", targetObjectId);
    relProps.put("cmis:objectTypeId", "cmis:relationship");
    ObjectId res = session.createRelationship(relProps);
    return res;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:10,代码来源:PublicApiClient.java

示例4: checkoutObject

import org.apache.chemistry.opencmis.client.api.ObjectId; //导入依赖的package包/类
public ObjectId checkoutObject(String objectId)
{
    CmisObject o = getObject(objectId);
    if(o instanceof Document)
    {
        Document d = (Document)o;
        ObjectId res = d.checkOut();
        return res;
    }
    else
    {
        throw new IllegalArgumentException("Object does not exist or is not a document");
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:15,代码来源:PublicApiClient.java

示例5: createRelation

import org.apache.chemistry.opencmis.client.api.ObjectId; //导入依赖的package包/类
public static Relationship createRelation(Session pSession, String pStrRelationTypeId, String pStrSourceId, String pStrTargetId) {

		mLog.debug("Start createRelation(<Session>, " + pStrRelationTypeId + ", " + pStrSourceId + ", " + pStrTargetId + ")");
		
		Map<String, Serializable> lRelationProperties = new HashMap<String, Serializable>(); 
		lRelationProperties.put(PropertyIds.SOURCE_ID, pStrSourceId); 
		lRelationProperties.put(PropertyIds.TARGET_ID, pStrTargetId);
		lRelationProperties.put(PropertyIds.OBJECT_TYPE_ID, pStrRelationTypeId);
		ObjectId lRelationId = pSession.createRelationship(lRelationProperties);
		
		mLog.debug("End createRelation()");
		return (Relationship) pSession.getObject(lRelationId);
	}
 
开发者ID:MakeITBologna,项目名称:zefiro,代码行数:14,代码来源:AlfrescoHelper.java

示例6: createRelationship

import org.apache.chemistry.opencmis.client.api.ObjectId; //导入依赖的package包/类
public ObjectId createRelationship(String sourceObjectId, String targetObjectId)
{
	Map<String, Serializable> relProps = new HashMap<String, Serializable>(); 
	relProps.put("cmis:sourceId", sourceObjectId); 
	relProps.put("cmis:targetId", targetObjectId); 
	relProps.put("cmis:objectTypeId", "cmis:relationship"); 
	ObjectId res = session.createRelationship(relProps);
	return res;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:10,代码来源:PublicApiClient.java

示例7: checkoutObject

import org.apache.chemistry.opencmis.client.api.ObjectId; //导入依赖的package包/类
public ObjectId checkoutObject(String objectId)
{
	CmisObject o = getObject(objectId);
	if(o instanceof Document)
	{
		Document d = (Document)o;
		ObjectId res = d.checkOut();
		return res;
	}
	else
	{
		throw new IllegalArgumentException("Object does not exist or is not a document");
	}
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:15,代码来源:PublicApiClient.java

示例8: getInputStream

import org.apache.chemistry.opencmis.client.api.ObjectId; //导入依赖的package包/类
@Override
public InputStream getInputStream(String sObjectId) throws IOException {
    Session aSession = cmisService.startSession();
    ObjectId aObjectId = aSession.createObjectId(sObjectId);
    ContentStream aContentStream = aSession.getContentStream(aObjectId);
    return aContentStream.getStream();
}
 
开发者ID:acxio,项目名称:AGIA,代码行数:8,代码来源:CmisInputStreamFactory.java

示例9: createAlbum

import org.apache.chemistry.opencmis.client.api.ObjectId; //导入依赖的package包/类
protected ObjectId createAlbum(Session session,
		HttpServletRequest request) throws TheBlendException {
	String parentId = getStringParameter(request, PARAM_PARENT_ID);
	String parentPath = getStringParameter(request, PARAM_PARENT_PATH);
	String name = getStringParameter(request, PARAM_NAME);

	if (name == null || name.length() == 0) {
		name = "The Blend";
	}

	// fetch the parent folder
	Folder parent = null;
	if (parentId != null) {
		parent = CMISHelper.getFolder(session, parentId,
				CMISHelper.LIGHT_OPERATION_CONTEXT, "parent folder");
	} else if (parentPath != null) {
		parent = CMISHelper.getFolderByPath(session, parentPath,
				CMISHelper.LIGHT_OPERATION_CONTEXT, "parent folder");
	} else {
		parent = CMISHelper.getFolder(session,
				getApplicationRootFolderId(request),
				CMISHelper.LIGHT_OPERATION_CONTEXT, "parent folder");
	}

	// create a document without content
	Map<String, Object> properties = new HashMap<String, Object>();
	properties.put(PropertyIds.NAME, name);
	properties.put(PropertyIds.OBJECT_TYPE_ID,
			IdMapping.getRepositoryTypeId("cmisbook:album"));

	return session.createDocument(properties, parent, null, null);
}
 
开发者ID:fmui,项目名称:ApacheChemistryInAction,代码行数:33,代码来源:AlbumServlet.java

示例10: createApplicationRoot

import org.apache.chemistry.opencmis.client.api.ObjectId; //导入依赖的package包/类
/**
 * Creates the application root folder.
 */
private void createApplicationRoot() {
	String[] path = applicationRoot.split("/");

	if (path.length < 2) {
		return;
	}

	ObjectId parent = session.getRootFolder();

	StringBuilder sb = new StringBuilder();
	for (int i = 1; i < path.length; i++) {
		sb.append('/');
		sb.append(path[i]);

		try {
			parent = session.getObjectByPath(sb.toString(),
					IMPORT_OPERATION_CONTEXT);
		} catch (CmisObjectNotFoundException notFound) {
			Map<String, Object> properties = new HashMap<String, Object>();
			properties.put(PropertyIds.NAME, path[i]);
			properties.put(PropertyIds.OBJECT_TYPE_ID,
					BaseTypeId.CMIS_FOLDER.value());

			parent = session.createFolder(properties, parent);
		}
	}
}
 
开发者ID:fmui,项目名称:ApacheChemistryInAction,代码行数:31,代码来源:CMISImporter.java

示例11: createFolder

import org.apache.chemistry.opencmis.client.api.ObjectId; //导入依赖的package包/类
/**
 * Creates a folder.
 */
private ObjectId createFolder(ObjectId parent, String name) {
	// set up properties
	Map<String, Object> properties = new HashMap<String, Object>();
	properties.put(PropertyIds.NAME, name);
	properties.put(PropertyIds.OBJECT_TYPE_ID,
			BaseTypeId.CMIS_FOLDER.value());

	return session.createFolder(properties, parent);
}
 
开发者ID:fmui,项目名称:ApacheChemistryInAction,代码行数:13,代码来源:CMISImporter.java

示例12: run

import org.apache.chemistry.opencmis.client.api.ObjectId; //导入依赖的package包/类
@Override
        public void run()
        {
            Session session = getSession(""+id+id+id, ""+id+id+id);
            
            CmisObject object = session.getObjectByPath(path);
            
            Map<String, Object> baseProps = new HashMap<String, Object>();
            baseProps.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder");
            baseProps.put(PropertyIds.NAME, "Thread"+id);
            
            
            ObjectId base = session.createFolder(baseProps, object);

            for(int i = 0; i < 100; i++)
            {
                    
                Map<String, Object> properties = new HashMap<String, Object>();
                properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder");
                properties.put(PropertyIds.NAME, "Folder-"+i);
                
                ObjectId folder = session.createFolder(properties, base);
               
                System.out.println("Thread "+id +"   @Folder "+i);
                
                for(int j = 0; j < 1000; j++)
                {
                    Map<String, Object> folderProps = new HashMap<String, Object>();
                    folderProps.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder");
                    folderProps.put(PropertyIds.NAME, "Folder-"+i);
                    
                    ObjectId child = session.createFolder(folderProps, folder);
                    
                    
//                    Map<String, Object> docProps = new HashMap<String, Object>();
//                    docProps.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document");
//                    docProps.put(PropertyIds.NAME, "Doc-"+j);
//                    
//                    ContentStreamImpl contentSream = new ContentStreamImpl();
//                    contentSream.setFileName(GUID.generate());
//                    contentSream.setLength(BigInteger.valueOf(10));
//                    contentSream.setMimeType("text/plain");
//                    contentSream.setStream(new StringInputStream("abcdefghij"));
//                    
//                     ObjectId document = session.createDocument(docProps, folder, contentSream, VersioningState.MAJOR);
                    
                    if(j % 20 == 0)
                    {
                        System.out.println(id+"    @ "+j);
                    }
                }
            }
            
        }
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:55,代码来源:CMISDataCreatorTest.java

示例13: doPost

import org.apache.chemistry.opencmis.client.api.ObjectId; //导入依赖的package包/类
@Override
protected void doPost(HttpServletRequest request,
		HttpServletResponse response, Session session)
		throws ServletException, IOException, TheBlendException {

	String id = getRequiredStringParameter(request, PARAM_ID);
	String what = getRequiredStringParameter(request,
			PARAM_ARTWORK_WHAT);

	Document artwork = null;
	String artworkId = null;

	if (what.equalsIgnoreCase("id")) {
		artworkId = getStringParameter(request, PARAM_ARTWORK_ID);
		artwork = CMISHelper.getDocumet(session, artworkId,
				CMISHelper.FULL_OPERATION_CONTEXT, "document");
	} else if (what.equalsIgnoreCase("path")) {
		String artworkPath = getStringParameter(request,
				PARAM_ARTWORK_PATH);
		artwork = CMISHelper.getDocumetByPath(session, artworkPath,
				CMISHelper.FULL_OPERATION_CONTEXT, "document");
		artworkId = artwork.getId();
	} else if (what.equalsIgnoreCase("remove")) {
		artworkId = null;
	} else {
		throw new TheBlendException("What?", null);
	}

	// check artwork
	if (artwork != null) {
		String artworkMimeType = artwork.getContentStreamMimeType();

		if (artworkMimeType == null) {
			throw new TheBlendException("Artwork has no content!");
		}

		if (!artworkMimeType.toLowerCase().startsWith("image/")) {
			throw new TheBlendException("Artwork in not an image!");
		}
	}

	ObjectId newId = session.createObjectId(id);

	// fetch the document object
	Document doc = CMISHelper.getDocumet(session, id,
			CMISHelper.FULL_OPERATION_CONTEXT, "document");

	// update the artwork property
	Map<String, Object> properties = new HashMap<String, Object>();
	properties.put(
			IdMapping.getRepositoryPropertyId("cmisbook:artwork"),
			artworkId);

	try {
		CmisObject newObject = doc.updateProperties(properties);
		newId = newObject;
	} catch (CmisBaseException cbe) {
		throw new TheBlendException("Could not update artwork id!", cbe);
	}

	redirect(
			HTMLHelper.encodeUrlWithId(request, "show", newId.getId()),
			request, response);
}
 
开发者ID:fmui,项目名称:ApacheChemistryInAction,代码行数:65,代码来源:ArtworkServlet.java

示例14: doPost

import org.apache.chemistry.opencmis.client.api.ObjectId; //导入依赖的package包/类
@Override
protected void doPost(HttpServletRequest request,
		HttpServletResponse response, Session session)
		throws ServletException, IOException, TheBlendException {

	// find out what to do
	int action = getIntParameter(request, PARAM_ACTION, 0);
	if (action < 1 && action > 3) {
		throw new TheBlendException("Unknown action!");
	}

	ObjectId newId = null;

	if (action == 1) {
		// create new album
		newId = createAlbum(session, request);
	} else {
		// album update, get its id
		String id = getRequiredStringParameter(request, PARAM_ID);

		// fetch the album object
		Document album = CMISHelper.getDocumet(session, id,
				CMISHelper.FULL_OPERATION_CONTEXT, "album");

		// check if the object has the cmisbook:tracks property
		if (!album
				.getType()
				.getPropertyDefinitions()
				.containsKey(
						IdMapping.getRepositoryPropertyId("cmisbook:tracks"))) {
			error("Document has no cmisbook:tracks property!", null,
					request, response);
			return;
		}

		List<String> tracks = null;
		if (action == 2) {
			// update track list
			tracks = getTrackList(request);
		} else if (action == 3) {
			// add track to album
			List<String> orgTracks = album.getPropertyValue(IdMapping
					.getRepositoryPropertyId("cmisbook:tracks"));
			tracks = addTrack(session, request, orgTracks);
		}

		// update the track list
		Map<String, Object> properties = new HashMap<String, Object>();
		properties.put(
				IdMapping.getRepositoryPropertyId("cmisbook:tracks"),
				tracks);

		try {
			CmisObject newObject = album.updateProperties(properties);
			newId = newObject;
		} catch (CmisBaseException cbe) {
			throw new TheBlendException("Could not update track list!",
					cbe);
		}
	}

	// return to album page
	redirect(
			HTMLHelper.encodeUrlWithId(request, "album", newId.getId()),
			request, response);
}
 
开发者ID:fmui,项目名称:ApacheChemistryInAction,代码行数:67,代码来源:AlbumServlet.java

示例15: doPost

import org.apache.chemistry.opencmis.client.api.ObjectId; //导入依赖的package包/类
@Override
protected void doPost(HttpServletRequest request,
		HttpServletResponse response, Session session)
		throws ServletException, IOException, TheBlendException {

	String id = getRequiredStringParameter(request, PARAM_ID);

	String addTag = getStringParameter(request, PARAM_ADD_TAG);
	if (addTag != null) {
		addTag = addTag.trim();
		if (addTag.length() == 0) {
			addTag = null;
		}
	}

	String removeTag = getStringParameter(request, PARAM_REMOVE_TAG);
	if (removeTag != null) {
		removeTag = removeTag.trim();
		if (removeTag.length() == 0) {
			removeTag = null;
		}
	}

	ObjectId newId = session.createObjectId(id);

	if (addTag != null || removeTag != null) {

		// fetch the document object
		Document doc = CMISHelper.getDocumet(session, id,
				CMISHelper.FULL_OPERATION_CONTEXT, "document");

		// check if the type of the object defines the property
		// "cmisbook:tags"
		// if not, ignore the request
		if (doc
				.getType()
				.getPropertyDefinitions()
				.containsKey(
						IdMapping.getRepositoryPropertyId("cmisbook:tags"))) {

			List<String> oldTags = doc.getPropertyValue(IdMapping
					.getRepositoryPropertyId("cmisbook:tags"));

			List<String> newTags = new ArrayList<String>();

			if (oldTags != null) {
				newTags.addAll(oldTags);
			}

			if (removeTag != null) {
				newTags.remove(removeTag);
			}

			if (addTag != null) {
				newTags.add(addTag);
			}

			Map<String, Object> properties = new HashMap<String, Object>();
			properties.put(
					IdMapping.getRepositoryPropertyId("cmisbook:tags"),
					newTags);

			try {
				CmisObject newObject = doc.updateProperties(properties);
				newId = newObject;
			} catch (CmisBaseException cbe) {
				throw new TheBlendException("Could not update tags!", cbe);
			}
		}
	}

	redirect(
			HTMLHelper.encodeUrlWithId(request, "show", newId.getId()),
			request, response);
}
 
开发者ID:fmui,项目名称:ApacheChemistryInAction,代码行数:76,代码来源:ShowServlet.java


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