Search in sources :

Example 26 with NodeResource

use of org.alfresco.repo.event.v1.model.NodeResource in project alfresco-repository by Alfresco.

the class AbstractContextAwareRepoEvent method getNodeResource.

protected <D extends DataAttributes<NodeResource>> NodeResource getNodeResource(RepoEvent<D> repoEvent) {
    assertNotNull(repoEvent);
    D eventData = getEventData(repoEvent);
    assertNotNull(eventData);
    NodeResource resource = eventData.getResource();
    assertNotNull(resource);
    return resource;
}
Also used : NodeResource(org.alfresco.repo.event.v1.model.NodeResource) GUID(org.alfresco.util.GUID)

Example 27 with NodeResource

use of org.alfresco.repo.event.v1.model.NodeResource in project alfresco-repository by Alfresco.

the class AbstractContextAwareRepoEvent method getNodeResource.

protected NodeResource getNodeResource(int eventSequenceNumber) {
    DataAttributes<NodeResource> eventData = getEventData(eventSequenceNumber);
    NodeResource resource = eventData.getResource();
    assertNotNull(resource);
    return resource;
}
Also used : NodeResource(org.alfresco.repo.event.v1.model.NodeResource)

Example 28 with NodeResource

use of org.alfresco.repo.event.v1.model.NodeResource in project alfresco-repository by Alfresco.

the class CreateRepoEventIT method testFolderNodeType.

@Test
public void testFolderNodeType() {
    createNode(ContentModel.TYPE_FOLDER);
    final NodeResource resource = getNodeResource(1);
    assertEquals("cm:content node type was not found", "cm:folder", resource.getNodeType());
    assertFalse("isFile flag should be FALSE for nodeType=cm:folder. ", resource.isFile());
    assertTrue("isFolder flag should be TRUE for nodeType=cm:folder. ", resource.isFolder());
}
Also used : NodeResource(org.alfresco.repo.event.v1.model.NodeResource) Test(org.junit.Test)

Example 29 with NodeResource

use of org.alfresco.repo.event.v1.model.NodeResource in project alfresco-repository by Alfresco.

the class CreateRepoEventIT method testCreateContentInFolderStructure.

@Test
public void testCreateContentInFolderStructure() {
    final NodeRef grandParent = createNode(ContentModel.TYPE_FOLDER);
    final NodeRef parent = createNode(ContentModel.TYPE_FOLDER, grandParent);
    createNode(ContentModel.TYPE_CONTENT, parent);
    final NodeResource resource = getNodeResource(3);
    List<String> primaryHierarchy = resource.getPrimaryHierarchy();
    assertNotNull(primaryHierarchy);
    assertEquals("Wrong hierarchy", 3, primaryHierarchy.size());
    assertEquals("Wrong parent", parent.getId(), primaryHierarchy.get(0));
}
Also used : NodeResource(org.alfresco.repo.event.v1.model.NodeResource) NodeRef(org.alfresco.service.cmr.repository.NodeRef) Test(org.junit.Test)

Example 30 with NodeResource

use of org.alfresco.repo.event.v1.model.NodeResource in project alfresco-repository by Alfresco.

the class CreateRepoEventIT method testFileNodeType.

@Test
public void testFileNodeType() {
    createNode(ContentModel.TYPE_CONTENT);
    final NodeResource resource = getNodeResource(1);
    assertEquals("cm:content node type was not found", "cm:content", resource.getNodeType());
    assertTrue("isFile flag should be TRUE for nodeType=cm:content. ", resource.isFile());
    assertFalse("isFolder flag should be FALSE for nodeType=cm:content. ", resource.isFolder());
}
Also used : NodeResource(org.alfresco.repo.event.v1.model.NodeResource) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)39 NodeRef (org.alfresco.service.cmr.repository.NodeRef)36 NodeResource (org.alfresco.repo.event.v1.model.NodeResource)28 EventData (org.alfresco.repo.event.v1.model.EventData)25 RepoEvent (org.alfresco.repo.event.v1.model.RepoEvent)12 ChildAssociationRef (org.alfresco.service.cmr.repository.ChildAssociationRef)12 ChildAssociationResource (org.alfresco.repo.event.v1.model.ChildAssociationResource)11 AssociationRef (org.alfresco.service.cmr.repository.AssociationRef)5 PeerAssociationResource (org.alfresco.repo.event.v1.model.PeerAssociationResource)4 ContentInfo (org.alfresco.repo.event.v1.model.ContentInfo)3 PropertyMap (org.alfresco.util.PropertyMap)3 ContentService (org.alfresco.service.cmr.repository.ContentService)2 ContentWriter (org.alfresco.service.cmr.repository.ContentWriter)2 QName (org.alfresco.service.namespace.QName)2 GUID (org.alfresco.util.GUID)2 Serializable (java.io.Serializable)1 ZonedDateTime (java.time.ZonedDateTime)1 HashSet (java.util.HashSet)1 M2Model (org.alfresco.repo.dictionary.M2Model)1 M2Type (org.alfresco.repo.dictionary.M2Type)1