Search in sources :

Example 1 with DataGridZone

use of com.emc.metalnx.core.domain.entity.DataGridZone in project metalnx-web by irods-contrib.

the class UserController method showModifyUserForm.

/**
 * Controller that shows the modification of user view.
 *
 * @param username
 * @param additionalInfo
 * @param model
 * @return the template name to render the modify user form
 * @throws DataGridConnectionRefusedException
 */
@RequestMapping(value = "modify/{username}/{additionalInfo}/", method = RequestMethod.GET)
public String showModifyUserForm(@PathVariable String username, @PathVariable String additionalInfo, Model model) throws DataGridConnectionRefusedException {
    DataGridUser user = userService.findByUsernameAndAdditionalInfo(username, additionalInfo);
    List<DataGridGroup> groups = groupService.findAll();
    List<DataGridZone> zones = zoneService.findAll();
    if (user != null) {
        UserForm userForm = new UserForm();
        // iRODS data
        userForm.setDataGridId(user.getDataGridId());
        userForm.setUsername(user.getUsername());
        userForm.setAdditionalInfo(user.getAdditionalInfo());
        userForm.setUserProfile(user.getUserProfile());
        userForm.setOrganizationalRole(user.getOrganizationalRole());
        userForm.setUserType(user.getUserType());
        // our data
        if (user.getEmail() != null) {
            userForm.setEmail(user.getEmail());
        }
        if (user.getFirstName() != null) {
            userForm.setFirstName(user.getFirstName());
        }
        if (user.getLastName() != null) {
            userForm.setLastName(user.getLastName());
        }
        if (user.getCompany() != null) {
            userForm.setCompany(user.getCompany());
        }
        if (user.getDepartment() != null) {
            userForm.setDepartment(user.getDepartment());
        }
        // Getting the list of groups the user belongs to
        String[] groupList = userService.getGroupIdsForUser(user);
        groupsToBeAdded = new ArrayList<String>(Arrays.asList(groupList));
        model.addAttribute("user", userForm);
        model.addAttribute("groupList", groupList);
        model.addAttribute("requestMapping", "/users/modify/action/");
        model.addAttribute("addReadPermissionsOnDirs", addReadPermissionsOnDirs);
        model.addAttribute("addWritePermissionsOnDirs", addWritePermissionsOnDirs);
        model.addAttribute("addOwnerOnDirs", addOwnerOnDirs);
    }
    model.addAttribute("profiles", userProfileService.findAll());
    model.addAttribute("groups", groups);
    model.addAttribute("zones", zones);
    model.addAttribute("userZone", additionalInfo);
    model.addAttribute("userTypes", userService.listUserTypes());
    return "users/userForm";
}
Also used : DataGridZone(com.emc.metalnx.core.domain.entity.DataGridZone) DataGridUser(com.emc.metalnx.core.domain.entity.DataGridUser) DataGridGroup(com.emc.metalnx.core.domain.entity.DataGridGroup) UserForm(com.emc.metalnx.modelattribute.user.UserForm) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with DataGridZone

use of com.emc.metalnx.core.domain.entity.DataGridZone in project metalnx-web by irods-contrib.

the class ZoneServiceImpl method findAll.

@Override
public List<DataGridZone> findAll() throws DataGridConnectionRefusedException {
    ZoneAO zoneAO = irodsServices.getZoneAO();
    List<DataGridZone> dataGridZones = null;
    try {
        List<Zone> zones = zoneAO.listZones();
        dataGridZones = new ArrayList<DataGridZone>();
        for (Zone zone : zones) {
            DataGridZone dataGridZone = new DataGridZone();
            dataGridZone.setId(Long.valueOf(zone.getZoneId()));
            dataGridZone.setName(zone.getZoneName());
            dataGridZone.setType(zone.getZoneType());
            dataGridZone.setCreateTime(zone.getZoneCreateTime());
            dataGridZone.setModifyTime(zone.getZoneModifyTime());
            dataGridZone.setConnectionString(zone.getZoneConnection());
            dataGridZone.setComment(zone.getZoneComment());
            // adding this current zone to the list
            dataGridZones.add(dataGridZone);
        }
    } catch (JargonException e) {
        logger.info("Could not find all zones ", e);
    }
    return dataGridZones;
}
Also used : DataGridZone(com.emc.metalnx.core.domain.entity.DataGridZone) Zone(org.irods.jargon.core.pub.domain.Zone) DataGridZone(com.emc.metalnx.core.domain.entity.DataGridZone) JargonException(org.irods.jargon.core.exception.JargonException) ZoneAO(org.irods.jargon.core.pub.ZoneAO)

Aggregations

DataGridZone (com.emc.metalnx.core.domain.entity.DataGridZone)2 DataGridGroup (com.emc.metalnx.core.domain.entity.DataGridGroup)1 DataGridUser (com.emc.metalnx.core.domain.entity.DataGridUser)1 UserForm (com.emc.metalnx.modelattribute.user.UserForm)1 JargonException (org.irods.jargon.core.exception.JargonException)1 ZoneAO (org.irods.jargon.core.pub.ZoneAO)1 Zone (org.irods.jargon.core.pub.domain.Zone)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1