org.apache.chemistry.opencmis.commons.data.RenditionData Java Examples

The following examples show how to use org.apache.chemistry.opencmis.commons.data.RenditionData. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Converter.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Converts a rendition object
 * 
 * @param rendition the rendition
 * 
 * @return the conversion
 */
public static RenditionData convert(CmisRenditionType rendition) {
	if (rendition == null) {
		return null;
	}

	RenditionDataImpl result = new RenditionDataImpl();

	result.setBigHeight(rendition.getHeight());
	result.setKind(rendition.getKind());
	result.setBigLength(rendition.getLength());
	result.setMimeType(rendition.getMimetype());
	result.setRenditionDocumentId(rendition.getRenditionDocumentId());
	result.setStreamId(rendition.getStreamId());
	result.setTitle(rendition.getTitle());
	result.setBigWidth(rendition.getWidth());

	// handle extensions
	convertExtension(rendition, result);

	return result;
}
 
Example #2
Source File: Converter.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Converts a rendition object
 * 
 * @param rendition the rendition
 * 
 * @return the conversion
 */
public static CmisRenditionType convert(RenditionData rendition) {
	if (rendition == null) {
		return null;
	}

	CmisRenditionType result = new CmisRenditionType();

	result.setHeight(rendition.getBigHeight());
	result.setKind(rendition.getKind());
	result.setLength(rendition.getBigLength());
	result.setMimetype(rendition.getMimeType());
	result.setRenditionDocumentId(rendition.getRenditionDocumentId());
	result.setStreamId(rendition.getStreamId());
	result.setTitle(rendition.getTitle());
	result.setWidth(rendition.getBigWidth());

	// handle extensions
	convertExtension(rendition, result);

	return result;
}
 
Example #3
Source File: CMISRenditionMapping.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
private RenditionData createRenditionData(NodeRef rendNodeRef, String mimeType, String title, String kind,
        BigInteger length, BigInteger width, BigInteger height)
{
    RenditionDataImpl result = new RenditionDataImpl();

    result.setStreamId(rendNodeRef.getId());
    result.setMimeType(mimeType);

    result.setTitle(title);
    result.setKind(kind);
    result.setBigLength(length);

    result.setBigWidth(width);
    result.setBigHeight(height);

    result.setRenditionDocumentId(rendNodeRef.getId());

    return result;
}
 
Example #4
Source File: AlfrescoCmisServiceImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public List<RenditionData> getRenditions(String repositoryId, String objectId, String renditionFilter,
        BigInteger maxItems, BigInteger skipCount, ExtensionsData extension)
{
    checkRepositoryId(repositoryId);

    // what kind of object is it?
    CMISNodeInfo info = getOrCreateNodeInfo(objectId, "Object");

    if (info.isVariant(CMISObjectVariant.ASSOC))
    {
        return Collections.emptyList();
    }
    else
    {
        return connector.getRenditions(info.getNodeRef(), renditionFilter, maxItems, skipCount);
    }
}
 
Example #5
Source File: ConformanceCmisServiceWrapper.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public List<RenditionData> getRenditions(String repositoryId, String objectId, String renditionFilter,
        BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
    checkRepositoryId(repositoryId);
    checkId("Object Id", objectId);
    renditionFilter = getDefaultRenditionFilter(renditionFilter);
    maxItems = getMaxItems(maxItems);
    skipCount = getSkipCount(skipCount);

    try {
        return getWrappedService().getRenditions(repositoryId, objectId, renditionFilter, maxItems, skipCount,
                extension);
    } catch (Exception e) {
        throw createCmisException(e);
    }
}
 
Example #6
Source File: Converter.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Converts a CMIS object
 * 
 * @param object the object to convert
 * 
 * @return the converted object
 */
public static ObjectData convert(CmisObjectType object) {
	if (object == null) {
		return null;
	}

	ObjectDataImpl result = new ObjectDataImpl();

	result.setAcl(convert(object.getAcl(), object.isExactACL()));
	result.setAllowableActions(convert(object.getAllowableActions()));
	if (object.getChangeEventInfo() != null) {
		ChangeEventInfoDataImpl changeEventInfo = new ChangeEventInfoDataImpl();
		if (object.getChangeEventInfo().getChangeTime() != null) {
			changeEventInfo.setChangeTime(object.getChangeEventInfo().getChangeTime().toGregorianCalendar());
		}
		changeEventInfo.setChangeType(convert(ChangeType.class, object.getChangeEventInfo().getChangeType()));
		convertExtension(object.getChangeEventInfo(), changeEventInfo);

		result.setChangeEventInfo(changeEventInfo);
	}
	result.setIsExactAcl(object.isExactACL());
	result.setPolicyIds(convert(object.getPolicyIds()));
	result.setProperties(convert(object.getProperties()));
	List<ObjectData> relationships = new ArrayList<ObjectData>();
	for (CmisObjectType cmisObject : object.getRelationship()) {
		relationships.add(convert(cmisObject));
	}
	result.setRelationships(relationships);
	List<RenditionData> renditions = new ArrayList<RenditionData>();
	for (CmisRenditionType rendition : object.getRendition()) {
		renditions.add(convert(rendition));
	}
	result.setRenditions(renditions);

	// handle extensions
	convertExtension(object, result);

	return result;
}
 
Example #7
Source File: Converter.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Converts a CMIS object
 * 
 * @param object the object to convert
 * 
 * @return the CMIS conversion
 */
public static CmisObjectType convert(ObjectData object) {
	if (object == null) {
		return null;
	}

	CmisObjectType result = new CmisObjectType();

	result.setAcl(convert(object.getAcl()));
	result.setAllowableActions(convert(object.getAllowableActions()));
	if (object.getChangeEventInfo() != null) {
		CmisChangeEventType changeEventInfo = new CmisChangeEventType();

		changeEventInfo
				.setChangeType(convert(EnumTypeOfChanges.class, object.getChangeEventInfo().getChangeType()));
		changeEventInfo.setChangeTime(convertCalendar(object.getChangeEventInfo().getChangeTime()));

		convertExtension(object.getChangeEventInfo(), changeEventInfo);

		result.setChangeEventInfo(changeEventInfo);
	}
	result.setExactACL(object.getAcl() == null ? null : object.getAcl().isExact());
	result.setPolicyIds(convert(object.getPolicyIds()));
	result.setProperties(convert(object.getProperties()));
	if (object.getRelationships() != null) {
		for (ObjectData relationship : object.getRelationships()) {
			result.getRelationship().add(convert(relationship));
		}
	}
	if (object.getRenditions() != null) {
		for (RenditionData rendition : object.getRenditions()) {
			result.getRendition().add(convert(rendition));
		}
	}

	// handle extensions
	convertExtension(object, result);

	return result;
}
 
Example #8
Source File: IbisObjectService.java    From iaf with Apache License 2.0 5 votes vote down vote up
@Override
public List<RenditionData> getRenditions(String repositoryId,
		String objectId, String renditionFilter, BigInteger maxItems,
		BigInteger skipCount, ExtensionsData extension) {
	// TODO Auto-generated method stub
	return objectService.getRenditions(repositoryId, objectId, renditionFilter, maxItems, skipCount, extension);
}
 
Example #9
Source File: LDCmisService.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public List<RenditionData> getRenditions(String repositoryId, String objectId, String renditionFilter,
		BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
	validateSession();
	return Collections.emptyList();
}
 
Example #10
Source File: CMISConnector.java    From alfresco-repository with GNU Lesser General Public License v3.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
private ObjectData createCMISObjectImpl(final CMISNodeInfo info, Properties nodeProps, String filter,
        boolean includeAllowableActions, IncludeRelationships includeRelationships, String renditionFilter,
        boolean includePolicyIds, boolean includeAcl)
{
    final ObjectDataImpl result = new ObjectDataImpl();

    // set allowable actions
    if (includeAllowableActions)
    {
        result.setAllowableActions(getAllowableActions(info));
    }

    // set policy ids
    if (includePolicyIds)
    {
        result.setPolicyIds(new PolicyIdListImpl());
    }

    if (info.isRelationship())
    {
        // set properties
        result.setProperties(getAssocProperties(info, filter));

        // set ACL
        if (includeAcl)
        {
            // association have no ACL - return an empty list of ACEs
            result.setAcl(new AccessControlListImpl((List<Ace>) Collections.EMPTY_LIST));
            result.setIsExactAcl(Boolean.FALSE);
        }
    }
    else
    {
        // set properties
        result.setProperties(nodeProps);

        // set relationships
        if (includeRelationships != IncludeRelationships.NONE)
        {
            result.setRelationships(getRelationships(info.getNodeRef(), includeRelationships));
        }

        // set renditions
        if (!RENDITION_NONE.equals(renditionFilter))
        {
            List<RenditionData> renditions = getRenditions(info.getNodeRef(), renditionFilter, null, null);
            if ((renditions != null) && (!renditions.isEmpty()))
            {
                result.setRenditions(renditions);
            }
            else
            {
            	result.setRenditions(Collections.EMPTY_LIST);
            }
        }

        // set ACL
        if (includeAcl)
        {
        	AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
        	{
	@Override
	public Void doWork() throws Exception
	{
	    Acl acl = getACL(info.getCurrentNodeNodeRef(), false);
              if (acl != null)
              {
	        result.setAcl(acl);
	        result.setIsExactAcl(acl.isExact());
              }
		return null;
	}
        	});
        }

        // add aspects
        List<CmisExtensionElement> extensions = getAspectExtensions(info, filter, result.getProperties()
                .getProperties().keySet());

        if (!extensions.isEmpty())
        {
            result.getProperties().setExtensions(
                    Collections.singletonList((CmisExtensionElement) new CmisExtensionElementImpl(
                            ALFRESCO_EXTENSION_NAMESPACE, ASPECTS, null, extensions)));
        }
    }
    return result;
}
 
Example #11
Source File: CMISConnector.java    From alfresco-repository with GNU Lesser General Public License v3.0 4 votes vote down vote up
public List<RenditionData> getRenditions(NodeRef nodeRef, String renditionFilter, BigInteger maxItems,
        BigInteger skipCount)
{
    CMISRenditionMapping mapping = getRenditionMapping();
    return mapping.getRenditions(nodeRef, renditionFilter, maxItems, skipCount);
}
 
Example #12
Source File: AbstractCmisServiceWrapper.java    From alfresco-repository with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public List<RenditionData> getRenditions(String repositoryId, String objectId, String renditionFilter,
        BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
    return service.getRenditions(repositoryId, objectId, renditionFilter, maxItems, skipCount, extension);
}
 
Example #13
Source File: FilterCmisService.java    From iaf with Apache License 2.0 4 votes vote down vote up
@Override
public List<RenditionData> getRenditions(String repositoryId, String objectId, String renditionFilter,
		BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
	return getObjectService()
			.getRenditions(repositoryId, objectId, renditionFilter, maxItems, skipCount, extension);
}