Search in sources :

Example 6 with EntityVO

use of com.epam.pipeline.controller.vo.EntityVO in project cloud-pipeline by epam.

the class PipelineManager method load.

public Pipeline load(Long id, boolean loadVersion) {
    Pipeline pipeline = pipelineDao.loadPipeline(id);
    Assert.notNull(pipeline, messageHelper.getMessage(MessageConstants.ERROR_PIPELINE_NOT_FOUND, id));
    if (loadVersion) {
        setCurrentVersion(pipeline);
    }
    pipeline.setHasMetadata(this.metadataManager.hasMetadata(new EntityVO(id, AclClass.PIPELINE)));
    return pipeline;
}
Also used : EntityVO(com.epam.pipeline.controller.vo.EntityVO) Pipeline(com.epam.pipeline.entity.pipeline.Pipeline)

Example 7 with EntityVO

use of com.epam.pipeline.controller.vo.EntityVO in project cloud-pipeline by epam.

the class PipelineManager method loadByNameOrId.

public Pipeline loadByNameOrId(String identifier) {
    Pipeline pipeline = null;
    try {
        pipeline = pipelineDao.loadPipeline(Long.parseLong(identifier));
    } catch (NumberFormatException e) {
        LOGGER.trace(e.getMessage(), e);
    }
    if (pipeline == null) {
        pipeline = pipelineDao.loadPipelineByName(identifier);
    }
    Assert.notNull(pipeline, messageHelper.getMessage(MessageConstants.ERROR_PIPELINE_NOT_FOUND, identifier));
    setCurrentVersion(pipeline);
    pipeline.setHasMetadata(this.metadataManager.hasMetadata(new EntityVO(pipeline.getId(), AclClass.PIPELINE)));
    return pipeline;
}
Also used : EntityVO(com.epam.pipeline.controller.vo.EntityVO) Pipeline(com.epam.pipeline.entity.pipeline.Pipeline)

Example 8 with EntityVO

use of com.epam.pipeline.controller.vo.EntityVO in project cloud-pipeline by epam.

the class SecuredEntityDeletionAspect method deleteUser.

@AfterReturning(pointcut = "execution(* *.deleteUser(..))", returning = USER)
@Transactional(propagation = Propagation.REQUIRED)
public void deleteUser(JoinPoint joinPoint, PipelineUser user) {
    LOGGER.debug("Deleting metadata for Object {} {}", user.getUserName(), AclClass.PIPELINE_USER);
    metadataManager.deleteMetadata(new EntityVO(user.getId(), AclClass.PIPELINE_USER));
}
Also used : EntityVO(com.epam.pipeline.controller.vo.EntityVO) AfterReturning(org.aspectj.lang.annotation.AfterReturning) Transactional(org.springframework.transaction.annotation.Transactional)

Example 9 with EntityVO

use of com.epam.pipeline.controller.vo.EntityVO in project cloud-pipeline by epam.

the class IssueDaoTest method testLoadAndDeleteAllIssuesForEntity.

@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Throwable.class)
public void testLoadAndDeleteAllIssuesForEntity() {
    EntityVO entity = new EntityVO(ENTITY_ID, ENTITY_CLASS);
    Issue issue = getIssue(NAME, entity);
    issueDao.createIssue(issue);
    Issue issue2 = getIssue(NAME2, entity);
    issueDao.createIssue(issue2);
    // load
    List<Issue> actualIssues = issueDao.loadIssuesForEntity(entity);
    assertEquals(2, actualIssues.size());
    List<Issue> expectedIssues = Stream.of(issue, issue2).collect(Collectors.toList());
    Map<Long, Issue> expectedMap = expectedIssues.stream().collect(Collectors.toMap(Issue::getId, Function.identity()));
    actualIssues.forEach(i -> verifyIssue(expectedMap.get(i.getId()), i));
    // delete
    issueDao.deleteIssuesForEntity(entity);
    actualIssues = issueDao.loadIssuesForEntity(entity);
    assertEquals(0, actualIssues.size());
}
Also used : EntityVO(com.epam.pipeline.controller.vo.EntityVO) Issue(com.epam.pipeline.entity.issue.Issue) Test(org.junit.Test) AbstractSpringTest(com.epam.pipeline.AbstractSpringTest) Transactional(org.springframework.transaction.annotation.Transactional)

Example 10 with EntityVO

use of com.epam.pipeline.controller.vo.EntityVO in project cloud-pipeline by epam.

the class IssueCommentDaoTest method createIssue.

private Issue createIssue(String name) {
    EntityVO entityVO = new EntityVO(ENTITY_ID, ENTITY_CLASS);
    Issue issue = new Issue();
    issue.setName(name);
    issue.setAuthor(ISSUE_AUTHOR);
    issue.setEntity(entityVO);
    issue.setText(ISSUE_TEXT);
    issueDao.createIssue(issue);
    return issue;
}
Also used : EntityVO(com.epam.pipeline.controller.vo.EntityVO) Issue(com.epam.pipeline.entity.issue.Issue)

Aggregations

EntityVO (com.epam.pipeline.controller.vo.EntityVO)40 Transactional (org.springframework.transaction.annotation.Transactional)22 AbstractSpringTest (com.epam.pipeline.AbstractSpringTest)14 Test (org.junit.Test)14 Folder (com.epam.pipeline.entity.pipeline.Folder)13 MetadataEntry (com.epam.pipeline.entity.metadata.MetadataEntry)12 Issue (com.epam.pipeline.entity.issue.Issue)11 PipeConfValue (com.epam.pipeline.entity.metadata.PipeConfValue)8 HashMap (java.util.HashMap)5 IssueVO (com.epam.pipeline.controller.vo.IssueVO)4 AbstractDataStorage (com.epam.pipeline.entity.datastorage.AbstractDataStorage)4 Before (org.junit.Before)4 Attachment (com.epam.pipeline.entity.issue.Attachment)3 AclClass (com.epam.pipeline.entity.security.acl.AclClass)3 Date (java.util.Date)3 Map (java.util.Map)3 AfterReturning (org.aspectj.lang.annotation.AfterReturning)3 MetadataVO (com.epam.pipeline.controller.vo.MetadataVO)2 MetadataEntityVO (com.epam.pipeline.controller.vo.metadata.MetadataEntityVO)2 IssueComment (com.epam.pipeline.entity.issue.IssueComment)2