Java 类org.hibernate.validator.constraints.NotEmpty 实例源码

项目:rebase-server    文件:AuthorizationResource.java   
@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();
    }
}
项目:admin-shiro    文件:QuartzCtl.java   
@ResponseBody
@RequestMapping(value = "job/{id}/{opType}", method = RequestMethod.PUT)
public ResponseDTO runNow(@PathVariable @NotEmpty String id, @PathVariable @NotEmpty String opType) {
    try {

        logger.info("请求参数:{}, {}", id, opType);
        //立即执行
        if (Objects.equals(opType, "1")) {
            jobDetailService.runNow(Integer.parseInt(id));
        } else if (Objects.equals(opType, "2")) {//暂停
            jobDetailService.stopNow(Integer.parseInt(id));
        } else if (Objects.equals(opType, "3")) {//恢复
            jobDetailService.resumeNow(Integer.parseInt(id));
        } else {
            return new ResponseDTO(0, "failed", null);
        }
    }catch (Exception e){
        e.printStackTrace();
    }
    return new ResponseDTO(1, "", null);
}
项目:oma-riista-web    文件:JpaModelTest.java   
@Test
public void primitiveTypesShouldNotBeAnnotatedWithNotNullOrEmpty() {
    final Stream<Field> failedFields = filterFieldsOfManagedJpaTypes(field -> {
        final boolean notNull = field.isAnnotationPresent(NotNull.class);
        final boolean notEmpty = field.isAnnotationPresent(NotEmpty.class);
        final boolean notBlank = field.isAnnotationPresent(NotBlank.class);

        final boolean notNullOrEmpty = notNull || notEmpty || notBlank;
        final boolean isPrimitive = field.getType().isPrimitive();

        return isPrimitive && notNullOrEmpty;
    });

    assertNoFields(failedFields,
            "Primitive entity fields should not be annotated with @NotNull, @NotEmpty or @NotBlank:\n" +
                    "  These fields fail: ");
}
项目:graylog-plugin-collector    文件:CollectorConfigurationResource.java   
@PUT
@Path("/configurations/{id}/snippets/{snippet_id}")
@RequiresAuthentication
@RequiresPermissions(CollectorRestPermissions.COLLECTORS_UPDATE)
@ApiOperation(value = "Update a configuration snippet",
        notes = "This is a stateless method which updates a collector snippet")
@ApiResponses(value = {
        @ApiResponse(code = 400, message = "The supplied request is not valid.")
})
@AuditEvent(type = CollectorAuditEventTypes.SNIPPET_UPDATE)
public Response updateSnippet(@ApiParam(name = "id", required = true)
                              @PathParam("id") @NotEmpty String id,
                              @ApiParam(name = "snippet_id", required = true)
                              @PathParam("snippet_id") @NotEmpty String snippetId,
                              @ApiParam(name = "JSON body", required = true)
                              @Valid @NotNull CollectorConfigurationSnippet request) {
    etagService.invalidateAll();
    final CollectorConfiguration collectorConfiguration = collectorConfigurationService.updateSnippetFromRequest(id, snippetId, request);
    collectorConfigurationService.save(collectorConfiguration);

    return Response.accepted().build();
}
项目:graylog-plugin-collector    文件:CollectorConfigurationResource.java   
@POST
@Path("/configurations/{id}/inputs")
@RequiresAuthentication
@RequiresPermissions(CollectorRestPermissions.COLLECTORS_CREATE)
@ApiOperation(value = "Create a configuration input",
        notes = "This is a stateless method which inserts a collector input")
@ApiResponses(value = {
        @ApiResponse(code = 400, message = "The supplied request is not valid.")
})
@AuditEvent(type = CollectorAuditEventTypes.INPUT_CREATE)
public Response createInput(@ApiParam(name = "id", required = true)
                            @PathParam("id") @NotEmpty String id,
                            @ApiParam(name = "JSON body", required = true)
                            @Valid @NotNull CollectorInput request) {
    etagService.invalidateAll();
    final CollectorConfiguration collectorConfiguration = collectorConfigurationService.withInputFromRequest(id, request);
    collectorConfigurationService.save(collectorConfiguration);

    return Response.accepted().build();
}
项目:graylog-plugin-collector    文件:CollectorResource.java   
@GET
@Timed
@Path("/{collectorId}")
@ApiOperation(value = "Returns at most one collector summary for the specified collector id")
@ApiResponses(value = {
        @ApiResponse(code = 404, message = "No collector with the specified id exists")
})
@RequiresAuthentication
@RequiresPermissions(CollectorRestPermissions.COLLECTORS_READ)
public CollectorSummary get(@ApiParam(name = "collectorId", required = true)
                            @PathParam("collectorId") @NotEmpty String collectorId) {
    final Collector collector = collectorService.findById(collectorId);
    if (collector != null) {
        return collector.toSummary(lostCollectorFunction);
    } else {
        throw new NotFoundException("Collector <" + collectorId + "> not found!");
    }
}
项目:graylog-plugin-collector    文件:CollectorConfigurationResource.java   
@POST
@Path("/configurations/{id}/snippets")
@RequiresAuthentication
@RequiresPermissions(CollectorRestPermissions.COLLECTORS_CREATE)
@ApiOperation(value = "Create a configuration snippet",
        notes = "This is a stateless method which inserts a collector configuration snippet")
@ApiResponses(value = {
        @ApiResponse(code = 400, message = "The supplied request is not valid.")
})
@AuditEvent(type = CollectorAuditEventTypes.SNIPPET_CREATE)
public Response createSnippet(@ApiParam(name = "id", required = true)
                              @PathParam("id") @NotEmpty String id,
                              @ApiParam(name = "JSON body", required = true)
                              @Valid @NotNull CollectorConfigurationSnippet request) {
    etagService.invalidateAll();
    final CollectorConfiguration collectorConfiguration = collectorConfigurationService.withSnippetFromRequest(id, request);
    collectorConfigurationService.save(collectorConfiguration);

    return Response.accepted().build();
}
项目:graylog-plugin-collector    文件:CollectorConfigurationResource.java   
@POST
@Path("/configurations/{id}/outputs")
@RequiresAuthentication
@RequiresPermissions(CollectorRestPermissions.COLLECTORS_CREATE)
@ApiOperation(value = "Create a configuration output",
        notes = "This is a stateless method which inserts a collector output")
@ApiResponses(value = {
        @ApiResponse(code = 400, message = "The supplied request is not valid.")
})
@AuditEvent(type = CollectorAuditEventTypes.OUTPUT_CREATE)
public Response createOutput(@ApiParam(name = "id", required = true)
                             @PathParam("id") @NotEmpty String id,
                             @ApiParam(name = "JSON body", required = true)
                             @Valid @NotNull CollectorOutput request) {
    etagService.invalidateAll();
    final CollectorConfiguration collectorConfiguration = collectorConfigurationService.withOutputFromRequest(id, request);
    collectorConfigurationService.save(collectorConfiguration);

    return Response.accepted().build();
}
项目:rebase-server    文件:LicenseV2Resource.java   
@POST @Path("{_id}")
@Produces(MediaType.APPLICATION_JSON)
public Response active(@PathParam("_id") String id, @NotEmpty @QueryParam("device_id") String deviceId) {
    if (!ObjectId.isValid(id)) {
        return Responses.notFound("激活码无效");
    }
    Document license = MongoDBs.licenses().find(eq(License._ID, objectId(id))).first();
    RebaseAsserts.notNull(license, "license");
    if (!Objects.equals(deviceId, license.getString(License.DEVICE_ID))) {
        final Bson target = eq(License._ID, objectId(id));
        MongoDBs.licenses().updateOne(target, set(License.DEVICE_ID, deviceId));
        license.put(License.DEVICE_ID, deviceId);
    }
    return Response.ok(license).build();
}
项目:admin-shiro    文件:QuartzCtl.java   
@ResponseBody
@RequestMapping(value = "job/{id}", method = RequestMethod.DELETE)
public ResponseDTO del(@PathVariable @NotEmpty String id) {
    logger.info("请求参数:{}", id);
    //立即执行
    jobDetailService.delJob(Integer.parseInt(id));
    return new ResponseDTO(1, "", null);
}
项目:gitplex-mit    文件:TokenGenerateBean.java   
@Editable(order=100, description="Input password of this user")
@CurrentPassword
@Password
@NotEmpty
public String getPassword() {
    return password;
}
项目:gitplex-mit    文件:PasswordEditBean.java   
@Editable(order=100)
@CurrentPassword
@Password
@NotEmpty
public String getOldPassword() {
    return oldPassword;
}
项目:gitplex-mit    文件:ActiveDirectoryAuthenticator.java   
@Editable(order=100, name="LDAP URL", description=
    "Specifies LDAP URL of the Active Directory server, for example: <i>ldap://ad-server</i>, or <i>ldaps://ad-server</i>")
   @NotEmpty
@Override
public String getLdapUrl() {
    return super.getLdapUrl();
}
项目:gitplex-mit    文件:ActiveDirectoryAuthenticator.java   
@Editable(order=500, description=
    "Specifies the base node for user search. For example: <i>cn=Users, dc=example, dc=com</i>")
@NotEmpty
@Override
public String getUserSearchBase() {
    return super.getUserSearchBase();
}
项目:gitplex-mit    文件:SearchGroupsUsingFilter.java   
@Editable(order=100, description=
    "In case user group relationship maintained at group side, this property specifies " +
    "base node for group search. For example: <i>ou=groups, dc=example, dc=com</i>")
@NotEmpty
public String getGroupSearchBase() {
    return groupSearchBase;
}
项目:gitplex-mit    文件:SearchGroupsUsingFilter.java   
@Editable(order=200, description=""
        + "In case user group relationship maintained at group side, this filter is used to determine belonging "
        + "groups of current user. For example: <i>(&(uniqueMember={0})(objectclass=groupOfUniqueNames))</i>. In "
        + "this example, <i>{0}</i> represents DN of current user")
@NotEmpty
public String getGroupSearchFilter() {
    return groupSearchFilter;
}
项目:gitplex-mit    文件:SearchGroupsUsingFilter.java   
@Editable(order=300, description=""
        + "Specifies the attribute containing group name inside the found group LDAP entry. Value of this attribute "
        + "will be mapped to a GitPlex group. This attribute is normally set to <i>cn</i>")
@NotEmpty
public String getGroupNameAttribute() {
    return groupNameAttribute;
}
项目:gitplex-mit    文件:GetGroupsUsingAttribute.java   
@Editable(order=100, description=""
        + "Specifies name of the attribute inside the user LDAP entry whose value contains distinguished names of "
        + "belonging groups. For instance some LDAP servers uses attribute <i>memberOf</i> to list groups")
   @NotEmpty
public String getUserGroupsAttribute() {
    return userGroupsAttribute;
}
项目:gitplex-mit    文件:GetGroupsUsingAttribute.java   
@Editable(order=200, description=""
        + "Specifies the attribute containing group name inside the found group LDAP entry. Value of this attribute "
        + "will be mapped to a GitPlex group. This attribute is normally set to <i>cn</i>")
@NotEmpty
public String getGroupNameAttribute() {
    return groupNameAttribute;
}
项目:gitplex-mit    文件:LdapAuthenticator.java   
@Editable(order=300, description=""
        + "To authenticate user against LDAP and retrieve associated attributes and groups, GitPlex would have to "
        + "first authenticate itself against the LDAP server and GitPlex does that by sending 'manager' DN and "
        + "password")
@NotEmpty
public String getManagerDN() {
    return managerDN;
}
项目:gitplex-mit    文件:LdapAuthenticator.java   
@Editable(order=600, description=
         "This filter is used to determine the LDAP entry for current user. " + 
         "For example: <i>(&(uid={0})(objectclass=person))</i>. In this example, " +
         "<i>{0}</i> represents login name of current user.")
@NotEmpty
public String getUserSearchFilter() {
    return userSearchFilter;
}
项目:gitplex-mit    文件:BranchProtection.java   
@Editable(order=100, description="Specify branch to be protected. Wildcard may be used to "
        + "specify multiple branches")
@BranchPattern
@NotEmpty
public String getBranch() {
    return branch;
}
项目:gitplex-mit    文件:FileProtection.java   
@Editable(order=100, description="Specify path to be protected. Wildcard can be used in the path "
        + "to match multiple files")
@PathPattern
@NotEmpty
public String getPath() {
    return path;
}
项目:gitplex-mit    文件:FileProtection.java   
@Editable(order=200, name="Reviewers", description="Optionally specify required reviewers if specified path is "
        + "changed. Note that the user submitting the change is considered to reviewed the change automatically")
@com.gitplex.server.util.editable.annotation.ReviewAppointment
@NotEmpty
public String getReviewAppointmentExpr() {
    return reviewAppointmentExpr;
}
项目:gitplex-mit    文件:MailSetting.java   
@Editable(order=100, name="SMTP Host", description=
    "Specify the SMTP mail host used by GitPlex to send email."
    )
@NotEmpty
public String getSmtpHost() {
    return smtpHost;
}
项目:gitplex-mit    文件:BackupSetting.java   
@Editable(order=100, name="Backup Schedule", description=
    "Optionally specify a cron expression to schedule database auto-backup. The cron expression format is " +
    "<em>&lt;seconds&gt; &lt;minutes&gt; &lt;hours&gt; &lt;day-of-month&gt; &lt;month&gt; &lt;day-of-week&gt;</em>." +
    "For example, <em>0 0 1 * * ?</em> means 1:00am every day. For details of the format, refer " +
    "to <a href='http://www.quartz-scheduler.org/documentation/quartz-2.x/tutorials/tutorial-lesson-06'>Quartz tutorial</a>." + 
    "The backup files will be placed into <em>backup</em> folder under GitPlex " +
    "installation directory. Leave this property empty if you do not want to enable database " +
    "auto backup.")
@NotEmpty
public String getSchedule() {
    return schedule;
}
项目:gitplex-mit    文件:BackupSetting.java   
@Editable(order=200, name="Backup Directory", description=
    "Specify the directory to which the auto backup files will be stored. Non-absolute path " +
    "will be considered to be relative to installation directory of GitPlex.")
@Directory(absolute=true, outsideOfInstallDir=true, writeable=true)
@NotEmpty
public String getFolder() {
    return folder;
}
项目:gitplex-mit    文件:CommitMessageTransformSetting.java   
@Editable(order=200, description="Specify replacement for above matches, for the example "
        + "issue key pattern above, you may use <tt>&lt;a href='http://track.example.com/browse/$1'&gt;$1&lt;/a&gt;</tt> to "
        + "replace issue keys with issue links. Here <tt>$n</tt> represents nth capturing group in <tt>search for</tt> "
        + "pattern")
@NotEmpty
public String getReplaceWith() {
    return replaceWith;
}
项目:gitplex-mit    文件:User.java   
@Editable(order=150, autocomplete="new-password")
@Password(confirmative=true)
@JsonView(DefaultView.class)
@NotEmpty
public String getPassword() {
    return password;
}
项目:my-paper    文件:OrderItem.java   
/**
 * 获取商品编号
 * 
 * @return 商品编号
 */
@JsonProperty
@NotEmpty
@Column(nullable = false, updatable = false)
public String getSn() {
    return sn;
}
项目:my-paper    文件:Member.java   
/**
 * 获取用户名
 * 
 * @return 用户名
 */
@NotEmpty(groups = Save.class)
@Pattern(regexp = "^[0-9a-z_A-Z\\u4e00-\\u9fa5]+$")
@Column(nullable = false, updatable = false, unique = true, length = 100)
public String getUsername() {
    return username;
}
项目:my-paper    文件:Member.java   
/**
 * 获取密码
 * 
 * @return 密码
 */
@NotEmpty(groups = Save.class)
@Pattern(regexp = "^[^\\s&\"<>]+$")
@Column(nullable = false)
public String getPassword() {
    return password;
}
项目:graylog-plugin-collector    文件:CollectorConfigurationResource.java   
@GET
@Path("/configurations/{id}")
@RequiresAuthentication
@RequiresPermissions(CollectorRestPermissions.COLLECTORS_READ)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Show collector configuration details")
public CollectorConfiguration getConfigurations(@ApiParam(name = "id", required = true)
                                                @PathParam("id") @NotEmpty String id) {
    return this.collectorConfigurationService.findById(id);
}
项目:my-paper    文件:Ad.java   
/**
 * 获取标题
 * 
 * @return 标题
 */
@NotEmpty
@Length(max = 200)
@Column(nullable = false)
public String getTitle() {
    return title;
}
项目:my-paper    文件:ParameterGroup.java   
/**
 * 获取名称
 * 
 * @return 名称
 */
@JsonProperty
@NotEmpty
@Length(max = 200)
@Column(nullable = false)
public String getName() {
    return name;
}
项目:my-paper    文件:Order.java   
/**
 * 获取收货人
 * 
 * @return 收货人
 */
@NotEmpty
@Length(max = 200)
@Column(nullable = false)
public String getConsignee() {
    return consignee;
}
项目:my-paper    文件:Order.java   
/**
 * 获取邮编
 * 
 * @return 邮编
 */
@NotEmpty
@Length(max = 200)
@Column(nullable = false)
public String getZipCode() {
    return zipCode;
}
项目:my-paper    文件:Order.java   
/**
 * 获取电话
 * 
 * @return 电话
 */
@NotEmpty
@Length(max = 200)
@Column(nullable = false)
public String getPhone() {
    return phone;
}
项目:my-paper    文件:Order.java   
/**
 * 获取订单项
 * 
 * @return 订单项
 */
@Valid
@NotEmpty
@OneToMany(mappedBy = "order", fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true)
@OrderBy("isGift asc")
public List<OrderItem> getOrderItems() {
    return orderItems;
}