use of org.finos.waltz.model.custom_environment.CustomEnvironment in project waltz by khartec.
the class CustomEnvironmentService method remove.
public Boolean remove(Long envId, String username) throws InsufficientPrivelegeException {
CustomEnvironment env = customEnvironmentDao.getById(envId);
ensureUserHasPermission(env, username, Operation.REMOVE);
boolean removed = customEnvironmentDao.remove(envId);
if (removed) {
String message = format("Deleted custom environment: %s/%s and any mappings to assets", env.groupName(), env.name());
ChangeLog changeLog = mkChangeLog(env.owningEntity(), username, message, Operation.REMOVE);
changeLogService.write(changeLog);
}
return removed;
}
use of org.finos.waltz.model.custom_environment.CustomEnvironment in project waltz by khartec.
the class CustomEnvironmentUsageService method addAsset.
public Long addAsset(CustomEnvironmentUsage usage, String username) throws InsufficientPrivelegeException {
CustomEnvironment customEnvironment = customEnvironmentService.getById(usage.customEnvironmentId());
ensureUserHasPermission(customEnvironment, username, Operation.ADD);
Long usageId = customEnvironmentUsageDao.addAsset(usage, username);
CustomEnvironmentUsageInfo usageInfo = customEnvironmentUsageDao.getUsageInfoById(usageId);
String message = format("Added asset: %s to custom environment: %s/%s", pretty(usageInfo.asset().entityReference()), customEnvironment.groupName(), customEnvironment.name());
ChangeLog changeLog = mkChangeLog(customEnvironment.owningEntity(), username, message, Operation.ADD);
changeLogService.write(changeLog);
return usageId;
}
use of org.finos.waltz.model.custom_environment.CustomEnvironment in project waltz by khartec.
the class CustomEnvironmentUsageService method remove.
public Boolean remove(Long usageId, String username) throws InsufficientPrivelegeException {
CustomEnvironmentUsageInfo usageInfo = customEnvironmentUsageDao.getUsageInfoById(usageId);
CustomEnvironment customEnvironment = customEnvironmentService.getById(usageInfo.usage().customEnvironmentId());
ensureUserHasPermission(customEnvironment, username, Operation.REMOVE);
boolean remove = customEnvironmentUsageDao.remove(usageId);
if (remove) {
String message = format("Removed asset: %s from custom environment: %s/%s", pretty(usageInfo.asset().entityReference()), customEnvironment.groupName(), customEnvironment.name());
ChangeLog changeLog = mkChangeLog(customEnvironment.owningEntity(), username, message, Operation.REMOVE);
changeLogService.write(changeLog);
}
return remove;
}
Aggregations