• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java CmisBaseException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: openSession

import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException; //导入依赖的package包/类
@Override
@PostConstruct
public void openSession() {
    Map<String, String> parameter = new HashMap<>();

    String alfrescoCmisUrl = alfrescoServerProtocol + "://" + alfrescoServerUrl +cmisEntryPoint;
    parameter.put(SessionParameter.BROWSER_URL, alfrescoCmisUrl);
    parameter.put(SessionParameter.BINDING_TYPE, BindingType.BROWSER.value());
    parameter.put(SessionParameter.USER,username);
    parameter.put(SessionParameter.PASSWORD,password);

    try {
        SessionFactory factory = SessionFactoryImpl.newInstance();
        session = factory.getRepositories(parameter).get(0).createSession();
    }
    catch (CmisBaseException ex) {
        logger.debug("Exception"+ ex.getMessage());
        throw new ConnectionException();
    }
}
 
开发者ID:david-ciamberlano,项目名称:website-inventor,代码行数:21,代码来源:AlfrescoRemoteConnection.java


示例2: getTracks

import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException; //导入依赖的package包/类
/**
 * Returns tracks of an album.
 * 
 * @param session
 *          OpenCMIS session
 * @param albumObject
 *          the album object
 * @return a list of track documents, or an empty list if the object
 *         is not an album or the album has no tracks
 */
public static List<Document> getTracks(Session session,
		CmisObject albumObject) {
	List<Document> tracks = new ArrayList<Document>();

	@SuppressWarnings("unchecked")
	List<String> trackIds = (List<String>) albumObject
			.getPropertyValue(IdMapping
					.getRepositoryPropertyId("cmisbook:tracks"));

	if (trackIds != null) {
		for (String trackId : trackIds) {
			try {
				CmisObject track = session.getObject(trackId,
						CMISHelper.FULL_OPERATION_CONTEXT);
				if (track instanceof Document) {
					tracks.add((Document) track);
				}
			} catch (CmisBaseException cbe) {
				// ignore
			}
		}
	}

	return tracks;
}
 
开发者ID:fmui,项目名称:ApacheChemistryInAction,代码行数:36,代码来源:TheBlendHelper.java


示例3: getCmisObjectByPath

import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException; //导入依赖的package包/类
public static CmisObject getCmisObjectByPath(final Session session,
		final String path, final OperationContext context,
		final String what) throws TheBlendException {
	if (session == null) {
		throw new IllegalArgumentException("Session must be set!");
	}

	if (path == null || !path.startsWith("/")) {
		throw new TheBlendException("Invalid path to " + what + "!");
	}

	OperationContext oc = context;
	if (oc == null) {
		oc = session.getDefaultContext();
	}

	try {
		return session.getObjectByPath(path, oc);
	} catch (CmisObjectNotFoundException onfe) {
		throw new TheBlendException("The " + what + " does not exist!",
				onfe);
	} catch (CmisBaseException cbe) {
		throw new TheBlendException("Could not retrieve the " + what
				+ ":" + cbe.getMessage(), cbe);
	}
}
 
开发者ID:fmui,项目名称:ApacheChemistryInAction,代码行数:27,代码来源:CMISHelper.java


示例4: bulkUpdateProperties

import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException; //导入依赖的package包/类
/**
 * CMIS bulkUpdateProperties.
 */
public List<BulkUpdateObjectIdAndChangeToken> bulkUpdateProperties(CallContext context,
        List<BulkUpdateObjectIdAndChangeToken> objectIdAndChangeToken, Properties properties,
        ObjectInfoHandler objectInfos) {
    checkUser(context, true);

    if (objectIdAndChangeToken == null) {
        throw new CmisInvalidArgumentException("No object ids provided!");
    }

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

    for (BulkUpdateObjectIdAndChangeToken oid : objectIdAndChangeToken) {
        if (oid == null) {
            // ignore invalid ids
            continue;
        }
        try {
            Holder<String> oidHolder = new Holder<String>(oid.getId());
            updateProperties(context, oidHolder, properties, objectInfos);

            result.add(new BulkUpdateObjectIdAndChangeTokenImpl(oid.getId(), oidHolder.getValue(), null));
        } catch (CmisBaseException e) {
            // ignore exceptions - see specification
        }
    }

    return result;
}
 
开发者ID:cmisdocs,项目名称:ServerDevelopmentGuideV2,代码行数:32,代码来源:FileBridgeRepository.java


示例5: handleCmisBaseError

import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException; //导入依赖的package包/类
@ExceptionHandler(CmisBaseException.class)
public ModelAndView handleCmisBaseError(HttpServletRequest req, CmisObjectNotFoundException exc) {
    ModelAndView mav = new ModelAndView();
    mav.addObject("Invalid Page", exc.getMessage());
    mav.addObject("exception", exc);
    mav.addObject("utl",req.getRequestURL());
    mav.setViewName("error");

    return mav;
}
 
开发者ID:david-ciamberlano,项目名称:website-inventor,代码行数:11,代码来源:MainController.java


示例6: getSession

import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException; //导入依赖的package包/类
public Session getSession() {

        if (session == null) {

            try {
                openSession();
            }
            catch (CmisBaseException e) {
                return null;
            }
        }

        return session;
    }
 
开发者ID:david-ciamberlano,项目名称:website-inventor,代码行数:15,代码来源:AlfrescoRemoteConnection.java


示例7: bulkUpdateProperties

import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException; //导入依赖的package包/类
/**
 * CMIS bulkUpdateProperties.
 */
public List<BulkUpdateObjectIdAndChangeToken> bulkUpdateProperties(
		CallContext context,
		List<BulkUpdateObjectIdAndChangeToken> objectIdAndChangeToken,
		Properties properties, ObjectInfoHandler objectInfos) {
	checkUser(context, true);

	if (objectIdAndChangeToken == null) {
		throw new CmisInvalidArgumentException("No object ids provided!");
	}

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

	for (BulkUpdateObjectIdAndChangeToken oid : objectIdAndChangeToken) {
		if (oid == null) {
			// ignore invalid ids
			continue;
		}
		try {
			Holder<String> oidHolder = new Holder<String>(oid.getId());
			updateProperties(context, oidHolder, properties, objectInfos);

			result.add(new BulkUpdateObjectIdAndChangeTokenImpl(
					oid.getId(), oidHolder.getValue(), null));
		} catch (CmisBaseException e) {
			// ignore exceptions - see specification
		}
	}

	return result;
}
 
开发者ID:cmisdocs,项目名称:ServerDevelopmentGuide,代码行数:34,代码来源:FileBridgeRepository.java


示例8: doPost

import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException; //导入依赖的package包/类
/**
 * Creates a folder.
 */
protected void doPost(HttpServletRequest request,
		HttpServletResponse response, Session session)
		throws ServletException, IOException, TheBlendException {

	String parentId = getRequiredStringParameter(request, PARAM_PARENT);
	String typeId = getRequiredStringParameter(request, PARAM_TYPE_ID);
	String name = getStringParameter(request, PARAM_NAME);

	if (name == null || name.length() == 0) {
		redirect(HTMLHelper.encodeUrlWithId(request, "browse", parentId),
				request, response);
		return;
	}

	// fetch the parent folder
	Folder parent = CMISHelper.getFolder(session, parentId,
			CMISHelper.LIGHT_OPERATION_CONTEXT, "parent folder");

	// set name and type of the new folder
	Map<String, Object> properties = new HashMap<String, Object>();
	properties.put(PropertyIds.NAME, name);
	properties.put(PropertyIds.OBJECT_TYPE_ID, typeId);

	// create the folder
	try {
		parent.createFolder(properties);
	} catch (CmisBaseException cbe) {
		throw new TheBlendException("Could not create folder: "
				+ cbe.getMessage(), cbe);
	}

	redirect(HTMLHelper.encodeUrlWithId(request, "browse", parentId),
			request, response);
}
 
开发者ID:fmui,项目名称:ApacheChemistryInAction,代码行数:38,代码来源:BrowseServlet.java


示例9: getCmisObject

import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException; //导入依赖的package包/类
/**
 * Gets a CMIS object from the repository.
 * 
 * @param session
 *          the OpenCMIS session
 * @param id
 *          the id of the object
 * @param context
 *          the Operation Context
 * @param what
 *          string that describes the object, used for error
 *          messages
 * @return the CMIS object
 * @throws TheBlendException
 */
public static CmisObject getCmisObject(final Session session,
		final String id, final OperationContext context,
		final String what) throws TheBlendException {
	if (session == null) {
		throw new IllegalArgumentException("Session must be set!");
	}

	if (id == null || id.length() == 0) {
		throw new TheBlendException("Invalid id for " + what + "!");
	}

	OperationContext oc = context;
	if (oc == null) {
		oc = session.getDefaultContext();
	}

	try {
		return session.getObject(id, oc);
	} catch (CmisObjectNotFoundException onfe) {
		throw new TheBlendException("The " + what + " does not exist!",
				onfe);
	} catch (CmisBaseException cbe) {
		throw new TheBlendException("Could not retrieve the " + what
				+ ":" + cbe.getMessage(), cbe);
	}
}
 
开发者ID:fmui,项目名称:ApacheChemistryInAction,代码行数:42,代码来源:CMISHelper.java


示例10: invoke

import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException; //导入依赖的package包/类
public Object invoke(MethodInvocation mi) throws Throwable
{
    try
    {
        return mi.proceed();
    }
    catch (Exception e)
    {
        // We dig into the exception to see if there is anything of interest to CMIS
        Throwable cmisAffecting = ExceptionStackUtil.getCause(e, EXCEPTIONS_OF_INTEREST);
        
        if (cmisAffecting == null)
        {
            // The exception is not something that CMIS needs to handle in any special way
            if (e instanceof CmisBaseException)
            {
                throw (CmisBaseException) e;
            }
            else
            {
                throw new CmisRuntimeException(e.getMessage(), e);
            }
        }
        // All other exceptions are carried through with full stacks but treated as the exception of interest
        else if (cmisAffecting instanceof AuthenticationException)
        {
            throw new CmisPermissionDeniedException(cmisAffecting.getMessage(), e);
        }
        else if (cmisAffecting instanceof CheckOutCheckInServiceException)
        {
            throw new CmisVersioningException("Check out failed: " + cmisAffecting.getMessage(), e);
        }
        else if (cmisAffecting instanceof FileExistsException)
        {
            throw new CmisContentAlreadyExistsException("An object with this name already exists: " + cmisAffecting.getMessage(), e);
        }
        else if (cmisAffecting instanceof IntegrityException)
        {
            throw new CmisConstraintException("Constraint violation: " + cmisAffecting.getMessage(), e);
        }
        else if (cmisAffecting instanceof AccessDeniedException)
        {
            throw new CmisPermissionDeniedException("Permission denied: " + cmisAffecting.getMessage(), e);
        }
        else if (cmisAffecting instanceof NodeLockedException)
        {
            throw new CmisUpdateConflictException("Update conflict: " + cmisAffecting.getMessage(), e);
        }
        else
        {
            // We should not get here, so log an error but rethrow to have CMIS handle the original cause
            logger.error("Exception type not handled correctly: " + e.getClass().getName());
            throw new CmisRuntimeException(e.getMessage(), e);
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:57,代码来源:AlfrescoCmisExceptionInterceptor.java


示例11: doPost

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

	String id = getRequiredStringParameter(request, PARAM_ID);
	boolean allVersions = getBooleanParameter(request,
			PARAM_ALL_VERSIONS, false);
	String parentId = null;

	// fetch and delete the object
	try {
		CmisObject cmisObject = CMISHelper.getCmisObject(session, id,
				CMISHelper.LIGHT_OPERATION_CONTEXT, "object");

		// get the (first) parent folder, if one exists
		// we want to redirect to the parents browse page later
		if (cmisObject instanceof FileableCmisObject) {
			List<Folder> parents = ((FileableCmisObject) cmisObject)
					.getParents();
			if (parents.size() > 0) {
				parentId = parents.get(0).getId();
			}
		}

		if (cmisObject instanceof Folder) {
			List<String> failedToDelete = ((Folder) cmisObject)
					.deleteTree(true, UnfileObject.DELETE, true);

			if (failedToDelete != null && !failedToDelete.isEmpty()) {
				throw new TheBlendException("Deletion failed!");
			}
		} else {
			cmisObject.delete(allVersions);
		}
	} catch (CmisBaseException cbe) {
		throw new TheBlendException("Deletion failed: "
				+ cbe.getMessage(), cbe);
	}

	if (parentId == null) {
		// show dashbord page
		redirect("dashboard", request, response);
	} else {
		// show browse page
		redirect(
				HTMLHelper.encodeUrlWithId(request, "browse", parentId),
				request, response);
	}
}
 
开发者ID:fmui,项目名称:ApacheChemistryInAction,代码行数:51,代码来源:DeleteServlet.java


示例12: doPost

import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException; //导入依赖的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


示例13: doPost

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

	String id = getRequiredStringParameter(request, PARAM_ID);
	String newname = getRequiredStringParameter(request, PARAM_NEWNAME);
	String parentId = null;

	// fetch the object
	CmisObject cmisObject = CMISHelper.getCmisObject(session, id,
			CMISHelper.LIGHT_OPERATION_CONTEXT, "object");

	// get the (first) parent folder, if one exists
	// we want to redirect to the parents browse page later
	if (cmisObject instanceof FileableCmisObject) {
		List<Folder> parents = ((FileableCmisObject) cmisObject)
				.getParents();
		if (parents.size() > 0) {
			parentId = parents.get(0).getId();
		}
	}

	// rename the object
	try {
		// update the cmis:name property
		Map<String, Object> properties = new HashMap<String, Object>();
		properties.put(PropertyIds.NAME, newname);

		cmisObject.updateProperties(properties);

	} catch (CmisObjectNotFoundException onfe) {
		throw new TheBlendException("Object doesn't exist!", onfe);
	} catch (CmisNameConstraintViolationException ncve) {
		throw new TheBlendException("The new name is invalid or "
				+ "an object with this name "
				+ "already exists in this folder!", ncve);
	} catch (CmisBaseException cbe) {
		throw new TheBlendException("Rename failed: " + cbe.getMessage(),
				cbe);
	}

	if (parentId == null) {
		// show dashbord page
		redirect("dashboard", request, response);
	} else {
		// show browse page
		redirect(HTMLHelper.encodeUrlWithId(request, "browse", parentId),
				request, response);
	}
}
 
开发者ID:fmui,项目名称:ApacheChemistryInAction,代码行数:52,代码来源:RenameServlet.java


示例14: doPost

import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException; //导入依赖的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: doGet

import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException; //导入依赖的package包/类
protected void doGet(HttpServletRequest request,
		HttpServletResponse response, Session session)
		throws ServletException, IOException, TheBlendException {

	String id = getRequiredStringParameter(request, PARAM_ID);

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

	// refresh
	try {
		// refresh only if the document hasn't been fetched or
		// refreshed within the last minute
		doc.refreshIfOld(60 * 1000);
	} catch (CmisObjectNotFoundException onfe) {
		throw new TheBlendException("Document doesn't exist anymore!",
				onfe);
	} catch (CmisBaseException cbe) {
		throw new TheBlendException("Could not retrieve the document!",
				cbe);
	}

	request.setAttribute(ATTR_DOCUMENT, doc);

	// check if the object is versionable
	request.setAttribute(ATTR_VERSIONS, null);
	DocumentType doctype = (DocumentType) doc.getType();
	if (doctype.isVersionable() == null) {
		// the repository did not indicate if this document type
		// supports
		// versioning -> not spec compliant
		// we assume it is not versionable
	} else if (doctype.isVersionable().booleanValue()) {
		List<Document> versions = doc
				.getAllVersions(CMISHelper.VERSION_OPERATION_CONTEXT);
		request.setAttribute(ATTR_VERSIONS, versions);
	}

	// get the if of the artwork document, if it exists
	String artworkId = TheBlendHelper.getArtworkId(session, doc);
	request.setAttribute(ATTR_ARTWORK, artworkId);

	// if this is an album, get the tracks
	if (doc
			.getType()
			.getPropertyDefinitions()
			.containsKey(
					IdMapping.getRepositoryPropertyId("cmisbook:tracks"))) {
		List<Document> tracks = TheBlendHelper.getTracks(session, doc);
		request.setAttribute(ATTR_TRACKS, tracks);
	}

	// show browse page
	dispatch("show.jsp", doc.getName() + " .The Blend.", request,
			response);
}
 
开发者ID:fmui,项目名称:ApacheChemistryInAction,代码行数:58,代码来源:ShowServlet.java


示例16: doPost

import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException; //导入依赖的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


示例17: doGet

import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException; //导入依赖的package包/类
/**
 * Show folder content.
 */
protected void doGet(HttpServletRequest request,
		HttpServletResponse response, Session session)
		throws ServletException, IOException, TheBlendException {

	String id = getStringParameter(request, PARAM_ID);
	String path = getStringParameter(request, PARAM_PATH);
	int skip = getIntParameter(request, PARAM_SKIP, 0);

	request.setAttribute(ATTR_SKIP, skip);

	Folder folder = null;

	if (id != null) {
		folder = CMISHelper.getFolder(session, id,
				CMISHelper.LIGHT_OPERATION_CONTEXT, "folder");
	} else if (path != null) {
		folder = CMISHelper.getFolderByPath(session, path,
				CMISHelper.LIGHT_OPERATION_CONTEXT, "folder");
	} else {
		folder = CMISHelper.getFolder(session,
				getApplicationRootFolderId(request),
				CMISHelper.LIGHT_OPERATION_CONTEXT, "folder");
	}

	request.setAttribute(ATTR_FOLDER, folder);

	// get the folder children
	// note: this creates only ItemIterable objects and does not
	// contact the repository
	ItemIterable<CmisObject> children = folder
			.getChildren(CMISHelper.BROWSE_OPERATION_CONTEXT);

	// get only a page
	ItemIterable<CmisObject> childrenPage = children.skipTo(
			skip * BROWSE_PAGE_SIZE).getPage(BROWSE_PAGE_SIZE);

	// fetch the children from the repository
	List<CmisObject> page = new ArrayList<CmisObject>();
	try {
		for (CmisObject child : childrenPage) {
			page.add(child);
		}
	} catch (CmisBaseException cbe) {
		throw new TheBlendException("Could not retrieve the children of '"
				+ folder.getName() + "'!", cbe);
	}

	request.setAttribute(ATTR_PAGE, page);

	// get the total number of children in this folder
	// note: if the repository doesn't know the total number, this
	// method returns -1
	request.setAttribute(ATTR_TOTAL, childrenPage.getTotalNumItems());

	// check if there is at least one more pages
	request.setAttribute(ATTR_HAS_MORE, childrenPage.getHasMoreItems());

	// get parent folder
	Folder parent = null;
	if (!folder.isRootFolder()) {
		parent = folder.getParents(CMISHelper.BROWSE_OPERATION_CONTEXT)
				.get(0);
	}

	request.setAttribute(ATTR_PARENT, parent);

	// add creatable types
	request.setAttribute(ATTR_DOC_TYPES,
			getCreatableDocumentTypes(request, response));
	request.setAttribute(ATTR_FOLDER_TYPES,
			getCreatableFolderTypes(request, response));

	// show browse page
	dispatch("browse.jsp", folder.getName() + ". The Blend.", request,
			response);
}
 
开发者ID:fmui,项目名称:ApacheChemistryInAction,代码行数:80,代码来源:BrowseServlet.java


示例18: getArtworkId

import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException; //导入依赖的package包/类
/**
 * Returns the id of the artwork document of a given document.
 * 
 * A non-null value is returned only if
 * <ul>
 * <li>the document has an cmisbook:artwork property</li>
 * <li>this property is set</li>
 * <li>the property value points to an existing document</li>
 * <li>this document has content and its MIME type starts with
 * "image/"</li>
 * </ul>
 * 
 * @param session
 *          OpenCMIS session
 * @param cmisObject
 *          the object
 * @return the id of artwork document or <code>null</code> if no
 *         artwork is set or it is invalid
 */
public static String getArtworkId(Session session,
		CmisObject cmisObject) {
	ObjectType type = cmisObject.getType();

	if (!type.getPropertyDefinitions().containsKey(
			IdMapping.getRepositoryPropertyId("cmisbook:artwork"))) {
		return null;
	}

	String artworkId = cmisObject.getPropertyValue(IdMapping
			.getRepositoryPropertyId("cmisbook:artwork"));
	if (artworkId == null) {
		return null;
	}

	CmisObject artworkObject = null;
	try {
		artworkObject = session.getObject(artworkId,
				CMISHelper.FULL_OPERATION_CONTEXT);
	} catch (CmisBaseException cbe) {
		// we couldn't get the artwork object for some reason
		return null;
	}

	if (!(artworkObject instanceof Document)) {
		return null;
	}

	String artworkMimeType = ((Document) artworkObject)
			.getContentStreamMimeType();

	if (artworkMimeType == null) {
		return null;
	}

	if (!artworkMimeType.toLowerCase().startsWith("image/")) {
		return null;
	}

	return artworkId;
}
 
开发者ID:fmui,项目名称:ApacheChemistryInAction,代码行数:61,代码来源:TheBlendHelper.java


示例19: connect

import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException; //导入依赖的package包/类
/**
 * Connects the client to a repository.
 *
 * @param repositoryId see {@link RepositoryView#getId()}
 * @throws CmisBaseException if the connection could not be established
 */
public void connect(String repositoryId) throws CmisBaseException {
    currentSession = getSessionFactory().createSession(getSessionParametersFactory().newInstance(repositoryId));
    currentFolder = currentSession.getRootFolder();
    versionableCmisType = getVersionableCmisType();
}
 
开发者ID:federicamazza,项目名称:vaadin-cmis-browser,代码行数:12,代码来源:CmisClient.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CancelDelegationTokenRequestProto类代码示例发布时间:2022-05-22
下一篇:
Java UDecoder类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap