use of com.emc.metalnx.modelattribute.resource.ResourceForm in project metalnx-web by irods-contrib.
the class ResourceController method showModifyResourceForm.
/**
* Shows the modify resource form
*
* @param model
* @return the template that renders the add resource from
* @throws DataGridConnectionRefusedException
*/
@RequestMapping(value = "/modify/{resourceName}/")
public String showModifyResourceForm(Model model, @PathVariable String resourceName) throws DataGridConnectionRefusedException {
if (dataGridResources == null || dataGridResources.isEmpty()) {
dataGridResources = resourceService.findAll();
}
DataGridResource dataGridResourceToModify = resourceService.find(resourceName);
List<String> childrenList = resourceService.getImmediateChildren(resourceName);
List<DataGridResourceType> coordinatingResources = getCoordinatingResources(resourceService.listResourceTypes());
List<DataGridResourceType> storageResources = getStorageResources(resourceService.listResourceTypes());
for (DataGridResourceType dataGridResourceType : resourceService.listResourceTypes()) {
if (dataGridResourceType.getDataGridType().equals(DataGridResourceTypeEnum.IRODS_COORDINATING)) {
coordinatingResources.add(dataGridResourceType);
} else if (dataGridResourceType.getDataGridType().equals(DataGridResourceTypeEnum.IRODS_STORAGE)) {
storageResources.add(dataGridResourceType);
}
}
ResourceForm resourceForm = new ResourceForm(dataGridResourceToModify);
// prevent the same resource being modified from showing in the parent resource
// list
model.addAttribute("resourceForm", resourceForm);
model.addAttribute("requestMapping", URLMap.URL_MODIFY_RESOURCE_ACTION);
model.addAttribute("resources", dataGridResources);
model.addAttribute("childrenList", childrenList);
model.addAttribute("coordinatingResources", coordinatingResources);
model.addAttribute("storageResources", storageResources);
return "resources/resourceForm";
}
use of com.emc.metalnx.modelattribute.resource.ResourceForm in project metalnx-web by irods-contrib.
the class ResourceController method addResourceForm.
private void addResourceForm(Model model) throws DataGridConnectionRefusedException {
List<DataGridResource> dataGridResources = resourceService.findAll();
List<DataGridResourceType> resourceTypes = resourceService.listResourceTypes();
List<DataGridResourceType> coordinatingResources = getCoordinatingResources(resourceTypes);
List<DataGridResourceType> storageResources = getStorageResources(resourceTypes);
model.addAttribute("resourceForm", new ResourceForm());
model.addAttribute("requestMapping", URLMap.URL_ADD_RESOURCE_ACTION);
model.addAttribute("resources", dataGridResources);
model.addAttribute("childrenList", new ArrayList<String>());
model.addAttribute("coordinatingResources", coordinatingResources);
model.addAttribute("storageResources", storageResources);
model.addAttribute("zones", zoneService.findAll());
}
Aggregations