Search in sources :

Example 1 with CustomEnvironment

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;
}
Also used : ImmutableChangeLog(org.finos.waltz.model.changelog.ImmutableChangeLog) ChangeLog(org.finos.waltz.model.changelog.ChangeLog) CustomEnvironment(org.finos.waltz.model.custom_environment.CustomEnvironment)

Example 2 with CustomEnvironment

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;
}
Also used : CustomEnvironmentUsageInfo(org.finos.waltz.model.custom_environment.CustomEnvironmentUsageInfo) ImmutableChangeLog(org.finos.waltz.model.changelog.ImmutableChangeLog) ChangeLog(org.finos.waltz.model.changelog.ChangeLog) CustomEnvironment(org.finos.waltz.model.custom_environment.CustomEnvironment)

Example 3 with CustomEnvironment

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;
}
Also used : CustomEnvironmentUsageInfo(org.finos.waltz.model.custom_environment.CustomEnvironmentUsageInfo) ImmutableChangeLog(org.finos.waltz.model.changelog.ImmutableChangeLog) ChangeLog(org.finos.waltz.model.changelog.ChangeLog) CustomEnvironment(org.finos.waltz.model.custom_environment.CustomEnvironment)

Aggregations

ChangeLog (org.finos.waltz.model.changelog.ChangeLog)3 ImmutableChangeLog (org.finos.waltz.model.changelog.ImmutableChangeLog)3 CustomEnvironment (org.finos.waltz.model.custom_environment.CustomEnvironment)3 CustomEnvironmentUsageInfo (org.finos.waltz.model.custom_environment.CustomEnvironmentUsageInfo)2