* @return forward
* @throws Exception
*/
public ActionForward commit(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
throws Exception {
AbstractResourceForm resourceForm = (AbstractResourceForm) form;
resourceForm.apply();
Resource resource = resourceForm.getResource();
if(resourceForm.getEditing()) {
resource.getResourceType().updateResource(resource, getSessionInfo(request));
}
else {
resource = commitCreatedResource(mapping, resourceForm, request, response);
resourceForm.setResource(resource);
}
doUpdate(mapping, form, request, response);
// Profiles are a special case that cannot have their policies changes
if(resource.getResourceType() != PolicyConstants.PROFILE_RESOURCE_TYPE || !resource.getResourceName().equals("Default")) {
PolicyDatabaseFactory.getInstance().attachResourceToPolicyList(resource, resourceForm.getSelectedPoliciesList(), getSessionInfo(request));
}
if (resource.getResourceType() instanceof FavoriteResourceType) {
ResourceUtil.setResourceGlobalFavorite(resource, ((AbstractFavoriteResourceForm) resourceForm).isFavorite());
}
// Update the attributes
for(Iterator i = resourceForm.getAttributeValueItems().iterator(); i.hasNext(); ) {
AttributeValueItem v = (AttributeValueItem)i.next();
if(v.getDefinition().getVisibility() != AttributeDefinition.USER_CONFIDENTIAL_ATTRIBUTE) {
if (v.getDefinition().getPropertyClass().getName().equals(PolicyAttributes.NAME)){
Property.setProperty(new PolicyAttributeKey(resource.getResourceId(), v.getName()), v.getDefinition().formatAttributeValue(v.getPropertyValue()), getSessionInfo(request));
}