use of org.alfresco.event.sdk.model.v1.model.DataAttributes in project alfresco-java-sdk by Alfresco.
the class NodeMovedFilter method checkPrimaryHierarchy.
private boolean checkPrimaryHierarchy(final RepoEvent<DataAttributes<Resource>> event) {
final NodeResource nodeResourceBefore = (NodeResource) event.getData().getResourceBefore();
final List<String> primaryHierarchy = nodeResourceBefore.getPrimaryHierarchy();
return primaryHierarchy != null && !primaryHierarchy.isEmpty();
}
use of org.alfresco.event.sdk.model.v1.model.DataAttributes in project alfresco-java-sdk by Alfresco.
the class NodeTypeChangedFilter method checkNodeType.
private boolean checkNodeType(final RepoEvent<DataAttributes<Resource>> event) {
final NodeResource nodeResourceBefore = (NodeResource) event.getData().getResourceBefore();
final String nodeTypeBefore = nodeResourceBefore.getNodeType();
final String nodeTypeAfter = ((NodeResource) event.getData().getResource()).getNodeType();
return nodeTypeBefore != null && nodeTypeAfter != null && !nodeTypeAfter.equals(nodeTypeBefore);
}
use of org.alfresco.event.sdk.model.v1.model.DataAttributes in project alfresco-java-sdk by Alfresco.
the class ContentChangedFilter method checkContent.
private boolean checkContent(final RepoEvent<DataAttributes<Resource>> event) {
final NodeResource nodeResourceBefore = (NodeResource) event.getData().getResourceBefore();
final ContentInfo contentInfo = nodeResourceBefore.getContent();
return contentInfo != null && (contentInfo.getEncoding() != null || contentInfo.getMimeType() != null || contentInfo.getSizeInBytes() != null);
}
use of org.alfresco.event.sdk.model.v1.model.DataAttributes in project alfresco-java-sdk by Alfresco.
the class NodeMovedHandler method handleEvent.
@Override
public void handleEvent(final RepoEvent<DataAttributes<Resource>> repoEvent) {
final NodeResource nodeResource = (NodeResource) repoEvent.getData().getResource();
final NodeResource beforeNodeResource = (NodeResource) repoEvent.getData().getResourceBefore();
final String name = nodeResource.getName();
final String currentPrimaryHierarchy = String.join(COMMA, nodeResource.getPrimaryHierarchy());
final String previousPrimaryHierarchy = String.join(COMMA, beforeNodeResource.getPrimaryHierarchy());
LOGGER.info("The node {} has been moved from the hierarchy path [{}] to the new hierarchy path [{}] in the repository!", name, previousPrimaryHierarchy, currentPrimaryHierarchy);
}
use of org.alfresco.event.sdk.model.v1.model.DataAttributes in project alfresco-java-sdk by Alfresco.
the class TitleModifiedHandler method handleEvent.
@Override
public void handleEvent(final RepoEvent<DataAttributes<Resource>> repoEvent) {
final NodeResource nodeResource = (NodeResource) repoEvent.getData().getResource();
final NodeResource beforeNodeResource = (NodeResource) repoEvent.getData().getResourceBefore();
final String name = nodeResource.getName();
final String previousTitle = (String) beforeNodeResource.getProperties().getOrDefault(CM_TITLE, "");
final String currentTitle = (String) nodeResource.getProperties().getOrDefault(CM_TITLE, "");
LOGGER.info("The title of the node {} has changed from '{}' to '{}'!", name, previousTitle, currentTitle);
}
Aggregations