Search in sources :

Example 1 with UserProfileForm

use of com.emc.metalnx.modelattribute.user.profile.UserProfileForm in project metalnx-web by irods-contrib.

the class UserProfileController method showCreateForm.

@RequestMapping(value = "/create/")
public String showCreateForm(Model model) {
    UserProfileForm userProfileForm = new UserProfileForm();
    List<DataGridGroup> groups = groupService.findAll();
    groupIdsList = new ArrayList<String>();
    model.addAttribute("userProfileForm", userProfileForm);
    model.addAttribute("groups", groups);
    model.addAttribute("groupsOnProfileList", new String[0]);
    model.addAttribute("resultSize", groups.size());
    model.addAttribute("foundGroups", groups.size() > 0);
    model.addAttribute("requestMapping", "/users/profile/create/action/");
    return "userProfile/userProfileForm";
}
Also used : UserProfileForm(com.emc.metalnx.modelattribute.user.profile.UserProfileForm) DataGridGroup(com.emc.metalnx.core.domain.entity.DataGridGroup)

Example 2 with UserProfileForm

use of com.emc.metalnx.modelattribute.user.profile.UserProfileForm in project metalnx-web by irods-contrib.

the class UserProfileController method showModifyForm.

@RequestMapping(value = "/modify/{profileId}/")
public String showModifyForm(Model model, @PathVariable String profileId) {
    UserProfile userProfile = userProfileService.findById(Long.valueOf(profileId));
    List<DataGridGroup> groups = groupService.findAll();
    UserProfileForm userProfileForm = new UserProfileForm();
    if (userProfile != null) {
        userProfileForm.setProfileId(String.valueOf(userProfile.getProfileId()));
        userProfileForm.setProfileName(userProfile.getProfileName());
        userProfileForm.setDescription(userProfile.getDescription());
        int groupsQuantity = userProfile.getGroups().size(), i = 0;
        String[] groupsOnProfileList = new String[groupsQuantity];
        for (DataGridGroup group : userProfile.getGroups()) {
            groupsOnProfileList[i++] = String.valueOf(group.getId());
        }
        model.addAttribute("groupsOnProfileList", groupsOnProfileList);
        groupIdsList = new ArrayList<String>(Arrays.asList(groupsOnProfileList));
    }
    model.addAttribute("userProfileForm", userProfileForm);
    model.addAttribute("groups", groups);
    model.addAttribute("resultSize", groups.size());
    model.addAttribute("foundGroups", groups.size() > 0);
    model.addAttribute("requestMapping", "/users/profile/modify/action/");
    return "userProfile/userProfileForm";
}
Also used : UserProfileForm(com.emc.metalnx.modelattribute.user.profile.UserProfileForm) UserProfile(com.emc.metalnx.core.domain.entity.UserProfile) DataGridGroup(com.emc.metalnx.core.domain.entity.DataGridGroup)

Aggregations

DataGridGroup (com.emc.metalnx.core.domain.entity.DataGridGroup)2 UserProfileForm (com.emc.metalnx.modelattribute.user.profile.UserProfileForm)2 UserProfile (com.emc.metalnx.core.domain.entity.UserProfile)1