Package org.nuxeo.ecm.core.api

Examples of org.nuxeo.ecm.core.api.ClientException


        DocumentModel target = session.getDocument(docRef);
        SocialDocument socialDocument = toSocialDocument(target);

        if (socialDocument == null) {
            throw new ClientException("Can't fetch social document.");
        }

        boolean isPublic = "true".equals(formData.getString("public"));
        if (isPublic) {
            socialDocument.makePublic();
View Full Code Here


    protected static TypeManager getTypeService() throws ClientException {
        TypeManager typeService;
        try {
            typeService = Framework.getService(TypeManager.class);
        } catch (Exception e) {
            throw new ClientException(e.getMessage(), e);
        }
        if (typeService == null) {
            throw new ClientException(
                    "Can't fetch the typeService, please contact your administrator");
        }
        return typeService;
    }
View Full Code Here

        TypeManager typeManager;
        try {
            typeManager = Framework.getService(TypeManager.class);
        } catch (Exception e) {
            throw new ClientException(e.getMessage(), e);
        }

        for (DocumentModel doc : docs) {
            Type type = typeManager.getType(doc.getType());
            TypeView view = type.getView("collaboration");
View Full Code Here

        ImagingService service;
        try {
            service = Framework.getService(ImagingService.class);
        } catch (Exception e) {
            throw new ClientException("Failed to get ImagingService", e);
        }

        ImageInfo info = service.getImageInfo(image);
        int width = info.getWidth();
        int height = info.getHeight();
View Full Code Here

    public List<String> addSocialWorkspaceMembers(
            SocialWorkspace socialWorkspace, String groupName)
            throws ClientException {
        NuxeoGroup group = getUserManager().getGroup(groupName);
        if (group == null) {
            throw new ClientException(String.format("Group (%s) not found",
                    groupName));
        }

        List<String> importedUsers = new ArrayList<String>();
        List<Principal> importedPrincipal = new ArrayList<Principal>();
View Full Code Here

            try {
                socialWorkspaceService = Framework.getService(SocialWorkspaceService.class);
            } catch (Exception e) {
                final String errMsg = "Error connecting to SocialWorkspaceService. "
                        + e.getMessage();
                throw new ClientException(errMsg, e);
            }
            if (socialWorkspaceService == null) {
                throw new ClientException(
                        "SocialWorkspaceService service not bound");
            }
        }
        return socialWorkspaceService;
    }
View Full Code Here

    @Override
    public DocumentModel doAddDocumentPermission(CoreSession session,
            DocumentModel registrationDoc) throws ClientException {
        String docId = (String) registrationDoc.getPropertyValue(DOCUMENT_ID_FIELD);
        if (StringUtils.isBlank(docId)) {
            throw new ClientException("SocialWorkspace id is missing");
        }
        SocialWorkspace sw = toSocialWorkspace(session.getDocument(new IdRef(
                docId)));
        if (sw == null) {
            throw new ClientException(
                    "Document passed is not a Social Workspace");
        }
        String login = (String) registrationDoc.getPropertyValue(USERNAME_FIELD);
        Principal principal = getUserManager().getPrincipal(login);
View Full Code Here

    public SocialDocumentAdapter(DocumentModel sourceDocument)
            throws ClientException {
        this.sourceDocument = sourceDocument;

        if (sourceDocument != null && getSession() == null) {
            throw new ClientException(
                    "All action will be impossible as the given getSession() is null");
        }
        if (sourceDocument == null) {
            throw new ClientException("Give document model is null");
        }

        if (!SocialWorkspaceHelper.isSocialDocument(sourceDocument)) {
            throw new ClientException(
                    "Make public a document is restricted to social document only not for :"
                            + sourceDocument.getPathAsString());
        }

        socialWorkspace = getSocialWorkspaceService().getDetachedSocialWorkspace(
                sourceDocument);
        if (socialWorkspace == null) {
            throw new ClientException(
                    "Given document is not into a social workspace");
        }
    }
View Full Code Here

    protected void validateDocumentVisibility(DocumentModelList proxies,
            boolean isPublicProxies) throws ClientException {
        if (proxies.size() > 1) {
            String message = String.format("Too many published document: %s, please check."
                    + sourceDocument.getPathAsString());
            throw new ClientException(message);
        }

        if (!isPublicProxies && ARTICLE_TYPE.equals(sourceDocument.getType())
                && proxies.size() == 1) {
            String message = String.format("Article can't have a private proxy: %s, please check."
                    + sourceDocument.getPathAsString());
            throw new ClientException(message);
        }

    }
View Full Code Here

        if (event.getName().equals(EVENT_MEMBERS_REMOVED)) {
            memberRemovedCount += lastPrincipalsCount;
        } else if (event.getName().equals(EVENT_MEMBERS_ADDED)) {
            memberAddedCount += lastPrincipalsCount;
        } else {
            throw new ClientException("Unknown event");
        }
    }
View Full Code Here

TOP

Related Classes of org.nuxeo.ecm.core.api.ClientException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.