Search in sources :

Example 16 with ChangeLog

use of org.finos.waltz.model.changelog.ChangeLog in project waltz by khartec.

the class ExternalIdentifierService method logChange.

private void logChange(String userId, EntityReference ref, String message, Operation operation) {
    ChangeLog logEntry = ImmutableChangeLog.builder().parentReference(ref).message(message).severity(Severity.INFORMATION).userId(userId).operation(operation).build();
    changeLogService.write(logEntry);
}
Also used : ImmutableChangeLog(org.finos.waltz.model.changelog.ImmutableChangeLog) ChangeLog(org.finos.waltz.model.changelog.ChangeLog)

Example 17 with ChangeLog

use of org.finos.waltz.model.changelog.ChangeLog 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 18 with ChangeLog

use of org.finos.waltz.model.changelog.ChangeLog 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)18 ImmutableChangeLog (org.finos.waltz.model.changelog.ImmutableChangeLog)18 String.format (java.lang.String.format)3 java.util (java.util)3 Collectors (java.util.stream.Collectors)3 Checks.checkNotNull (org.finos.waltz.common.Checks.checkNotNull)3 org.finos.waltz.model (org.finos.waltz.model)3 EntityReference.mkRef (org.finos.waltz.model.EntityReference.mkRef)3 CustomEnvironment (org.finos.waltz.model.custom_environment.CustomEnvironment)3 ChangeLogService (org.finos.waltz.service.changelog.ChangeLogService)3 Autowired (org.springframework.beans.factory.annotation.Autowired)3 Service (org.springframework.stereotype.Service)3 MapUtilities (org.finos.waltz.common.MapUtilities)2 StringUtilities (org.finos.waltz.common.StringUtilities)2 GenericSelector (org.finos.waltz.data.GenericSelector)2 GenericSelectorFactory (org.finos.waltz.data.GenericSelectorFactory)2 AssessmentDefinitionDao (org.finos.waltz.data.assessment_definition.AssessmentDefinitionDao)2 AssessmentRatingDao (org.finos.waltz.data.assessment_rating.AssessmentRatingDao)2 RatingSchemeDAO (org.finos.waltz.data.rating_scheme.RatingSchemeDAO)2 AssessmentDefinition (org.finos.waltz.model.assessment_definition.AssessmentDefinition)2