use of org.finos.waltz.model.custom_environment.CustomEnvironmentUsageInfo 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.CustomEnvironmentUsageInfo 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