hierarchical-validation-baseline #59
@ -3,6 +3,7 @@ package net.hostsharing.hsadminng.hs.office.coopassets;
|
|||||||
import net.hostsharing.hsadminng.context.Context;
|
import net.hostsharing.hsadminng.context.Context;
|
||||||
import net.hostsharing.hsadminng.hs.office.generated.api.v1.api.HsOfficeCoopAssetsApi;
|
import net.hostsharing.hsadminng.hs.office.generated.api.v1.api.HsOfficeCoopAssetsApi;
|
||||||
import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.*;
|
import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.*;
|
||||||
|
import net.hostsharing.hsadminng.hs.validation.MultiValidationException;
|
||||||
import net.hostsharing.hsadminng.mapper.Mapper;
|
import net.hostsharing.hsadminng.mapper.Mapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
@ -97,9 +98,7 @@ public class HsOfficeCoopAssetsTransactionController implements HsOfficeCoopAsse
|
|||||||
validateDebitTransaction(requestBody, violations);
|
validateDebitTransaction(requestBody, violations);
|
||||||
validateCreditTransaction(requestBody, violations);
|
validateCreditTransaction(requestBody, violations);
|
||||||
validateAssetValue(requestBody, violations);
|
validateAssetValue(requestBody, violations);
|
||||||
if (violations.size() > 0) {
|
MultiValidationException.throwInvalid(violations);
|
||||||
throw new ValidationException("[" + join(",\n", violations) + "]"); // FIXME: move the join into an exception subclass
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void validateDebitTransaction(
|
private static void validateDebitTransaction(
|
||||||
|
@ -5,6 +5,7 @@ import net.hostsharing.hsadminng.context.Context;
|
|||||||
import net.hostsharing.hsadminng.hs.office.generated.api.v1.api.HsOfficeCoopSharesApi;
|
import net.hostsharing.hsadminng.hs.office.generated.api.v1.api.HsOfficeCoopSharesApi;
|
||||||
import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeCoopSharesTransactionInsertResource;
|
import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeCoopSharesTransactionInsertResource;
|
||||||
import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeCoopSharesTransactionResource;
|
import net.hostsharing.hsadminng.hs.office.generated.api.v1.model.HsOfficeCoopSharesTransactionResource;
|
||||||
|
import net.hostsharing.hsadminng.hs.validation.MultiValidationException;
|
||||||
import net.hostsharing.hsadminng.mapper.Mapper;
|
import net.hostsharing.hsadminng.mapper.Mapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
@ -99,9 +100,7 @@ public class HsOfficeCoopSharesTransactionController implements HsOfficeCoopShar
|
|||||||
validateSubscriptionTransaction(requestBody, violations);
|
validateSubscriptionTransaction(requestBody, violations);
|
||||||
validateCancellationTransaction(requestBody, violations);
|
validateCancellationTransaction(requestBody, violations);
|
||||||
validateshareCount(requestBody, violations);
|
validateshareCount(requestBody, violations);
|
||||||
if (violations.size() > 0) {
|
MultiValidationException.throwInvalid(violations);
|
||||||
throw new ValidationException("[" + join(",\n", violations) + "]"); // FIXME: move the join into an exception subclass
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void validateSubscriptionTransaction(
|
private static void validateSubscriptionTransaction(
|
||||||
|
Loading…
Reference in New Issue
Block a user