Package org.jmanage.webui.forms

Examples of org.jmanage.webui.forms.ApplicationClusterForm


                                 ActionForm actionForm,
                                 HttpServletRequest request,
                                 HttpServletResponse response)
            throws Exception {
        AccessController.checkAccess(context.getServiceContext(), ACL_ADD_APPLICATIONS);
        ApplicationClusterForm clusterForm = (ApplicationClusterForm)actionForm;
        String[] childAppIds =
                StringUtils.csvToStringArray(clusterForm.getSelectedChildApplications());
        /* build list of new child applications */
        List<ApplicationConfig> newChildApplications = getNewChildApplications(childAppIds);

        String applicationId = clusterForm.getApplicationId();
        if(applicationId != null){
            /* update existing application */
            ApplicationClusterConfig clusterConfig =
                    (ApplicationClusterConfig)
                    ApplicationConfigManager.getApplicationConfig(applicationId);
            assert clusterConfig != null;
            clusterConfig.setName(clusterForm.getName());
            final List oldChildApplications = clusterConfig.getApplications();
            /* add applications outside the cluster
            (applications that are no longer in the cluster) */
            for(Iterator it=oldChildApplications.iterator();it.hasNext();){
                ApplicationConfig appConfig = (ApplicationConfig)it.next();
                if(!newChildApplications.contains(appConfig)){
                    ApplicationConfigManager.addApplication(appConfig);
                    appConfig.setClusterConfig(null);
                }
            }
            /* remove applications outside the cluster
            (applications that are now part of cluster) */
            for(Iterator it=newChildApplications.iterator();it.hasNext();){
                ApplicationConfig appConfig = (ApplicationConfig)it.next();
                if(!oldChildApplications.contains(appConfig)){
                    ApplicationConfigManager.deleteApplication(appConfig);
                    appConfig.setClusterConfig(clusterConfig);
                }
            }
            clusterConfig.setApplications(newChildApplications);
            ApplicationConfigManager.updateApplication(clusterConfig);

            UserActivityLogger.getInstance().logActivity(
                context.getUser().getUsername(),
                "Updated application cluster "+ "\""+clusterConfig.getName()+"\"");

        }else{
            /* add new application cluster */
            ApplicationClusterConfig clusterConfig =
                    new ApplicationClusterConfig(
                            ApplicationConfig.getNextApplicationId(),
                            clusterForm.getName());
            for(Iterator it=newChildApplications.iterator();it.hasNext();){
                ApplicationConfig appConfig = (ApplicationConfig)it.next();
                appConfig.setClusterConfig(clusterConfig);
                ApplicationConfigManager.deleteApplication(appConfig, true);
            }
View Full Code Here


                                 HttpServletRequest request,
                                 HttpServletResponse response)
            throws Exception {
        AccessController.checkAccess(context.getServiceContext(),
                ACL_ADD_APPLICATIONS);
        ApplicationClusterForm clusterForm =
                (ApplicationClusterForm)actionForm;
        String applicationId = clusterForm.getApplicationId();
        List selectedApplications = null;
        if(applicationId != null){
            ApplicationConfig clusterConfig =
                    ApplicationConfigManager.getApplicationConfig(applicationId);
            assert clusterConfig.isCluster();
            clusterForm.setName(clusterConfig.getName());
            selectedApplications = clusterConfig.getApplications();
        }else{
            selectedApplications = new LinkedList();
        }
View Full Code Here

TOP

Related Classes of org.jmanage.webui.forms.ApplicationClusterForm

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.