use of com.epam.pipeline.entity.pipeline.ToolGroup in project cloud-pipeline by epam.
the class ToolGroupManager method loadToolsWithIssuesCount.
public ToolGroupWithIssues loadToolsWithIssuesCount(Long id) {
ToolGroup group = toolGroupDao.loadToolGroup(id).orElseThrow(() -> new IllegalArgumentException(messageHelper.getMessage(MessageConstants.ERROR_TOOL_GROUP_NOT_FOUND, id)));
group.setPrivateGroup(group.getName().equalsIgnoreCase(makePrivateGroupName()));
ToolGroupWithIssues groupWithIssues = toolGroupWithIssuesMapper.toToolGroupWithIssues(group);
groupWithIssues.setToolsWithIssues(toolManager.loadToolsWithIssuesCountByGroup(id));
return groupWithIssues;
}
use of com.epam.pipeline.entity.pipeline.ToolGroup in project cloud-pipeline by epam.
the class ToolGroupManager method load.
/**
* Loads a ToolGroup with nested Tools
* @param id ID of the group
* @return a ToolGroup with nested Tools
*/
@Override
public ToolGroup load(Long id) {
ToolGroup group = toolGroupDao.loadToolGroup(id).orElseThrow(() -> new IllegalArgumentException(messageHelper.getMessage(MessageConstants.ERROR_TOOL_GROUP_NOT_FOUND, id)));
group.setTools(toolManager.loadToolsByGroup(group.getId()));
group.setPrivateGroup(group.getName().equalsIgnoreCase(makePrivateGroupName()));
return group;
}
use of com.epam.pipeline.entity.pipeline.ToolGroup in project cloud-pipeline by epam.
the class ToolGroupManager method changeOwner.
@Override
@Transactional(propagation = Propagation.REQUIRED)
public ToolGroup changeOwner(Long id, String owner) {
ToolGroup group = load(id);
group.setOwner(owner);
toolGroupDao.updateToolGroup(group);
return group;
}
use of com.epam.pipeline.entity.pipeline.ToolGroup in project cloud-pipeline by epam.
the class DockerRegistryDaoTest method createToolGroup.
private ToolGroup createToolGroup(DockerRegistry created) {
ToolGroup group = new ToolGroup();
group.setRegistryId(created.getId());
group.setParent(created);
group.setOwner(TEST_USER);
group.setName(TOOL_GROUP_NAME);
group.setDescription(TOOL_GROUP_DESCRIPTION);
return group;
}
use of com.epam.pipeline.entity.pipeline.ToolGroup in project cloud-pipeline by epam.
the class DockerRegistryDaoTest method initTestHierarchy.
private List<DockerRegistry> initTestHierarchy() {
DockerRegistry createdRegistry = new DockerRegistry();
createdRegistry.setPath(REGISTRY_PATH);
createdRegistry.setOwner(TEST_USER);
registryDao.createDockerRegistry(createdRegistry);
DockerRegistry createdRegistry2 = new DockerRegistry();
createdRegistry2.setPath(ANOTHER_REGISTRY_PATH);
createdRegistry2.setOwner(TEST_USER);
registryDao.createDockerRegistry(createdRegistry2);
ToolGroup library = createToolGroup(createdRegistry);
ToolGroup library2 = createToolGroup(createdRegistry2);
toolGroupDao.createToolGroup(library);
toolGroupDao.createToolGroup(library2);
createdRegistry.setGroups(Collections.singletonList(library));
createdRegistry2.setGroups(Collections.singletonList(library2));
Tool tool = createTool(TOOL_IMAGE, createdRegistry.getId(), library);
toolDao.createTool(tool);
library.setTools(Collections.singletonList(tool));
createdRegistry.setTools(Collections.singletonList(tool));
Tool tool2 = createTool(ANOTHER_TOOL_IMAGE, createdRegistry2.getId(), library2);
toolDao.createTool(tool2);
library2.setTools(Collections.singletonList(tool2));
return Arrays.asList(createdRegistry, createdRegistry2);
}
Aggregations