当前位置: 首页>>代码示例>>Java>>正文


Java Parameters类代码示例

本文整理汇总了Java中enkan.collection.Parameters的典型用法代码示例。如果您正苦于以下问题:Java Parameters类的具体用法?Java Parameters怎么用?Java Parameters使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Parameters类属于enkan.collection包,在下文中一共展示了Parameters类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: edit

import enkan.collection.Parameters; //导入依赖的package包/类
@RolesAllowed({"MODIFY_GROUP", "MODIFY_ANY_GROUP"})
public HttpResponse edit(Parameters params) {
    GroupDao groupDao = daoProvider.getDao(GroupDao.class);
    Group group = groupDao.selectById(params.getLong("id"));
    GroupForm form = beansConverter.createFrom(group, GroupForm.class);

    UserDao userDao = daoProvider.getDao(UserDao.class);
    List<User> users = userDao.selectAll();

    List<Long> userIds = userDao.selectByGroupId(group.getId())
            .stream()
            .map(User::getId)
            .collect(Collectors.toList());

    return templateEngine.render("admin/group/edit",
            "group", form,
            "users", users,
            "userIds", userIds);
}
 
开发者ID:kawasima,项目名称:bouncr,代码行数:20,代码来源:GroupController.java

示例2: show

import enkan.collection.Parameters; //导入依赖的package包/类
@RolesAllowed({"LIST_USERS", "LIST_ANY_USERS"})
public HttpResponse show(UserPrincipal principal, Parameters params) {
    UserDao userDao = daoProvider.getDao(UserDao.class);
    User user = userDao.selectById(params.getLong("id"));
    boolean isLock = userDao.isLock(user.getAccount());

    UserProfileFieldDao userProfileFieldDao = daoProvider.getDao(UserProfileFieldDao.class);
    List<UserProfile> userProfiles = userProfileFieldDao.selectValuesByUserId(user.getId());

    GroupDao groupDao = daoProvider.getDao(GroupDao.class);
    List<Group> groups = groupDao.selectByUserId(user.getId());

    return templateEngine.render("admin/user/show",
            "user", user,
            "userProfiles", userProfiles,
            "groups", groups,
            "isLock", isLock);
}
 
开发者ID:kawasima,项目名称:bouncr,代码行数:19,代码来源:UserController.java

示例3: search

import enkan.collection.Parameters; //导入依赖的package包/类
@RolesAllowed({"LIST_USERS", "LIST_ANY_USERS"})
public List<User> search(Parameters params, UserPrincipal principal) {
    String word = params.get("q");
    UserDao userDao = daoProvider.getDao(UserDao.class);
    SelectOptions options = SelectOptions.get();
    return userDao.selectForIncrementalSearch(word, principal, options);
}
 
开发者ID:kawasima,项目名称:bouncr,代码行数:8,代码来源:UserController.java

示例4: edit

import enkan.collection.Parameters; //导入依赖的package包/类
@RolesAllowed({"MODIFY_USER", "MODIFY_ANY_USER"})
public HttpResponse edit(Parameters params) {
    UserDao userDao = daoProvider.getDao(UserDao.class);
    User user = userDao.selectById(params.getLong("id"));
    UserForm form = beansConverter.createFrom(user, UserForm.class);
    UserProfileFieldDao userProfileFieldDao = daoProvider.getDao(UserProfileFieldDao.class);
    Map<String, String> profiles = userProfileFieldDao.selectValuesByUserId(user.getId()).stream()
            .collect(Collectors.toMap(
                    UserProfile::getName,
                    UserProfile::getValue));
    form.setProfiles(profiles);

    List<UserProfileField> userProfileFields = userProfileFieldDao.selectAll();

    return templateEngine.render("admin/user/edit",
            "user", form,
            "userProfileFields", userProfileFields,
            "userId", user.getId());
}
 
开发者ID:kawasima,项目名称:bouncr,代码行数:20,代码来源:UserController.java

示例5: edit

import enkan.collection.Parameters; //导入依赖的package包/类
@RolesAllowed("MODIFY_OIDC_APPLICATION")
public HttpResponse edit(Parameters params, UserPermissionPrincipal principal) {
    OidcApplicationDao oidcApplicationDao = daoProvider.getDao(OidcApplicationDao.class);
    OidcApplication oidcApplication = oidcApplicationDao.selectById(params.getLong("id"));
    OidcApplicationForm form = beansConverter.createFrom(oidcApplication, OidcApplicationForm.class);
    form.setPermissionId(oidcApplicationDao.selectPermissionsById(oidcApplication.getId())
            .stream()
            .map(p -> p.getId())
            .collect(Collectors.toList()));

    PermissionDao permissionDao = daoProvider.getDao(PermissionDao.class);
    List<Permission> permissions = permissionDao.selectByPrincipalScope(principal, SelectOptions.get());
    return templateEngine.render("admin/oidcApplication/edit",
            "oidcApplication", form,
            "permissions", permissions);
}
 
开发者ID:kawasima,项目名称:bouncr,代码行数:17,代码来源:OidcApplicationController.java

示例6: edit

import enkan.collection.Parameters; //导入依赖的package包/类
@RolesAllowed({"MODIFY_ROLE", "MODIFY_ANY_ROLE"})
public HttpResponse edit(Parameters params) {
    RoleDao roleDao = daoProvider.getDao(RoleDao.class);
    Role role = roleDao.selectById(params.getLong("id"));
    RoleForm form = beansConverter.createFrom(role, RoleForm.class);

    PermissionDao permissionDao = daoProvider.getDao(PermissionDao.class);
    List<Permission> permissions = permissionDao.selectAll();

    List<Long> rolePermissionIds = permissionDao.selectByRoleId(role.getId())
            .stream()
            .map(Permission::getId)
            .collect(Collectors.toList());

    return templateEngine.render("admin/role/edit",
            "role", form,
            "permissions", permissions,
            "rolePermissionIds", rolePermissionIds);
}
 
开发者ID:kawasima,项目名称:bouncr,代码行数:20,代码来源:RoleController.java

示例7: receipt

import enkan.collection.Parameters; //导入依赖的package包/类
@Transactional
public HttpResponse receipt(UserPrincipal principal, Parameters params) {
    InvitationDao invitationDao = daoProvider.getDao(InvitationDao.class);
    Invitation invitation = invitationDao.selectByCode(params.get("code"));

    if (invitation != null) {
        UserDao  userDao  = daoProvider.getDao(UserDao.class);
        GroupDao groupDao = daoProvider.getDao(GroupDao.class);
        invitationDao.selectGroupInvitations(invitation.getId())
                .forEach(groupInvitation -> {
                    Group group = groupDao.selectById(groupInvitation.getGroupId());
                    User  user  = userDao.selectByAccount(principal.getName());
                    groupDao.addUser(group, user);
                });

        invitationDao.delete(invitation);
        return templateEngine.render("admin/invitation/process");
    } else {
        return templateEngine.render("admin/invitation/error");
    }
}
 
开发者ID:kawasima,项目名称:bouncr,代码行数:22,代码来源:InvitationController.java

示例8: newForm

import enkan.collection.Parameters; //导入依赖的package包/类
@RolesAllowed("CREATE_REALM")
public HttpResponse newForm(Parameters params) {
    RealmForm form = new RealmForm();
    ApplicationDao applicationDao = daoProvider.getDao(ApplicationDao.class);
    Application application = applicationDao.selectById(params.getLong("applicationId"));

    GroupDao groupDao = daoProvider.getDao(GroupDao.class);
    List<Group> groups = groupDao.selectAll();

    RoleDao roleDao = daoProvider.getDao(RoleDao.class);
    List<Role> roles = roleDao.selectAll();
    form.setAssignments(Collections.emptyList());


    return templateEngine.render("admin/realm/new",
            "realm", form,
            "application", application,
            "writeProtected", false,
            "groups", groups,
            "roles", roles);
}
 
开发者ID:kawasima,项目名称:bouncr,代码行数:22,代码来源:RealmController.java

示例9: newForm

import enkan.collection.Parameters; //导入依赖的package包/类
public HttpResponse newForm(Parameters params) {
    String code = params.get("code");
    List<GroupInvitation> groupInvitations = Collections.emptyList();
    OidcInvitation oidcInvitation = null;

    SignUpForm form = new SignUpForm();
    form.setCode(code);

    if (code != null) {
        InvitationDao invitationDao = daoProvider.getDao(InvitationDao.class);
        Invitation invitation = invitationDao.selectByCode(code);
        groupInvitations = invitationDao.selectGroupInvitations(invitation.getId());
        oidcInvitation = invitationDao.selectOidcInvitation(invitation.getId());
        JwtClaim claim = jsonWebToken.decodePayload(oidcInvitation.getOidcPayload(), new TypeReference<JwtClaim>() {});
        form.setName(claim.getName());
        form.setEmail(claim.getEmail());
    }
    return templateEngine.render("my/signUp/new",
            "signUp", form,
            "passwordEnabled", config.isPasswordEnabled(),
            "groupInvitations", groupInvitations,
            "oidcInvitation", oidcInvitation);
}
 
开发者ID:kawasima,项目名称:bouncr,代码行数:24,代码来源:SignUpController.java

示例10: deleteTempfile

import enkan.collection.Parameters; //导入依赖的package包/类
protected void deleteTempfile(Parameters multipartParams) {
    multipartParams.keySet().stream()
            .filter(k -> {
                Object v = multipartParams.getIn(k);
                return v instanceof Parameters && ((Parameters) v).getIn("tempfile") instanceof File;
            })
            .forEach(k -> {
                Optional<Path> tempfile = ThreadingUtils.some((File) multipartParams.getIn(k, "tempfile"),
                        File::toPath);
                tempfile.ifPresent(f -> {
                    try {
                        Files.deleteIfExists(f);
                    } catch (IOException ex) {
                        throw new FalteringEnvironmentException(ex);
                    }
                });
            });
}
 
开发者ID:kawasima,项目名称:enkan,代码行数:19,代码来源:MultipartParamsMiddleware.java

示例11: parseQueryParams

import enkan.collection.Parameters; //导入依赖的package包/类
protected void parseQueryParams(HttpRequest request, String encoding) {
    String queryString = request.getQueryString();
    if (queryString == null) {
        request.setQueryParams(Parameters.empty());
        if (request.getParams() == null) {
            request.setParams(Parameters.empty());
        }
    } else {
        Parameters params = parseParams(queryString, encoding);
        request.setQueryParams(params);
        Parameters current = request.getParams();
        if (current == null) {
            request.setParams(params);
        } else {
            current.putAll(params);
        }
    }
}
 
开发者ID:kawasima,项目名称:enkan,代码行数:19,代码来源:ParamsMiddleware.java

示例12: paramsRequest

import enkan.collection.Parameters; //导入依赖的package包/类
public void paramsRequest(HttpRequest request) {
    String encoding = characterEncoding(request);
    if (encoding == null) {
        encoding = "UTF-8";
    }

    Parameters formParams = request.getFormParams();
    if (formParams == null) {
        parseFormParams(request, encoding);
    }

    Parameters queryParams = request.getQueryParams();
    if (queryParams == null) {
        parseQueryParams(request, encoding);
    }
}
 
开发者ID:kawasima,项目名称:enkan,代码行数:17,代码来源:ParamsMiddleware.java

示例13: parse

import enkan.collection.Parameters; //导入依赖的package包/类
public static Parameters parse(InputStream in, Long contentLength, String contentType, int bufferSize) throws IOException {
    if (contentLength != null && contentLength == 0) return Parameters.empty();
    String boundary = parseBoundary(contentType);
    if (boundary == null) return Parameters.empty();

    if (bufferSize == 0) bufferSize = DEFAULT_BUFFER_SIZE;
    byte[] buffer = new byte[bufferSize];
    MultipartParser parser = new MultipartParser(boundary, bufferSize);
    int readed = in.read(buffer);
    parser.onRead(buffer, readed);

    while (true) {
        if (parser.state == ParseState.DONE) break;
        readed = in.read(buffer, 0, parser.buf.remaining());
        parser.onRead(buffer, readed);
    }

    return parser.result();
}
 
开发者ID:kawasima,项目名称:enkan,代码行数:20,代码来源:MultipartParser.java

示例14: getData

import enkan.collection.Parameters; //导入依赖的package包/类
@Override
public Parameters getData() {
    if (filename != null) {
        String fn = last(filename.split("/\\\\"));
        return Parameters.of(name,
                Parameters.of(
                        "filename", fn,
                        "name", name,
                        "tempfile", tempfile,
                        "type", contentType,
                        "head", head));
    } else if (contentType != null) {
        return Parameters.of(name,
                Parameters.of(
                        "type", contentType,
                        "name", name,
                        "tempfile", tempfile,
                        "head", head));
    }
    return null;
}
 
开发者ID:kawasima,项目名称:enkan,代码行数:22,代码来源:TempfilePart.java

示例15: handle

import enkan.collection.Parameters; //导入依赖的package包/类
@Override
public HttpResponse handle(HttpRequest request, MiddlewareChain chain) {
    Parameters params = request.getParams();
    if (params != null) {
        params.keySet().forEach(key -> {
            Object obj = params.getRawType(key);
            if (obj == null) return;

            normalizationSpecs.forEach(c -> {
                if (c.getPredicate().test(key) && c.getNormalizer().canNormalize(obj.getClass())) {
                    params.replace(key, c.getNormalizer().normalize(obj));
                }
            });
        });
    }
    return (HttpResponse) chain.next(request);
}
 
开发者ID:kawasima,项目名称:enkan,代码行数:18,代码来源:NormalizationMiddleware.java


注:本文中的enkan.collection.Parameters类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。