Package org.apache.chemistry.opencmis.client.api

Examples of org.apache.chemistry.opencmis.client.api.Session


        return super.getName() + " (" + getBinding() + ")";
    }

    @Override
    public void run() throws Exception {
        Session session;

        Map<String, String> parameters = getParameters();
        String repId = parameters.get(SessionParameter.REPOSITORY_ID);
        if ((repId != null) && (repId.length() > 0)) {
            session = factory.createSession(parameters);
        } else {
            session = factory.getRepositories(parameters).get(0).createSession();
        }

        // switch off the cache
        session.getDefaultContext().setCacheEnabled(false);

        try {
            run(session);
        } catch (Exception e) {
            if (!(e instanceof FatalTestException)) {
View Full Code Here


    public synchronized ClientSession getClientSession() {
        return clientSession;
    }

    public synchronized RepositoryInfo getRepositoryInfo() throws Exception {
        Session session = clientSession.getSession();
        return session.getRepositoryInfo();
    }
View Full Code Here

        }
    }

    public synchronized void loadFolder(String folderId, boolean byPath) throws Exception {
        try {
            Session session = clientSession.getSession();
            CmisObject folderObject = null;

            if (byPath) {
                folderObject = session.getObjectByPath(folderId);
            } else {
                folderObject = session.getObject(session.createObjectId(folderId));
            }

            if (!(folderObject instanceof Folder)) {
                if (folderObject instanceof FileableCmisObject) {
                    List<Folder> parents = ((FileableCmisObject) folderObject).getParents();
View Full Code Here

        loadFolder(currentFolder.getId(), false);
    }

    public synchronized void loadObject(String objectId) throws Exception {
        try {
            Session session = clientSession.getSession();
            CmisObject object = session.getObject(objectId, clientSession.getObjectOperationContext());
            object.refreshIfOld(OLD);

            setCurrentObject(object);
        } catch (Exception ex) {
            setCurrentObject(null);
View Full Code Here

        if (currentObject == null) {
            return;
        }

        try {
            Session session = clientSession.getSession();
            CmisObject object = session.getObject(currentObject, clientSession.getObjectOperationContext());
            object.refresh();

            setCurrentObject(object);
        } catch (Exception ex) {
            setCurrentObject(null);
View Full Code Here

    public synchronized ItemIterable<QueryResult> query(String q, boolean searchAllVersions, int maxHits)
            throws Exception {
        OperationContext queryContext = new OperationContextImpl(null, false, false, false, IncludeRelationships.NONE,
                null, false, null, false, maxHits);

        Session session = clientSession.getSession();
        return session.query(q, searchAllVersions, queryContext);
    }
View Full Code Here

        Session session = clientSession.getSession();
        return session.query(q, searchAllVersions, queryContext);
    }

    public synchronized List<Tree<ObjectType>> getTypeDescendants() throws Exception {
        Session session = clientSession.getSession();
        return session.getTypeDescendants(null, -1, true);
    }
View Full Code Here

        }
        return exchange;
    }

    protected CmisObject retrieveCMISObjectByIdFromServer(String nodeId) throws Exception {
        Session session = createSession();
        return session.getObject(nodeId);
    }
View Full Code Here

        Session session = createSession();
        return session.getObject(nodeId);
    }

    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();
    }
View Full Code Here

        return super.getName() + " (" + getBinding() + ")";
    }

    @Override
    public void run() throws Exception {
        Session session;

        Map<String, String> parameters = getParameters();
        String repId = parameters.get(SessionParameter.REPOSITORY_ID);
        if ((repId != null) && (repId.length() > 0)) {
            session = factory.createSession(parameters);
        } else {
            session = factory.getRepositories(parameters).get(0).createSession();
        }

        // switch off the cache
        session.getDefaultContext().setCacheEnabled(false);

        try {
            run(session);
        } catch (Exception e) {
            if (!(e instanceof FatalTestException)) {
View Full Code Here

TOP

Related Classes of org.apache.chemistry.opencmis.client.api.Session

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.