Search in sources :

Example 6 with ActivityInfo

use of org.alfresco.service.cmr.activities.ActivityInfo in project records-management by Alfresco.

the class FilePlanComponentsApiUtils method postActivity.

/**
 * Posts activities for given fileInfo
 *
 * @param fileInfo
 * @param parentNodeRef
 * @param activityType
 */
public void postActivity(FileInfo fileInfo, NodeRef parentNodeRef, String activityType) {
    ActivityInfo activityInfo = null;
    RMSite rmSite = sites.getRMSite(RM_SITE_ID);
    if (rmSite != null && !rmSite.getId().equals("")) {
        if (fileInfo != null) {
            boolean isContent = dictionaryService.isSubClass(fileInfo.getType(), ContentModel.TYPE_CONTENT);
            if (isContent) {
                activityInfo = new ActivityInfo(null, parentNodeRef, RM_SITE_ID, fileInfo);
            }
        }
    } else {
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Non-site activity, so ignored " + fileInfo.getNodeRef());
        }
    }
    if (activityInfo == null)
        // Nothing to do.
        return;
    if (activityType != null) {
        activityPoster.postFileFolderActivity(activityType, null, TenantUtil.getCurrentDomain(), activityInfo.getSiteId(), activityInfo.getParentNodeRef(), activityInfo.getNodeRef(), activityInfo.getFileName(), Activities.APP_TOOL, Activities.RESTAPI_CLIENT, activityInfo.getFileInfo());
    }
}
Also used : ActivityInfo(org.alfresco.service.cmr.activities.ActivityInfo) RMSite(org.alfresco.rm.rest.api.model.RMSite)

Aggregations

ActivityInfo (org.alfresco.service.cmr.activities.ActivityInfo)6 ConstraintViolatedException (org.alfresco.rest.framework.core.exceptions.ConstraintViolatedException)2 InvalidArgumentException (org.alfresco.rest.framework.core.exceptions.InvalidArgumentException)2 PermissionDeniedException (org.alfresco.rest.framework.core.exceptions.PermissionDeniedException)2 DuplicateChildNodeNameException (org.alfresco.service.cmr.repository.DuplicateChildNodeNameException)2 NodeRef (org.alfresco.service.cmr.repository.NodeRef)2 QName (org.alfresco.service.namespace.QName)2 IOException (java.io.IOException)1 Serializable (java.io.Serializable)1 ContentLimitViolationException (org.alfresco.repo.content.ContentLimitViolationException)1 FilterPropBoolean (org.alfresco.repo.node.getchildren.FilterPropBoolean)1 IntegrityException (org.alfresco.repo.node.integrity.IntegrityException)1 AccessDeniedException (org.alfresco.repo.security.permissions.AccessDeniedException)1 ApiException (org.alfresco.rest.framework.core.exceptions.ApiException)1 DisabledServiceException (org.alfresco.rest.framework.core.exceptions.DisabledServiceException)1 EntityNotFoundException (org.alfresco.rest.framework.core.exceptions.EntityNotFoundException)1 InsufficientStorageException (org.alfresco.rest.framework.core.exceptions.InsufficientStorageException)1 NotFoundException (org.alfresco.rest.framework.core.exceptions.NotFoundException)1 RequestEntityTooLargeException (org.alfresco.rest.framework.core.exceptions.RequestEntityTooLargeException)1 UnsupportedMediaTypeException (org.alfresco.rest.framework.core.exceptions.UnsupportedMediaTypeException)1