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";
}
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;
}
Aggregations