use of org.finos.waltz.model.measurable_rating_replacement.MeasurableRatingReplacement in project waltz by khartec.
the class MeasurableRatingReplacementService method save.
public Set<MeasurableRatingReplacement> save(long decommId, EntityReference entityReference, Date commissionDate, String username) {
Tuple2<Operation, Boolean> operation = measurableRatingReplacementDao.save(decommId, entityReference, commissionDate, username);
MeasurableRatingReplacement measurableRatingReplacement = measurableRatingReplacementDao.fetchByDecommissionIdAndEntityRef(decommId, entityReference);
MeasurableRatingPlannedDecommission plannedDecomm = measurableRatingPlannedDecommissionDao.getById(decommId);
if (!operation.v2) {
throw new UpdateFailedException("REPLACEMENT_SAVE_FAILED", format("Failed to store measurable rating replacement %s:%d for entity %s:%d and measurable %d", measurableRatingReplacement.entityReference().kind(), measurableRatingReplacement.entityReference().id(), plannedDecomm.entityReference().kind(), plannedDecomm.entityReference().id(), plannedDecomm.measurableId()));
} else {
changeLogService.writeChangeLogEntries(measurableRatingReplacement, username, format("%s with planned commission date: %s", (operation.v1.equals(Operation.ADD) ? "Added" : "Updated"), commissionDate), operation.v1);
return measurableRatingReplacementDao.fetchByDecommissionId(decommId);
}
}
use of org.finos.waltz.model.measurable_rating_replacement.MeasurableRatingReplacement in project waltz by khartec.
the class ChangeLogService method writeChangeLogEntries.
public void writeChangeLogEntries(EntityReference ref, String userId, String postamble, Operation operation) {
switch(ref.kind()) {
case PHYSICAL_FLOW:
PhysicalFlow physicalFlow = physicalFlowDao.getById(ref.id());
writeChangeLogEntries(physicalFlow, userId, postamble, operation);
break;
case LOGICAL_DATA_FLOW:
LogicalFlow logicalFlow = logicalFlowDao.getByFlowId(ref.id());
writeChangeLogEntries(logicalFlow, userId, postamble, operation);
break;
case MEASURABLE_RATING_REPLACEMENT:
MeasurableRatingReplacement measurableRatingReplacement = measurableRatingReplacementdao.getById(ref.id());
writeChangeLogEntries(measurableRatingReplacement, userId, postamble, operation);
break;
case MEASURABLE_RATING_PLANNED_DECOMMISSION:
MeasurableRatingPlannedDecommission measurableRatingPlannedDecommission = measurableRatingPlannedDecommissionDao.getById(ref.id());
writeChangeLogEntries(measurableRatingPlannedDecommission, userId, postamble, operation);
default:
}
}
Aggregations