Java Examples for org.hibernate.validator.constraints.NotEmpty
The following java examples will help you to understand the usage of org.hibernate.validator.constraints.NotEmpty. These source code samples are taken from different open source projects.
Example 1
Project: framework-master File: NotEmptyTest.java View source code |
@Override
public Class<?> loadClass(String name) throws ClassNotFoundException {
String vaadinPackagePrefix = getClass().getPackage().getName();
vaadinPackagePrefix = vaadinPackagePrefix.substring(0, vaadinPackagePrefix.lastIndexOf('.'));
if (name.equals(UnitTest.class.getName())) {
super.loadClass(name);
} else if (name.startsWith(NotEmpty.class.getPackage().getName())) {
throw new ClassNotFoundException();
} else if (name.startsWith(vaadinPackagePrefix)) {
String path = name.replace('.', '/').concat(".class");
URL resource = Thread.currentThread().getContextClassLoader().getResource(path);
InputStream stream;
try {
stream = resource.openStream();
byte[] bytes = IOUtils.toByteArray(stream);
return defineClass(name, bytes, 0, bytes.length);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return super.loadClass(name);
}
Example 2
Project: vaadin-master File: NotEmptyTest.java View source code |
@Override
public Class<?> loadClass(String name) throws ClassNotFoundException {
String vaadinPackagePrefix = getClass().getPackage().getName();
vaadinPackagePrefix = vaadinPackagePrefix.substring(0, vaadinPackagePrefix.lastIndexOf('.'));
if (name.equals(UnitTest.class.getName())) {
super.loadClass(name);
} else if (name.startsWith(NotEmpty.class.getPackage().getName())) {
throw new ClassNotFoundException();
} else if (name.startsWith(vaadinPackagePrefix)) {
String path = name.replace('.', '/').concat(".class");
URL resource = Thread.currentThread().getContextClassLoader().getResource(path);
InputStream stream;
try {
stream = resource.openStream();
byte[] bytes = IOUtils.toByteArray(stream);
return defineClass(name, bytes, 0, bytes.length);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return super.loadClass(name);
}
Example 3
Project: JMobster-master File: NotEmptyValidatorTest.java View source code |
@Test
public void testWrite_JavaScript() throws Exception {
NotEmptyValidator validator = new NotEmptyValidator();
JavaScriptContext context = mockWriter(OutputMode.JAVASCRIPT);
validator.setItemStatus(ItemStatuses.last());
validator.setContext(context);
validator.write(mock(NotEmpty.class));
context.getWriter().close();
assertThat(context.getWriter().toString(), is("required: true\n"));
}
Example 4
Project: spring-webmvc-dynamiclogging-master File: MDCFilterController.java View source code |
@RequestMapping(value = "/1.0/admin/logging/mdc/_add", method = RequestMethod.GET) @ResponseBody public Object addFilter(@NotEmpty(message = "You must specify a 'key' param") @RequestParam(required = false) String key, @NotEmpty(message = "You must specify a 'value' param") @RequestParam(required = false) String value, @RequestParam(required = false, defaultValue = "trace") String level) { LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); for (TurboFilter filter : context.getTurboFilterList()) { if (DynamicMDCFilter.class.equals(filter.getClass())) { ((DynamicMDCFilter) filter).addMDCMatch(key, value, level); return ((DynamicMDCFilter) filter).getRegisteredFilters(); } } return "DynamicMDCFilter not configured. Please check logback.xml."; }
Example 5
Project: swagger-core-master File: BeanValidator.java View source code |
@Override
public Property resolveProperty(Type type, ModelConverterContext context, Annotation[] annotations, Iterator<ModelConverter> chain) {
Map<String, Annotation> annos = new HashMap<String, Annotation>();
if (annotations != null) {
for (Annotation anno : annotations) {
annos.put(anno.annotationType().getName(), anno);
}
}
Property property = null;
if (chain.hasNext()) {
property = chain.next().resolveProperty(type, context, annotations, chain);
}
if (property != null) {
if (annos.containsKey("org.hibernate.validator.constraints.NotEmpty")) {
property.setRequired(true);
if (property instanceof StringProperty) {
((StringProperty) property).minLength(1);
} else if (property instanceof ArrayProperty) {
((ArrayProperty) property).setMinItems(1);
}
}
if (annos.containsKey("org.hibernate.validator.constraints.NotBlank")) {
property.setRequired(true);
if (property instanceof StringProperty) {
((StringProperty) property).minLength(1);
}
}
if (annos.containsKey("org.hibernate.validator.constraints.Range")) {
if (property instanceof AbstractNumericProperty) {
Range range = (Range) annos.get("org.hibernate.validator.constraints.Range");
AbstractNumericProperty ap = (AbstractNumericProperty) property;
ap.setMinimum(new BigDecimal(range.min()));
ap.setMaximum(new BigDecimal(range.max()));
}
}
if (annos.containsKey("org.hibernate.validator.constraints.Length")) {
if (property instanceof StringProperty) {
Length length = (Length) annos.get("org.hibernate.validator.constraints.Length");
StringProperty sp = (StringProperty) property;
sp.minLength(new Integer(length.min()));
sp.maxLength(new Integer(length.max()));
}
}
if (annos.containsKey("org.hibernate.validator.constraints.Email")) {
if (property instanceof StringProperty) {
EmailProperty sp = new EmailProperty((StringProperty) property);
property = sp;
}
}
return property;
}
return super.resolveProperty(type, context, annotations, chain);
}
Example 6
Project: cyclop-master File: JsonMarshaller.java View source code |
@NotNull
public <T> T unmarshal(@NotNull Class<T> clazz, @NotNull @NotEmpty String input) {
T unmarshalObj;
try {
unmarshalObj = objectMapper.get().readValue(input, clazz);
} catch (IOException e) {
throw new ServiceException("Got IOException during json unmarshalling: " + e.getMessage() + " - input:'" + input + "'", e);
}
LOG.trace("Unmarshaled JSON from {} to {}", input, unmarshalObj);
return unmarshalObj;
}
Example 7
Project: graylog2-server-master File: LookupTableResource.java View source code |
@GET
@Path("tables/{idOrName}")
@ApiOperation(value = "Retrieve the named lookup table")
public LookupTablePage get(@ApiParam(name = "idOrName") @PathParam("idOrName") @NotEmpty String idOrName, @ApiParam(name = "resolve") @QueryParam("resolve") @DefaultValue("false") boolean resolveObjects) {
Optional<LookupTableDto> lookupTableDto = lookupTableService.get(idOrName);
if (!lookupTableDto.isPresent()) {
throw new NotFoundException();
}
LookupTableDto tableDto = lookupTableDto.get();
Set<CacheApi> caches = Collections.emptySet();
Set<DataAdapterApi> adapters = Collections.emptySet();
if (resolveObjects) {
caches = cacheService.findByIds(Collections.singleton(tableDto.cacheId())).stream().map(CacheApi::fromDto).collect(Collectors.toSet());
adapters = adapterService.findByIds(Collections.singleton(tableDto.dataAdapterId())).stream().map(DataAdapterApi::fromDto).collect(Collectors.toSet());
}
final PaginatedList<LookupTableApi> result = PaginatedList.singleton(LookupTableApi.fromDto(tableDto), 1, 1);
return new LookupTablePage(null, result.pagination(), result, caches, adapters);
}
Example 8
Project: rebase-server-master File: AuthorizationResource.java View source code |
@GET
@Path("{username}")
@Produces(MediaType.APPLICATION_JSON)
public Response authorize(@Username @PathParam("username") String username, @NotEmpty @QueryParam("password") String password) {
Bson filter = and(eq(User.USERNAME, username), eq(User.PASSWORD, Hashes.sha1(password)));
Document newAuth = Authorizations.newInstance(username);
Document user = MongoDBs.users().findOneAndUpdate(filter, set(User.AUTHORIZATION, newAuth));
if (user == null) {
return Response.status(FORBIDDEN).entity(new Failure("The username or password is incorrect")).build();
} else {
return Response.ok(newAuth).build();
}
}
Example 9
Project: alien4cloud-master File: OrchestratorController.java View source code |
@ApiOperation(value = "Update the name of an existing orchestrators.", authorizations = { @Authorization("ADMIN") }) @RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE) @PreAuthorize("hasAuthority('ADMIN')") @Audit public RestResponse<Void> update(@ApiParam(value = "Id of the orchestrators to update.", required = true) @PathVariable @Valid @NotEmpty String id, @ApiParam(value = "Orchestrator update request, representing the fields to updates and their new values.", required = true) @Valid @NotEmpty @RequestBody UpdateOrchestratorRequest request) { Orchestrator orchestrator = orchestratorService.getOrFail(id); String currentName = orchestrator.getName(); ReflectionUtil.mergeObject(request, orchestrator); orchestratorService.ensureNameUnicityAndSave(orchestrator, currentName); return RestResponseBuilder.<Void>builder().build(); }
Example 10
Project: hibernate-validator-master File: BootstrappingTest.java View source code |
@Test
public void testCustomConstraintValidatorFactory() {
Configuration<?> configuration = Validation.byDefaultProvider().configure();
assertDefaultBuilderAndFactory(configuration);
ValidatorFactory factory = configuration.buildValidatorFactory();
Validator validator = factory.getValidator();
Customer customer = new Customer();
customer.setFirstName("John");
Set<ConstraintViolation<Customer>> constraintViolations = validator.validate(customer);
assertNumberOfViolations(constraintViolations, 1);
assertCorrectConstraintTypes(constraintViolations, NotEmpty.class);
assertCorrectPropertyPaths(constraintViolations, "lastName");
// get a new factory using a custom configuration
configuration = Validation.byDefaultProvider().configure();
configuration.constraintValidatorFactory(new ConstraintValidatorFactory() {
@Override
public <T extends ConstraintValidator<?, ?>> T getInstance(Class<T> key) {
if (key == NotNullValidator.class) {
return (T) new BadlyBehavedNotNullConstraintValidator();
}
return new ConstraintValidatorFactoryImpl().getInstance(key);
}
@Override
public void releaseInstance(ConstraintValidator<?, ?> instance) {
}
});
factory = configuration.buildValidatorFactory();
validator = factory.getValidator();
constraintViolations = validator.validate(customer);
assertNumberOfViolations(constraintViolations, 0);
}
Example 11
Project: keywhiz-master File: SecretDeliveryResource.java View source code |
/**
* Retrieve Secret by name
*
* @excludeParams client
* @param secretName the name of the Secret to retrieve
*
* @description Returns a single Secret if found
* @responseMessage 200 Found and retrieved Secret with given name
* @responseMessage 403 Secret is not assigned to Client
* @responseMessage 404 Secret with given name not found
* @responseMessage 500 Secret response could not be generated for given Secret
*/
@Timed
@ExceptionMetered
@GET
public SecretDeliveryResponse getSecret(@NotEmpty @PathParam("secretName") String secretName, @Auth Client client) {
Optional<SanitizedSecret> sanitizedSecret = aclDAO.getSanitizedSecretFor(client, secretName);
Optional<Secret> secret = secretController.getSecretByName(secretName);
if (!sanitizedSecret.isPresent()) {
boolean clientExists = clientDAO.getClient(client.getName()).isPresent();
boolean secretExists = secret.isPresent();
if (clientExists && secretExists) {
throw new ForbiddenException(format("Access denied: %s at '%s' by '%s'", client.getName(), "/secret/" + secretName, client));
} else {
if (clientExists) {
logger.info("Client {} requested unknown secret {}", client.getName(), secretName);
}
throw new NotFoundException();
}
}
logger.info("Client {} granted access to {}.", client.getName(), secretName);
try {
return SecretDeliveryResponse.fromSecret(secret.get());
} catch (IllegalArgumentException e) {
logger.error(format("Failed creating response for secret %s", secretName), e);
throw new InternalServerErrorException();
}
}
Example 12
Project: mybatis-generator-gui-master File: DbRemarksCommentGenerator.java View source code |
public void addJavaFileComment(CompilationUnit compilationUnit) {
// add no file level comments by default
if (isAnnotations) {
compilationUnit.addImportedType(new FullyQualifiedJavaType("javax.persistence.Table"));
compilationUnit.addImportedType(new FullyQualifiedJavaType("javax.persistence.Id"));
compilationUnit.addImportedType(new FullyQualifiedJavaType("javax.persistence.Column"));
compilationUnit.addImportedType(new FullyQualifiedJavaType("javax.persistence.GeneratedValue"));
compilationUnit.addImportedType(new FullyQualifiedJavaType("org.hibernate.validator.constraints.NotEmpty"));
}
}
Example 13
Project: mystamps-master File: WhenAnyUserAtAnyPageWithForm.java View source code |
protected void emptyValueShouldBeForbiddenForRequiredFields() {
List<Field> requiredFields = page.getForm().getRequiredFields();
if (requiredFields.isEmpty()) {
return;
}
page.submit();
for (Field field : requiredFields) {
assertThat(page.getFieldError(field.getId())).overridingErrorMessage(String.format("required field with id '%s' should not accept empty value", field.getId())).isEqualTo(tr("org.hibernate.validator.constraints.NotEmpty.message"));
}
}
Example 14
Project: Restfull-Pickelink-Angular.js-master File: RegistrationService.java View source code |
@POST
@Path("/activation")
@Produces(MediaType.APPLICATION_JSON)
public Response activateAccount(@NotNull @NotEmpty String activationCode) {
MessageBuilder message;
try {
Token token = this.identityModelManager.activateAccount(activationCode);
message = MessageBuilder.ok().token(token.getToken());
} catch (Exception e) {
message = MessageBuilder.badRequest().message(e.getMessage());
}
return message.build();
}
Example 15
Project: civilization-boardgame-rest-master File: GameResource.java View source code |
/**
* Will return a list of all the players of this PBF.
* Handy for selecting players whom to trade with. Will remove the current user from the list
*/
@GET
@Path("/{pbfId}/players")
public Response getAllPlayersForPBF(@NotEmpty @PathParam("pbfId") String pbfId, @Auth(required = false) Player player) {
GameAction gameAction = new GameAction(db);
List<PlayerDTO> players = gameAction.getAllPlayers(pbfId);
if (player != null) {
return Response.ok().entity(players.stream().filter( p -> !p.getPlayerId().equals(player.getId())).collect(toList())).build();
}
return Response.ok().entity(players).build();
}
Example 16
Project: gy-phonegap-build-master File: ApplicationResource.java View source code |
@GET
@Path("/{id}/install")
@Produces({ BuiltType.Constants.ANDROID_MIME_TYPE, BuiltType.Constants.IOS_MIME_TYPE })
public Response getWithQrKey(@PathParam("id") Long id, @NotEmpty @QueryParam("qrkey") String qrKey, @Context HttpServletRequest httpServletRequest, @Context HttpServletResponse httpServletResponse) throws IOException {
ApplicationBuilt latestBuilt = service.getLatestBuilt(id);
UserAgent userAgent = getUserAgent(httpServletRequest);
Device currentDevice = deviceResolver.resolveDevice(httpServletRequest);
LOGGER.info("userAgent:{} and device:{}", userAgent, currentDevice);
boolean knownFamily = userAgent != null && (userAgent.getOperatingSystem().getFamily().equals(OperatingSystemFamily.ANDROID) || userAgent.getOperatingSystem().getFamily().equals(OperatingSystemFamily.IOS));
knownFamily = knownFamily && currentDevice != null && (currentDevice.isMobile() || currentDevice.isTablet());
if (latestBuilt.getApplication().getQrKey().equalsIgnoreCase(qrKey) && knownFamily) {
try {
return getBuiltAssetInternal(httpServletResponse, BuiltType.getValueOfIgnoreCase(userAgent.getOperatingSystem().getFamily().getName()), latestBuilt);
} catch (IllegalArgumentException e) {
return Response.status(404).build();
}
} else {
return Response.status(404).build();
}
}
Example 17
Project: head-master File: UserFormBean.java View source code |
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "REC_CATCH_EXCEPTION", justification = "should be the exception thrown by jodatime but not sure what it is right now.")
public void validateEnterUserDetailsStep(ValidationContext context) {
MessageContext messages = context.getMessageContext();
validator.validate(this, messages);
try {
this.dateOfBirth = new DateTime().withDate(this.dateOfBirthYear.intValue(), this.dateOfBirthMonth.intValue(), this.dateOfBirthDay.intValue());
} catch (Exception e) {
messages.addMessage(new MessageBuilder().error().source("dateOfBrith").code("NotValid.UserFormBean.dateOfBrith").defaultText("dateOfBirth is not valid").build());
}
try {
this.passwordExpirationDate = new DateTime().withDate(this.passwordExpirationDateYear.intValue(), this.passwordExpirationDateMonth.intValue(), this.passwordExpirationDateDay.intValue());
} catch (Exception e) {
messages.addMessage(new MessageBuilder().error().source("passwordExpirationDate").code("NotValid.UserFormBean.passwordExpirationDate").defaultText("Password expiration date is not valid").build());
}
try {
this.mfiJoiningDate = new DateTime().withDate(this.mfiJoiningDateYear.intValue(), this.mfiJoiningDateMonth.intValue(), this.mfiJoiningDateDay.intValue());
} catch (Exception e) {
messages.addMessage(new MessageBuilder().error().source("mfiJoiningDate").code("NotValid.UserFormBean.mfiJoiningDate").defaultText("mfiJoiningDate is not valid").build());
}
if (this.password.trim().isEmpty() || this.confirmedPassword.trim().isEmpty()) {
messages.addMessage(new MessageBuilder().error().source("password").code("NotEmpty.UserFormBean.password").defaultText("password is not correct.").build());
} else if (this.password.trim().length() < 6) {
messages.addMessage(new MessageBuilder().error().source("password").code("Min.UserFormBean.password").defaultText("password must have six characters at least.").build());
} else if (!this.password.equals(this.confirmedPassword)) {
messages.addMessage(new MessageBuilder().error().source("password").code("NotEqual.UserFormBean.password").defaultText("password is not correct.").build());
}
this.address.validate(messages, "UserFormBean");
// validate additional fields
for (CustomFieldDto additionalField : this.customFields) {
switch(additionalField.getFieldType().intValue()) {
case 0:
break;
case 1:
validateNumericField(messages, additionalField);
break;
case 2:
validateIfMandatoryField(messages, additionalField);
break;
case 3:
for (DateFieldBean dateFieldBean : this.customDateFields) {
if (dateFieldBean.getId().equals(additionalField.getFieldId())) {
validateAndBindDateField(messages, additionalField, dateFieldBean);
}
}
break;
default:
break;
}
}
if (messages.hasErrorMessages()) {
this.prepateForReEdit();
}
}
Example 18
Project: jsondoc-master File: JSONDocHibernateValidatorProcessor.java View source code |
public static void processHibernateValidatorAnnotations(Field field, ApiObjectFieldDoc apiPojoFieldDoc) {
try {
Class.forName("org.hibernate.validator.constraints.NotBlank");
if (field.isAnnotationPresent(AssertFalse.class)) {
apiPojoFieldDoc.addFormat(AssertFalse_message);
}
if (field.isAnnotationPresent(AssertTrue.class)) {
apiPojoFieldDoc.addFormat(AssertTrue_message);
}
if (field.isAnnotationPresent(NotNull.class)) {
apiPojoFieldDoc.addFormat(NotNull_message);
}
if (field.isAnnotationPresent(Null.class)) {
apiPojoFieldDoc.addFormat(Null_message);
}
if (field.isAnnotationPresent(Size.class)) {
Size annotation = field.getAnnotation(Size.class);
apiPojoFieldDoc.addFormat(String.format(Size_message, annotation.min(), annotation.max()));
}
if (field.isAnnotationPresent(NotBlank.class)) {
apiPojoFieldDoc.addFormat(NotBlank_message);
}
if (field.isAnnotationPresent(NotEmpty.class)) {
apiPojoFieldDoc.addFormat(NotEmpty_message);
}
if (field.isAnnotationPresent(Length.class)) {
Length annotation = field.getAnnotation(Length.class);
apiPojoFieldDoc.addFormat(String.format(Length_message, annotation.min(), annotation.max()));
}
if (field.isAnnotationPresent(Range.class)) {
Range annotation = field.getAnnotation(Range.class);
apiPojoFieldDoc.addFormat(String.format(Range_message, annotation.min(), annotation.max()));
}
if (field.isAnnotationPresent(DecimalMax.class)) {
DecimalMax annotation = field.getAnnotation(DecimalMax.class);
apiPojoFieldDoc.addFormat(String.format(DecimalMax_message, annotation.inclusive() ? "or equal to" : "", annotation.value()));
}
if (field.isAnnotationPresent(DecimalMin.class)) {
DecimalMin annotation = field.getAnnotation(DecimalMin.class);
apiPojoFieldDoc.addFormat(String.format(DecimalMin_message, annotation.inclusive() ? "or equal to" : "", annotation.value()));
}
if (field.isAnnotationPresent(Future.class)) {
apiPojoFieldDoc.addFormat(Future_message);
}
if (field.isAnnotationPresent(Past.class)) {
apiPojoFieldDoc.addFormat(Past_message);
}
if (field.isAnnotationPresent(Digits.class)) {
Digits annotation = field.getAnnotation(Digits.class);
apiPojoFieldDoc.addFormat(String.format(Digits_message, annotation.integer(), annotation.fraction()));
}
if (field.isAnnotationPresent(Max.class)) {
Max annotation = field.getAnnotation(Max.class);
apiPojoFieldDoc.addFormat(String.format(Max_message, annotation.value()));
}
if (field.isAnnotationPresent(Min.class)) {
Min annotation = field.getAnnotation(Min.class);
apiPojoFieldDoc.addFormat(String.format(Min_message, annotation.value()));
}
if (field.isAnnotationPresent(Pattern.class)) {
Pattern annotation = field.getAnnotation(Pattern.class);
apiPojoFieldDoc.addFormat(String.format(Pattern_message, annotation.regexp()));
}
if (field.isAnnotationPresent(Email.class)) {
apiPojoFieldDoc.addFormat(Email_message);
}
if (field.isAnnotationPresent(URL.class)) {
apiPojoFieldDoc.addFormat(URL_message);
}
if (field.isAnnotationPresent(CreditCardNumber.class)) {
apiPojoFieldDoc.addFormat(CreditCardNumber_message);
}
} catch (ClassNotFoundException e) {
}
}
Example 19
Project: kie-wb-common-master File: NestedFormBackendFormRenderingContextManagerTest.java View source code |
@Test
public void testConstraintsExtraction() {
DynamicModelConstraints constraints = context.getRenderingContext().getModelConstraints().get(Person.class.getName());
assertNotNull("Constraints cannot be null", constraints);
assertFalse("There should be field constraints", constraints.getFieldConstraints().isEmpty());
assertEquals("There should be 3 constraints", 3, constraints.getFieldConstraints().size());
testFieldAnnotation(constraints, "id", Min.class.getName(), Max.class.getName());
testFieldAnnotation(constraints, "name", NotNull.class.getName(), NotEmpty.class.getName());
testFieldAnnotation(constraints, "birthday", NotNull.class.getName());
}
Example 20
Project: mifos-head-master File: UserFormBean.java View source code |
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "REC_CATCH_EXCEPTION", justification = "should be the exception thrown by jodatime but not sure what it is right now.")
public void validateEnterUserDetailsStep(ValidationContext context) {
MessageContext messages = context.getMessageContext();
validator.validate(this, messages);
try {
this.dateOfBirth = new DateTime().withDate(this.dateOfBirthYear.intValue(), this.dateOfBirthMonth.intValue(), this.dateOfBirthDay.intValue());
} catch (Exception e) {
messages.addMessage(new MessageBuilder().error().source("dateOfBrith").code("NotValid.UserFormBean.dateOfBrith").defaultText("dateOfBirth is not valid").build());
}
try {
this.passwordExpirationDate = new DateTime().withDate(this.passwordExpirationDateYear.intValue(), this.passwordExpirationDateMonth.intValue(), this.passwordExpirationDateDay.intValue());
} catch (Exception e) {
messages.addMessage(new MessageBuilder().error().source("passwordExpirationDate").code("NotValid.UserFormBean.passwordExpirationDate").defaultText("Password expiration date is not valid").build());
}
try {
this.mfiJoiningDate = new DateTime().withDate(this.mfiJoiningDateYear.intValue(), this.mfiJoiningDateMonth.intValue(), this.mfiJoiningDateDay.intValue());
} catch (Exception e) {
messages.addMessage(new MessageBuilder().error().source("mfiJoiningDate").code("NotValid.UserFormBean.mfiJoiningDate").defaultText("mfiJoiningDate is not valid").build());
}
if (this.password.trim().isEmpty() || this.confirmedPassword.trim().isEmpty()) {
messages.addMessage(new MessageBuilder().error().source("password").code("NotEmpty.UserFormBean.password").defaultText("password is not correct.").build());
} else if (this.password.trim().length() < 6) {
messages.addMessage(new MessageBuilder().error().source("password").code("Min.UserFormBean.password").defaultText("password must have six characters at least.").build());
} else if (!this.password.equals(this.confirmedPassword)) {
messages.addMessage(new MessageBuilder().error().source("password").code("NotEqual.UserFormBean.password").defaultText("password is not correct.").build());
}
this.address.validate(messages, "UserFormBean");
// validate additional fields
for (CustomFieldDto additionalField : this.customFields) {
switch(additionalField.getFieldType().intValue()) {
case 0:
break;
case 1:
validateNumericField(messages, additionalField);
break;
case 2:
validateIfMandatoryField(messages, additionalField);
break;
case 3:
for (DateFieldBean dateFieldBean : this.customDateFields) {
if (dateFieldBean.getId().equals(additionalField.getFieldId())) {
validateAndBindDateField(messages, additionalField, dateFieldBean);
}
}
break;
default:
break;
}
}
if (messages.hasErrorMessages()) {
this.prepateForReEdit();
}
}
Example 21
Project: Repository-master File: SecurityComponent.java View source code |
// FIXME: Move authenticate to session servlet @DirectMethod @Timed @ExceptionMetered @Validate public UserXO authenticate(@NotEmpty final String base64Username, @NotEmpty final String base64Password) throws Exception { Subject subject = securitySystem.getSubject(); // FIXME: Subject is not nullable, but we have code that checks for nulls, likely from testing setups, verify and simplify checkState(subject != null); try { subject.login(new UsernamePasswordToken(Strings2.decodeBase64(base64Username), Strings2.decodeBase64(base64Password), false)); } catch (Exception e) { throw new Exception("Authentication failed", e); } return getUser(); }
Example 22
Project: wicket-crudifier-master File: ListControlGroups.java View source code |
@Override
protected void onInitialize() {
super.onInitialize();
Class<?> modelClass = getModel().getObject().getClass();
Set<String> properties = getPropertiesByOrder(modelClass);
Validator validator = HibernateValidatorProperty.validatorFactory.getValidator();
BeanDescriptor constraintDescriptors = validator.getConstraintsForClass(modelClass);
for (String property : properties) {
PropertyDescriptor descriptor;
try {
descriptor = PropertyUtils.getPropertyDescriptor(getModel().getObject(), property);
} catch (Exception e) {
throw new RuntimeException("error getting property " + property, e);
}
boolean required = false;
ElementDescriptor constraintDescriptor = constraintDescriptors.getConstraintsForProperty(descriptor.getName());
if (constraintDescriptor != null) {
Set<ConstraintDescriptor<?>> constraintsSet = constraintDescriptor.getConstraintDescriptors();
for (ConstraintDescriptor<?> constraint : constraintsSet) {
if (constraint.getAnnotation() instanceof NotNull || constraint.getAnnotation() instanceof NotEmpty || constraint.getAnnotation() instanceof NotBlank)
required = true;
}
}
objectProperties.add(new ObjectProperties(descriptor, required));
}
RepeatingView view = new RepeatingView("controlGroup");
for (ObjectProperties objectProperty : objectProperties) {
try {
AbstractControlGroup<?> controlGroup;
if (!controlGroupProviders.containsKey(objectProperty.type)) {
Constructor<?> constructor;
Class<? extends Panel> typesControlGroup = getControlGroupByType(objectProperty.type);
if (typesControlGroup == null) {
if (objectProperty.type.isEnum())
typesControlGroup = EnumControlGroup.class;
else
typesControlGroup = ObjectChoiceControlGroup.class;
}
constructor = typesControlGroup.getConstructor(String.class, IModel.class);
controlGroup = (AbstractControlGroup<?>) constructor.newInstance(view.newChildId(), new PropertyModel<Object>(ListControlGroups.this.getModel(), objectProperty.name));
controlGroup.init(objectProperty.name, getResourceBase(), objectProperty.required, objectProperty.type, entitySettings);
controlGroup.setEnabled(objectProperty.enabled);
if (typesControlGroup == ObjectChoiceControlGroup.class) {
IObjectRenderer<?> renderer = renderers.get(objectProperty.type);
if (renderer == null) {
renderer = new IObjectRenderer<Object>() {
private static final long serialVersionUID = -6171655578529011405L;
public String render(Object object) {
return object.toString();
}
};
}
((ObjectChoiceControlGroup<?>) controlGroup).setConfiguration(getEntityProvider(objectProperty.name), renderer);
} else if (typesControlGroup == CollectionControlGroup.class) {
((CollectionControlGroup<?>) controlGroup).setConfiguration(getEntityProvider(objectProperty.name), renderers);
}
} else {
controlGroup = controlGroupProviders.get(objectProperty.type).createControlGroup(view.newChildId(), new PropertyModel<Object>(ListControlGroups.this.getModel(), objectProperty.name), objectProperty.name, getResourceBase(), objectProperty.required, objectProperty.type, entitySettings);
}
view.add(controlGroup);
fieldComponents.put(objectProperty.name, controlGroup);
} catch (SecurityException e) {
throw new RuntimeException(e);
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (InstantiationException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
throw new RuntimeException(e);
}
}
add(view);
}
Example 23
Project: cloud-rest-service-master File: ServiceDocBuilder.java View source code |
private JavaBeanDoc getJavaBeanDoc(String type) {
JavaClass javaClass = builder.getClassByName(type);
JavaField[] fields = javaClass.getFields();
JavaBeanDoc beanDoc = new JavaBeanDoc();
beanDoc.setName(javaClass.getFullyQualifiedName());
beanDoc.setDescription(javaClass.getComment());
for (JavaField field : fields) {
FieldDoc fieldDoc = new FieldDoc();
fieldDoc.setName(field.getName());
fieldDoc.setDataType(field.getType().getFullyQualifiedName());
fieldDoc.setDescription(field.getComment());
DocletTag tag = field.getTagByName("data");
if (tag != null)
fieldDoc.setExampleData(tag.getValue());
beanDoc.getFieldDocs().add(fieldDoc);
Annotation[] anns = field.getAnnotations();
for (Annotation ann : anns) {
String typeName = ann.getType().getFullyQualifiedName();
if (NotEmpty.class.getName().equals(typeName) || NotNull.class.getName().equals(typeName)) {
fieldDoc.setRequired(true);
break;
}
}
}
return beanDoc;
}
Example 24
Project: genie-master File: JpaCommandServiceImpl.java View source code |
/**
* {@inheritDoc}
*/
@Override
public void addApplicationsForCommand(@NotBlank(message = "No command id entered. Unable to add applications.") final String id, @NotEmpty(message = "No application ids entered. Unable to add applications.") final List<String> applicationIds) throws GenieException {
if (applicationIds.size() != applicationIds.stream().filter(this.appRepo::exists).count()) {
throw new GeniePreconditionException("All applications need to exist to add to a command");
}
final CommandEntity commandEntity = this.findCommand(id);
for (final String appId : applicationIds) {
commandEntity.addApplication(this.appRepo.findOne(appId));
}
}
Example 25
Project: lazydoc-master File: DataTypeParser.java View source code |
private boolean isFieldRequired(Field propertyField, PropertyDescription propertyDescription) {
if (propertyField != null && (propertyField.isAnnotationPresent(NotNull.class) || propertyField.isAnnotationPresent(NotEmpty.class) || propertyField.isAnnotationPresent(NotBlank.class))) {
return true;
}
if (propertyDescription != null) {
return propertyDescription.required();
}
return false;
}
Example 26
Project: podam-master File: TypeManufacturerUtil.java View source code |
/**
* It returns a {@link AttributeStrategy} if one was specified in
* annotations, or {@code null} otherwise.
*
* @param strategy
* The data provider strategy
* @param annotations
* The list of annotations, irrelevant annotations will be removed
* @param attributeType
* Type of attribute expected to be returned
* @return {@link AttributeStrategy}, if {@link PodamStrategyValue} or bean
* validation constraint annotation was found among annotations
* @throws IllegalAccessException
* if attribute strategy cannot be instantiated
* @throws InstantiationException
* if attribute strategy cannot be instantiated
* @throws SecurityException
* if access security is violated
* @throws InvocationTargetException
* if invocation failed
* @throws IllegalArgumentException
* if illegal argument provided to a constructor
*/
public static AttributeStrategy<?> findAttributeStrategy(DataProviderStrategy strategy, List<Annotation> annotations, Class<?> attributeType) throws InstantiationException, IllegalAccessException, SecurityException, IllegalArgumentException, InvocationTargetException {
Iterator<Annotation> iter = annotations.iterator();
while (iter.hasNext()) {
Annotation annotation = iter.next();
if (annotation instanceof PodamStrategyValue) {
PodamStrategyValue strategyAnnotation = (PodamStrategyValue) annotation;
return strategyAnnotation.value().newInstance();
}
/* Podam annotation is present, this will be handled later by type manufacturers */
if (annotation.annotationType().getAnnotation(PodamAnnotation.class) != null) {
return null;
}
/* Find real class out of proxy */
Class<? extends Annotation> annotationClass = annotation.getClass();
if (Proxy.isProxyClass(annotationClass)) {
Class<?>[] interfaces = annotationClass.getInterfaces();
if (interfaces.length == 1) {
@SuppressWarnings("unchecked") Class<? extends Annotation> tmp = (Class<? extends Annotation>) interfaces[0];
annotationClass = tmp;
}
}
Class<AttributeStrategy<?>> attrStrategyClass;
if ((attrStrategyClass = strategy.getStrategyForAnnotation(annotationClass)) != null) {
Constructor<AttributeStrategy<?>> ctor;
try {
ctor = attrStrategyClass.getConstructor(Annotation.class);
return ctor.newInstance(annotation);
} catch (NoSuchMethodException e) {
return attrStrategyClass.newInstance();
}
}
if (annotation.annotationType().getAnnotation(Constraint.class) != null) {
if (annotation instanceof NotNull || annotation.annotationType().getName().equals("org.hibernate.validator.constraints.NotEmpty") || annotation.annotationType().getName().equals("org.hibernate.validator.constraints.NotBlank")) {
/* We don't need to do anything for NotNull constraint */
iter.remove();
} else if (!NotNull.class.getPackage().equals(annotationClass.getPackage())) {
LOG.warn("Please, register AttributeStratergy for custom " + "constraint {}, in DataProviderStrategy! Value " + "will be left to null", annotation);
}
} else {
iter.remove();
}
}
AttributeStrategy<?> retValue = null;
if (!annotations.isEmpty() && !Collection.class.isAssignableFrom(attributeType) && !Map.class.isAssignableFrom(attributeType) && !attributeType.isArray()) {
retValue = new BeanValidationStrategy(annotations, attributeType);
}
return retValue;
}
Example 27
Project: XPages-Scaffolding-master File: ComponentMap.java View source code |
@SuppressWarnings({ "rawtypes", "unchecked" })
private void attachConverterAndValidators(final UIComponent component, final ComponentMapAdapter adapter, final Object property, final ResourceBundle translation) {
UIInput input = (UIInput) component;
/* ******************************************************************************
* Add support based on constraints
********************************************************************************/
Set<ConstraintDescriptor<?>> constraints = adapter.getConstraintDescriptors(property);
if (!constraints.isEmpty()) {
boolean required = false;
for (ConstraintDescriptor<?> desc : constraints) {
// First, add basic required support
Object annotation = desc.getAnnotation();
if (annotation instanceof NotNull || annotation instanceof NotEmpty) {
required = true;
break;
} else if (annotation instanceof Size && ((Size) annotation).min() > 0) {
required = true;
}
}
if (required) {
input.setRequired(true);
}
// Now, add arbitrary validators
Validator validator = adapter.createValidator(property);
if (validator != null) {
input.addValidator(validator);
}
}
/* ******************************************************************************
* Add support based on the property type
********************************************************************************/
Type valueType = adapter.getGenericType(property);
// Determine if we're dealing with a Collection or not
Type baseType;
if (valueType instanceof ParameterizedType) {
ParameterizedType ptype = (ParameterizedType) valueType;
if (Collection.class.isAssignableFrom((Class<?>) ptype.getRawType())) {
baseType = ptype.getActualTypeArguments()[0];
} else {
baseType = valueType;
}
} else {
baseType = valueType;
}
// Add selectItems for single-value enums
if (baseType instanceof Class && ((Class<?>) baseType).isEnum()) {
Class<? extends Enum> enumType = (Class<? extends Enum>) baseType;
if (input.getConverter() == null) {
input.setConverter(new EnumBindingConverter(enumType));
}
// Look for select items in its children
List<UIComponent> children = input.getChildren();
boolean hasSelectItems = false;
for (UIComponent child : children) {
if (child instanceof UISelectItem || child instanceof UISelectItems) {
hasSelectItems = true;
break;
}
}
if (!hasSelectItems) {
if (input instanceof UISelectOne || input instanceof UISelectMany) {
if (input instanceof UISelectOneMenu) {
addEmptySelectItem(component, enumType, translation);
}
populateEnumSelectItems(input, enumType, translation);
}
}
} else if (Boolean.class.equals(baseType) || Boolean.TYPE.equals(baseType)) {
// Do the same for booleans
UISelectItem itemTrue = new UISelectItem();
itemTrue.setItemValue(Boolean.TRUE);
UISelectItem itemFalse = new UISelectItem();
itemFalse.setItemValue(Boolean.FALSE);
if (translation != null) {
String trueKey = adapter.getObject().getClass().getName() + "." + property + ".true";
try {
itemTrue.setItemLabel(translation.getString(trueKey));
} catch (Exception e) {
try {
itemTrue.setItemLabel(translation.getString("true"));
} catch (Exception e2) {
itemTrue.setItemLabel("true");
}
}
String falseKey = adapter.getObject().getClass().getName() + "." + property + ".false";
try {
itemFalse.setItemLabel(translation.getString(falseKey));
} catch (Exception e) {
try {
itemFalse.setItemLabel(translation.getString("false"));
} catch (Exception e2) {
itemFalse.setItemLabel("false");
}
}
}
component.getChildren().add(itemTrue);
itemTrue.setParent(component);
component.getChildren().add(itemFalse);
itemFalse.setParent(component);
}
// Add a converter and helper for date/time fields
if (baseType.equals(Date.class)) {
if (input.getConverter() == null) {
DateTimeConverter converter = new DateTimeConverter();
converter.setType(DateTimeConverter.TYPE_BOTH);
input.setConverter(converter);
}
XspDateTimeHelper helper = new XspDateTimeHelper();
component.getChildren().add(helper);
helper.setParent(component);
} else if (baseType.equals(java.sql.Date.class)) {
if (input.getConverter() == null) {
DateTimeConverter converter = new DateTimeConverter();
converter.setType(DateTimeConverter.TYPE_DATE);
input.setConverter(converter);
}
XspDateTimeHelper helper = new XspDateTimeHelper();
component.getChildren().add(helper);
helper.setParent(component);
} else if (baseType.equals(java.sql.Time.class)) {
if (input.getConverter() == null) {
DateTimeConverter converter = new DateTimeConverter();
converter.setType(DateTimeConverter.TYPE_TIME);
input.setConverter(converter);
}
XspDateTimeHelper helper = new XspDateTimeHelper();
component.getChildren().add(helper);
helper.setParent(component);
}
}
Example 28
Project: biobank-master File: TestSite.java View source code |
@Test
public void saveNew() throws Exception {
// null name
siteSaveAction.setName(null);
try {
exec(siteSaveAction);
Assert.fail("should not be allowed to add site with no name");
} catch (ConstraintViolationException e) {
Assert.assertTrue(TestAction.contains(e, NotEmpty.class, Site.class, "getName"));
Assert.assertTrue(true);
}
// null short name
siteSaveAction.setName(name);
siteSaveAction.setNameShort(null);
try {
exec(siteSaveAction);
Assert.fail("should not be allowed to add site with no short name");
} catch (ConstraintViolationException e) {
Assert.assertTrue(true);
}
siteSaveAction.setNameShort(name);
siteSaveAction.setActivityStatus(null);
try {
exec(siteSaveAction);
Assert.fail("should not be allowed to add Site with no activity status");
} catch (ConstraintViolationException e) {
Assert.assertTrue(true);
}
siteSaveAction.setActivityStatus(ActivityStatus.ACTIVE);
siteSaveAction.setAddress(null);
try {
exec(siteSaveAction);
Assert.fail("should not be allowed to add site with no address");
} catch (ConstraintViolationException e) {
Assert.assertTrue(true);
}
// TODO: test invalid act status: 5, -1
Address address = new Address();
address.setCity(name);
siteSaveAction.setAddress(address);
Set<Integer> studyIds = new HashSet<Integer>();
studyIds.add(null);
siteSaveAction.setStudyIds(studyIds);
try {
exec(siteSaveAction);
Assert.fail("should not be allowed to add site with a null site id");
} catch (ModelNotFoundException e) {
Assert.assertTrue(true);
}
studyIds.clear();
studyIds.add(-1);
siteSaveAction.setStudyIds(studyIds);
try {
exec(siteSaveAction);
Assert.fail("should not be allowed to add site with an invalid site id");
} catch (ModelNotFoundException e) {
Assert.assertTrue(true);
}
// success path
siteSaveAction.setStudyIds(new HashSet<Integer>());
exec(siteSaveAction);
}
Example 29
Project: expressui-framework-master File: FormField.java View source code |
/**
* Initializes field to default settings.
*
* @param field Vaadin field to initialize
*/
public void initAbstractSelectDefaults(AbstractSelect field) {
Integer defaultSelectWidth = MainApplication.getInstance().applicationProperties.getDefaultSelectFieldWidth();
field.setWidth(defaultSelectWidth, Sizeable.UNITS_EM);
field.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY);
if (getBeanPropertyType().hasAnnotation(NotNull.class) || getBeanPropertyType().hasAnnotation(NotEmpty.class) || getBeanPropertyType().hasAnnotation(NotBlank.class)) {
field.setNullSelectionAllowed(false);
} else {
field.setNullSelectionAllowed(true);
}
field.setItemCaptionPropertyId(ReferenceEntity.DISPLAY_PROPERTY);
}
Example 30
Project: javaee7-developer-handbook-master File: Country.java View source code |
@NotEmpty
public String getISOName() {
return isoName;
}
Example 31
Project: PhotoAlbum-api-master File: AlbumRequest.java View source code |
@NotEmpty
@Length(max = 50)
public String getTitle() {
return this.title;
}
Example 32
Project: shopb2b-master File: Parameter.java View source code |
@JsonProperty
@NotEmpty
@Length(max = 200)
@Column(nullable = false)
public String getName() {
return this.name;
}
Example 33
Project: arquillian-examples-master File: HelloWorld.java View source code |
@NotNull
@NotEmpty
@Pattern(regexp = "[A-Za-z]*", message = "must contain only letters")
public String getLetters() {
return letters;
}
Example 34
Project: qalingo-engine-master File: EngineSettingValueForm.java View source code |
@NotEmpty(message = "error.form.engine.setting.id.is.empty")
public String getId() {
return id;
}
Example 35
Project: spring-boot-cf-service-broker-master File: ServiceInstanceBindingResponse.java View source code |
@NotEmpty
@JsonSerialize
@JsonProperty("credentials")
public Map<String, Object> getCredentials() {
return binding.getCredentials();
}
Example 36
Project: zk-master File: F00862BeanValidator4Form.java View source code |
// getter, setter //
@NotEmpty(message = "name can not be null")
public String getFirstName() {
return _firstName;
}
Example 37
Project: asta4d-master File: JobPosition.java View source code |
@NotEmpty
public String getName() {
return name;
}
Example 38
Project: budgetapp-master File: Category.java View source code |
@NotEmpty(message = "{validation.name.required}")
public String getName() {
return name;
}
Example 39
Project: corespring-master File: Persona.java View source code |
@NotEmpty
@Size(max = 60)
@Column(length = 60, nullable = false)
public String getNombre() {
return nombre;
}
Example 40
Project: hibernateuniversity-devoxx-master File: Country.java View source code |
@NotEmpty
public String getName() {
return name;
}
Example 41
Project: jstryker-master File: HibernateValidatorMatchers.java View source code |
public HibernateValidatorMatchers cannotBeEmpty() {
if (!getDeclaredField().isAnnotationPresent(NotEmpty.class)) {
String message = String.format("Field %s allow empty values.", field);
throw new AssertionError(message);
}
return this;
}
Example 42
Project: libreplan-master File: ConfigurationRolesLDAP.java View source code |
@NotEmpty(message = "role ldap not specified")
public String getRoleLdap() {
return roleLdap;
}
Example 43
Project: personal-master File: Category.java View source code |
@NotEmpty(message = "{validation.name.required}")
public String getName() {
return name;
}
Example 44
Project: richfaces-qa-master File: NotEmptyBean.java View source code |
@NotEmpty(message = VALIDATION_MSG)
@Override
public String getValue() {
return value;
}
Example 45
Project: shopizer-master File: ProductFiles.java View source code |
@NotEmpty(message = "{product.files.invalid}")
@Valid
public List<MultipartFile> getFile() {
return file;
}
Example 46
Project: spring-cloud-stream-modules-master File: GemfirePoolProperties.java View source code |
@NotEmpty
public InetSocketAddress[] getHostAddresses() {
return hostAddresses;
}
Example 47
Project: dev-examples-master File: Bean.java View source code |
@NotNull
@NotEmpty
@Digits(fraction = 0, integer = 2)
@Pattern(regexp = "^[0-9-]+$", message = "must contain only numbers")
public String getNumbers() {
return this.numbers;
}
Example 48
Project: dropwizard-master File: ConstraintViolationBenchmark.java View source code |
public String paramFunc(@HeaderParam("cheese") @NotEmpty String secretSauce) {
return secretSauce;
}
Example 49
Project: light-admin-master File: PersistentFieldMetadata.java View source code |
public boolean isRequired() {
return persistentProperty.isAnnotationPresent(NotNull.class) || persistentProperty.isAnnotationPresent(NotBlank.class) || persistentProperty.isAnnotationPresent(org.hibernate.validator.constraints.NotEmpty.class);
}
Example 50
Project: poulpe-master File: TopicType.java View source code |
/**
* Get the title of the TopicType.
* @return title
*/
@NotNull(message = TITLE_CANT_BE_VOID)
@NotEmpty(message = TITLE_CANT_BE_VOID)
@Length(min = 1, max = 254, message = ERROR_LABEL_SECTION_NAME_WRONG)
public String getTitle() {
return title;
}
Example 51
Project: spring-reference-master File: Order.java View source code |
@NotEmpty
@Email
public String getEmail() {
return email;
}
Example 52
Project: spring-xd-master File: ShellModuleOptionsMetadata.java View source code |
@NotEmpty
@NotNull
public String getCommand() {
return command;
}
Example 53
Project: springlab-master File: Address.java View source code |
// -- [city] ------------------------
@NotEmpty
@Size(max = 255)
@Column(name = "CITY", nullable = false)
public String getCity() {
return city;
}
Example 54
Project: torodb-master File: Replication.java View source code |
@Description("config.mongo.replication.replSetName")
@NotEmpty
@JsonProperty(required = true)
public String getReplSetName() {
return super.getReplSetName();
}
Example 55
Project: web-framework-master File: ConstraintViolationBenchmark.java View source code |
public String paramFunc(@HeaderParam("cheese") @NotEmpty String secretSauce) {
return secretSauce;
}
Example 56
Project: eMonocot-master File: Principal.java View source code |
/**
*
* @return The unique identifier of the object
*/
@NaturalId
@NotEmpty
public String getIdentifier() {
return identifier;
}
Example 57
Project: FXForm2-master File: Issue81Test.java View source code |
@NotEmpty
public String getProperty() {
return super.getProperty();
}
Example 58
Project: jcommune-master File: BranchDto.java View source code |
/**
* @return branch name
*/
@NotNull(message = BRANCH_CANT_BE_VOID)
@NotEmpty(message = BRANCH_CANT_BE_VOID)
@Size(max = Branch.BRANCH_NAME_MAX_LENGTH, message = BRANCH_NAME_ILLEGAL_LENGTH)
public String getName() {
return name;
}
Example 59
Project: jTalk-master File: BranchDto.java View source code |
/**
* @return branch name
*/
@NotNull(message = BRANCH_CANT_BE_VOID)
@NotEmpty(message = BRANCH_CANT_BE_VOID)
@Size(max = Branch.BRANCH_NAME_MAX_LENGTH, message = BRANCH_NAME_ILLEGAL_LENGTH)
public String getName() {
return name;
}
Example 60
Project: OpenESPI-Common-java-master File: ApplicationInformationTests.java View source code |
@Test
public void clientId() {
assertAnnotationPresent(ApplicationInformation.class, "clientId", NotEmpty.class);
assertSizeValidation(ApplicationInformation.class, "clientId", 2, 64);
}
Example 61
Project: richfaces-master File: Bean.java View source code |
@NotNull
@NotEmpty
@Digits(fraction = 0, integer = 2)
@Pattern(regexp = "^[0-9-]+$", message = "must contain only numbers")
public String getNumbers() {
return this.numbers;
}
Example 62
Project: testkata-master File: Booking.java View source code |
@NotEmpty
public String getCreditCard() {
return creditCard;
}
Example 63
Project: eGov-master File: NonSor.java View source code |
@NotEmpty(message = "nonsor.desc.empty")
@Length(max = 4000, message = "masters.description.length")
public String getDescription() {
return description;
}
Example 64
Project: randi2-master File: AbstractDomainObject.java View source code |
private boolean isRequired(Field field) {
return field.isAnnotationPresent(NotEmpty.class) || field.isAnnotationPresent(NotNull.class) || field.isAnnotationPresent(de.randi2.utility.validations.Password.class);
}
Example 65
Project: verbum-master File: Post.java View source code |
/**
* Returns the value of the <code>title</code> property.
*
* @return a {@link String}.
*/
@Column(nullable = false, length = 150)
@Length(min = 1, max = 150)
@NotEmpty
public String getTitle() {
return title;
}
Example 66
Project: myequivalents-master File: ProvenanceRegisterEntry.java View source code |
@NotEmpty
@Index(name = "prov_email")
@Column(name = "user_email", length = COL_LENGTH_S)
@XmlAttribute(name = "user-email")
public String getUserEmail() {
return userEmail;
}