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 ObjectId loadFolder(String folderId, boolean byPath) throws Exception {
        try {
            Session session = clientSession.getSession();
            CmisObject selectedObject = null;
            CmisObject folderObject = null;

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

            if (selectedObject instanceof Folder) {
                folderObject = selectedObject;
            } else {
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

public class QueryStatementTest {

    @Test
    public void testStaticQueries() {
        Session session = new SessionImpl(new HashMap<String, String>(), null, null, null);
        String query;
        QueryStatement st;

        query = "SELECT cmis:name FROM cmis:folder";
        st = new QueryStatementImpl(session, query);
View Full Code Here

        assertEquals(query, st.toQueryString());
    }

    @Test
    public void testWherePlacholder() {
        Session session = new SessionImpl(new HashMap<String, String>(), null, null, null);
        String query;
        QueryStatement st;

        // strings
        query = "SELECT * FROM cmis:document WHERE abc:string = ?";
View Full Code Here

        }

        // create session with the first (and only) repository
        Repository repository = repositories.get(0);
        parameter.put(SessionParameter.REPOSITORY_ID, repository.getId());
        Session session = sessionFactory.createSession(parameter);

        System.out.println("Got a connection to repository: " + repository.getName() + ", with id: "
                + repository.getId());

        // Get everything in the root folder and print the names of the objects
        Folder root = session.getRootFolder();
        ItemIterable<CmisObject> children = root.getChildren();
        System.out.println("Found the following objects in the root folder:-");
        for (CmisObject o : children) {
            System.out.println(o.getName());
        }
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.