Package com.adito.policyframework.forms

Examples of com.adito.policyframework.forms.AbstractResourceForm


     * @return forward
     * @throws Exception
     */
    public ActionForward toogleShowPersonalPolicies(ActionMapping mapping, ActionForm form, HttpServletRequest request,
                                                    HttpServletResponse response) throws Exception {
        AbstractResourceForm policyForm = (AbstractResourceForm) form;

        Resource resource = ResourceStack.peekEditingStack(request.getSession());
        SessionInfo session = this.getSessionInfo(request);

        PropertyList selectedPolicies = new PropertyList();
        String requestSelectedPolicies = request.getParameter("selectedPolicies");
        if (!Util.isNullOrTrimmedBlank(requestSelectedPolicies)) {
            selectedPolicies.setAsTextFieldText(requestSelectedPolicies);
        }
        MultiSelectPoliciesSelectionModel policyModel = initSelectModel(selectedPolicies, ((AbstractResourceForm) form)
                        .isShowPersonalPolicies(), resource, session);

        policyForm.setPolicyModel(policyModel);
        policyForm.setSelectedPolicies(selectedPolicies);
           
        return display(mapping, form, request, response);
    }
View Full Code Here


     * @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));
               }
View Full Code Here

TOP

Related Classes of com.adito.policyframework.forms.AbstractResourceForm

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.