Esta seção aborda capacidade e limitações da atual versão da arquitetura e utiliza-se da aplicação modelo (Shield) como exemplo.
<div class="inline-field-container"> <input type="text" class="field-short" tl-key="name" ng-model="model.name" /> </div> |
<div class="inline-field-container ng-scope"> <label>Name</label> <input type="text" class="field-medium ng-pristine ng-valid" tl-key="users.name" ng-model="model.0x1.name" id="model.window.users.name.1" /> <div class="description">User display name.</div> <div class="description" name="validation.name">May not be null.</div> </div> |
<div class="inline-field-container ng-scope"> <label>Name</label> <input type="text" class="field-medium ng-pristine ng-valid" tl-key="users.name" ng-model="model.0x1.name" id="model.window.users.name.1" /> </div> |
public interface IInjectable {
void foo();
}
public class Injectable extends IInjectable {
public void foo() {
System.out.println("foo");
}
}
public class Injected {
public Injected(IInjectable injectable) {
injectable.foo();
}
} |
/**
* Given an object of type T, apply default object validation backed by JSR311 API. If T is a valid object, then return it,
* otherwise throws {@link org.treelayer.commons.business.exception.BusinessException} containing a map of constraint violations
* as follows:
*
* <p>
* {@code
* { "exampleEntity.name" -> "javax.validation.NotNull.message", "exampleEntity.id" -> "javax.validation.NotNull.message" }
* }
* </p>
*
* @param model object of type T that will be validated
*
* @return validated object
*
* @throws org.treelayer.commons.business.exception.BusinessException if object is not valid
*/
private T applyDefaultValidation(T model) throws BusinessException {
Map<String, String> constraintViolations = validatorUtil.applyValidation(model);
if (constraintViolations.size() > 0) {
throw new BusinessException(HttpURLConnection.HTTP_BAD_REQUEST, constraintViolations);
} else {
return model;
}
} |
model.period.rule.values.1 = r|Revoked model.period.rule.values.2 = g|Granted |
