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

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


    getSession();
   
    String[] rval = new String[documentIdentifiers.length];
    int i = 0;
    while (i < rval.length){
      CmisObject cmisObject = session.getObject(documentIdentifiers[i]);
      if (cmisObject.getBaseType().getId().equals(CMIS_DOCUMENT_BASE_TYPE)) {
        Document document = (Document) cmisObject;
       
        //we have to check if this CMIS repository support versioning
        // or if the versioning is disabled for this content
        if(StringUtils.isNotEmpty(document.getVersionLabel())){
View Full Code Here


            String id = pathToIdMap.get(path);
            if (id == null) {
                return null; // not found
            }

            CmisObject object = getById(id, cacheKey);
            if ((object == null) && (!objectMap.containsKey(id))) {
                // clean up
                fLock.readLock().unlock();
                fLock.writeLock().lock();
                try {
View Full Code Here

        String id = "1";
        // String path = "/1";
        String cacheKey = "key";

        // add object
        CmisObject obj1 = this.createCmisObject(id);
        cache.put(obj1, cacheKey);

        // access object
        Assert.assertTrue(cache.containsId(id, cacheKey));

        // access object
        CmisObject obj2 = cache.getById(id, cacheKey);
        Assert.assertEquals(obj1, obj2);

        // clear cache
        cache.clear();

        // access object (not found)
        Assert.assertFalse(cache.containsId(id, cacheKey));

        // access object (not found)
        CmisObject obj4 = cache.getById(id, cacheKey);
        Assert.assertNull(obj4);
    }
View Full Code Here

        Cache cache = CacheImpl.newInstance(cacheSize);

        String cacheKey = "key";

        for (int i = 0; i < cacheSize + 1; i++) {
            CmisObject obj = this.createCmisObject("id" + i);
            cache.put(obj, cacheKey);
        }

        Assert.assertNull(cache.getById("id0", cacheKey)); // thrown out
        Assert.assertNotNull(cache.getById("id1", cacheKey));
View Full Code Here

        Cache cache = CacheImpl.newInstance(cacheSize);

        String cacheKey = "key";

        for (int i = 0; i < cacheSize; i++) {
            CmisObject obj = this.createCmisObject("id" + i);
            cache.put(obj, cacheKey);
        }

        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        ObjectOutputStream out = new ObjectOutputStream(buffer);
        out.writeObject(cache);
        out.close();

        ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
        Cache cache2 = (Cache) in.readObject();
        in.close();

        for (int k = 0; k < cacheSize; k++) {
            CmisObject o1 = cache.getById("id" + k, cacheKey);
            CmisObject o2 = cache2.getById("id" + k, cacheKey);
            Assert.assertEquals(o1.getId(), o2.getId());
        }

    }
View Full Code Here

                throw new CmisRuntimeException("Repository sent invalid data! No object id!");
            }

            // fetch the object and make sure it is a folder
            ObjectId parentId = getSession().createObjectId((String) idProperty.getFirstValue());
            CmisObject parentFolder = getSession().getObject(parentId);
            if (!(parentFolder instanceof Folder)) {
                // the repository sent an object that is not a folder...
                throw new CmisRuntimeException("Repository sent invalid data! Object is not a folder!");
            }
View Full Code Here

        if (objectIdHolder.getValue() == null) {
            return null;
        }

        CmisObject movedObject = getSession().getObject(getSession().createObjectId(objectIdHolder.getValue()));
        if (!(movedObject instanceof FileableCmisObject)) {
            throw new CmisRuntimeException("Moved object is invalid!");
        }

        return (FileableCmisObject) movedObject;
View Full Code Here

    private void doAction(boolean alternate) {
        int row = getSelectedRow();
        if ((row > -1) && (row < model.getCurrentChildren().size())) {
            String id = getModel().getValueAt(getRowSorter().convertRowIndexToModel(row), ID_COLUMN).toString();
            CmisObject object = model.getFromCurrentChildren(id);

            if (object instanceof Document) {
                if (alternate) {
                    ClientHelper.download(this.getParent(), (Document) object, null);
                } else {
                    ClientHelper.open(this.getParent(), (Document) object, null);
                }
            } else if (object instanceof Folder) {
                try {
                    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                    model.loadFolder(object.getId(), false);
                } catch (Exception ex) {
                    ClientHelper.showError(null, ex);
                    return;
                } finally {
                    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
View Full Code Here

    public Document getRenditionDocument(OperationContext context) {
        if (renditionDocumentId == null) {
            return null;
        }
        CmisObject rendDoc = session.getObject(session.createObjectId(renditionDocumentId), context);
        if (!(rendDoc instanceof Document)) {
            return null;
        }

        return (Document) rendDoc;
View Full Code Here

        public int getRowCount() {
            return model.getCurrentChildren().size();
        }

        public Object getValueAt(int rowIndex, int columnIndex) {
            CmisObject obj = model.getCurrentChildren().get(rowIndex);

            switch (columnIndex) {
            case 0:
                return icons.get(obj.getBaseTypeId());
            case 1:
                return obj.getName();
            case 2:
                return obj.getType().getId();
            case 3:
                if (obj instanceof Document) {
                    return ((Document) obj).getContentStreamMimeType();
                } else {
                    return null;
                }
            case 4:
                if (obj instanceof Document) {
                    return ((Document) obj).getContentStreamLength();
                } else {
                    return null;
                }
            case 5:
                return obj.getCreationDate();
            case 6:
                return obj.getCreatedBy();
            case 7:
                return obj.getLastModificationDate();
            case 8:
                return obj.getLastModifiedBy();
            case ID_COLUMN:
                return obj.getId();
            }

            return "";
        }
View Full Code Here

TOP

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

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.