Package org.nuxeo.ecm.core.api

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


    protected String getActivityStreamName() {
        Map<String, Serializable> props = getProperties();
        String activityStreamName = (String) props.get(ACTIVITY_STREAM_NAME_PROPERTY);
        if (activityStreamName == null) {
            throw new ClientRuntimeException("Cannot find "
                    + ACTIVITY_STREAM_NAME_PROPERTY + " property.");
        }
        return activityStreamName;
    }
View Full Code Here


    protected DocumentModel getContextDocument() {
        Map<String, Serializable> props = getProperties();
        DocumentModel contextDocument = (DocumentModel) props.get(CONTEXT_DOCUMENT_PROPERTY);
        if (contextDocument == null) {
            throw new ClientRuntimeException("Cannot find "
                    + CONTEXT_DOCUMENT_PROPERTY + " property.");
        }
        return contextDocument;
    }
View Full Code Here

    protected Locale getLocale() {
        Map<String, Serializable> props = getProperties();
        Locale locale = (Locale) props.get(LOCALE_PROPERTY);
        if (locale == null) {
            throw new ClientRuntimeException("Cannot find " + LOCALE_PROPERTY
                    + " property.");
        }
        return locale;
    }
View Full Code Here

    protected CoreSession getCoreSession() {
        Map<String, Serializable> props = getProperties();
        CoreSession session = (CoreSession) props.get(CORE_SESSION_PROPERTY);
        if (session == null) {
            throw new ClientRuntimeException("Cannot find "
                    + CORE_SESSION_PROPERTY + " property.");
        }
        return session;
    }
View Full Code Here

    protected CoreSession getCoreSession() {
        Map<String, Serializable> props = getProperties();
        CoreSession coreSession = (CoreSession) props.get(CORE_SESSION_PROPERTY);
        if (coreSession == null) {
            throw new ClientRuntimeException("cannot find core session");
        }
        return coreSession;
    }
View Full Code Here

    protected String getActor() {
        Map<String, Serializable> props = getProperties();
        String actor = (String) props.get(ACTOR_PROPERTY);
        if (actor == null) {
            throw new ClientRuntimeException("Cannot find " + ACTOR_PROPERTY
                    + " property.");
        }
        return actor;
    }
View Full Code Here

    protected Locale getLocale() {
        Map<String, Serializable> props = getProperties();
        Locale locale = (Locale) props.get(LOCALE_PROPERTY);
        if (locale == null) {
            throw new ClientRuntimeException("Cannot find " + LOCALE_PROPERTY
                    + " property.");
        }
        return locale;
    }
View Full Code Here

    protected CoreSession getCoreSession() {
        Map<String, Serializable> props = getProperties();
        CoreSession session = (CoreSession) props.get(CORE_SESSION_PROPERTY);
        if (session == null) {
            throw new ClientRuntimeException("Cannot find "
                    + CORE_SESSION_PROPERTY + " property.");
        }
        return session;
    }
View Full Code Here

        for (DocumentModel relation : queryRelationshipsDirectory(filters,
                false)) {
            try {
                kinds.add(buildKindFromRelationshipModel(relation));
            } catch (ClientException e) {
                throw new ClientRuntimeException(e);
            }
        }
        kinds = relationshipKindRegistry.filterUnregisteredRelationshipKinds(kinds);
        return new ArrayList<RelationshipKind>(kinds);
    }
View Full Code Here

    @Override
    public Boolean addRelation(String actorId, String targetId,
            RelationshipKind kind) {
        if (kind == null) {
            throw new ClientRuntimeException("Type cannot be null");
        }

        DirectoryService directoryService = Framework.getLocalService(DirectoryService.class);
        Session relationshipsDirectory = null;
        try {
            relationshipsDirectory = directoryService.open(RELATIONSHIP_DIRECTORY_NAME);
            // try to get an existing entry
            Map<String, Serializable> relationship = new HashMap<String, Serializable>();
            relationship.put(RELATIONSHIP_FIELD_ACTOR, actorId);
            relationship.put(RELATIONSHIP_FIELD_TARGET, targetId);
            relationship.put(RELATIONSHIP_FIELD_KIND, kind.toString());

            DocumentModelList relationships = relationshipsDirectory.query(relationship);
            if (relationships.isEmpty()) {
                relationshipsDirectory.createEntry(new HashMap<String, Object>(
                        relationship));
                return true;
            } else {
                return false;
            }
        } catch (ClientException e) {
            throw new ClientRuntimeException("Unable to create a new relation",
                    e);
        } finally {
            if (relationshipsDirectory != null) {
                try {
                    relationshipsDirectory.close();
View Full Code Here

TOP

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

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.