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;
}
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;
}
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));
}
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());
}
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;
}
Aggregations