Package org.exoplatform.application.registry

Examples of org.exoplatform.application.registry.ApplicationRegistryService


        public void execute(Event<UIAddApplicationForm> event) throws Exception {
            UIAddApplicationForm uiForm = event.getSource();
            UIApplicationOrganizer uiOrganizer = uiForm.getParent();
            WebuiRequestContext ctx = event.getRequestContext();
            ApplicationRegistryService appRegService = uiForm.getApplicationComponent(ApplicationRegistryService.class);
            ApplicationCategory selectedCate = uiOrganizer.getSelectedCategory();
            if (appRegService.getApplicationCategory(selectedCate.getName()) == null) {
                uiOrganizer.reload();
                UIApplication uiApp = ctx.getUIApplication();
                uiApp.addMessage(new ApplicationMessage("category.msg.changeNotExist", null));
                ctx.addUIComponentToUpdateByAjax(uiOrganizer);
                return;
            }

            if (uiForm.getApplications().size() == 0) {
                ctx.getUIApplication().addMessage(new ApplicationMessage("UIAddApplicationForm.msg.appNotExists", null));
                ctx.addUIComponentToUpdateByAjax(uiOrganizer);
                return;
            }
            UIFormRadioBoxInput uiRadio = uiForm.getUIInput("application");
            String displayName = uiForm.getUIStringInput(FIELD_NAME).getValue();
            Application tmp = uiForm.getApplications().get(Integer.parseInt(uiRadio.getValue()));

            // check portet name is exist
            for (Application application : appRegService.getApplications(selectedCate)) {
                if (application.getContentId().equals(tmp.getContentId())) {
                    ctx.getUIApplication().addMessage(new ApplicationMessage("UIAddApplicationForm.msg.PortletExist", null));
                    return;
                }
            }

            Application app = cloneApplication(tmp);
            UIApplicationRegistryPortlet.setPermissionToAdminGroup(app);

            if (displayName != null && displayName.trim().length() > 0) {
                app.setDisplayName(displayName);
            }

            appRegService.save(selectedCate, app);
            uiOrganizer.reload();
            uiOrganizer.setSelectedCategory(selectedCate.getName());
            uiOrganizer.selectApplication(app.getApplicationName());
            ctx.addUIComponentToUpdateByAjax(uiOrganizer);
        }
View Full Code Here


            ctx.addUIComponentToUpdateByAjax(uiManagement);
        }

        private void removeFromApplicationRegistry(String name) throws Exception {
            ApplicationRegistryService appRegService = org.exoplatform.portal.webui.util.Util.getUIPortalApplication()
                    .getApplicationComponent(ApplicationRegistryService.class);
            List<ApplicationCategory> cates = appRegService.getApplicationCategories();
            for (ApplicationCategory cate : cates) {
                Application app = appRegService.getApplication(cate.getName(), name);
                if (app != null)
                    appRegService.remove(app);
            }
        }
View Full Code Here

        ArrayList<String> pers = new ArrayList<String>();
        if (uiListPermissionSelector.getValue() != null)
            for (String per : uiListPermissionSelector.getValue())
                pers.add(per);
        application_.setAccessPermissions(pers);
        ApplicationRegistryService service = getApplicationComponent(ApplicationRegistryService.class);
        application_.setModifiedDate(Calendar.getInstance().getTime());
        WebuiRequestContext ctx = WebuiRequestContext.getCurrentInstance();
        if (service.getApplication(application_.getId()) == null) {
            UIApplication uiApp = ctx.getUIApplication();
            uiApp.addMessage(new ApplicationMessage("application.msg.changeNotExist", null));
            return;
        }
        service.update(application_);
        Application selectedApplication = getApplication();
        UIApplicationOrganizer uiApplicationOrganizer = getAncestorOfType(UIApplicationOrganizer.class);
        ApplicationCategory selectedCategory = uiApplicationOrganizer.getSelectedCategory();
        uiApplicationOrganizer.reload();
        uiApplicationOrganizer.setSelectedCategory(selectedCategory);
View Full Code Here

            return GadgetUtil.getEditPath(gadget_.getUrl());
        return null;
    }

    public String getCategorieNames() throws Exception {
        ApplicationRegistryService appRegService = getApplicationComponent(ApplicationRegistryService.class);
        List<ApplicationCategory> allCategories = appRegService.getApplicationCategories();
        List<String> nameList = new ArrayList<String>();

        for (ApplicationCategory category : allCategories) {
            if (appRegService.getApplication(category.getName(), gadget_.getName()) != null) {
                nameList.add(category.getDisplayName(true));
            }
        }
        StringBuffer names = new StringBuffer("");
        for (String name : nameList) {
View Full Code Here

    public static class ShowCategoriesActionListener extends EventListener<UIGadgetInfo> {
        @Override
        public void execute(Event<UIGadgetInfo> event) throws Exception {
            UIGadgetInfo gadgetInfo = event.getSource();

            ApplicationRegistryService appRegService = gadgetInfo.getApplicationComponent(ApplicationRegistryService.class);
            List<ApplicationCategory> categories = appRegService.getApplicationCategories();
            if (categories == null || categories.isEmpty()) {
                UIApplication uiApp = event.getRequestContext().getUIApplication();
                uiApp.addMessage(new ApplicationMessage("UICategorySelector.msg.NoCategory", null));
                return;
            }
View Full Code Here

     
   }
  
   private String getCategorieNames() throws Exception
   {
      ApplicationRegistryService appRegService = getApplicationComponent(ApplicationRegistryService.class);
      List<ApplicationCategory> allCategories = appRegService.getApplicationCategories();
      List<String> nameList = new ArrayList<String>();
     
      for (ApplicationCategory category : allCategories)
      {
         if (appRegService.getApplication(category.getName(), portlet_.getName()) != null)
         {
            nameList.add(category.getDisplayName());
         }
      }
      StringBuffer names = new StringBuffer("");
View Full Code Here

      @Override
      public void execute(Event<UIGadgetInfo> event) throws Exception
      {
         UIGadgetInfo gadgetInfo = event.getSource();
        
         ApplicationRegistryService appRegService = gadgetInfo.getApplicationComponent(ApplicationRegistryService.class);
         List<ApplicationCategory> categories = appRegService.getApplicationCategories();
         if (categories == null || categories.isEmpty()) {
            UIApplication uiApp = event.getRequestContext().getUIApplication();
            uiApp.addMessage(new ApplicationMessage("UICategorySelector.msg.NoCategory", null));
            return;
         }
View Full Code Here

      public void execute(Event<UIApplicationForm> event) throws Exception
      {
         UIApplicationForm uiForm = event.getSource();
         WebuiRequestContext ctx = event.getRequestContext();
         UIApplicationOrganizer uiOrganizer = uiForm.getParent();
         ApplicationRegistryService service = uiForm.getApplicationComponent(ApplicationRegistryService.class);
         Application application = uiForm.getApplication();
         if (service.getApplication(application.getId()) == null)
         {
            UIApplication uiApp = ctx.getUIApplication();
            uiApp.addMessage(new ApplicationMessage("application.msg.changeNotExist", null));
            uiOrganizer.reload();
            uiOrganizer.setSelectedCategory(application.getCategoryName());
            ctx.addUIComponentToUpdateByAjax(uiOrganizer);
            ctx.addUIComponentToUpdateByAjax(uiApp.getUIPopupMessages());
            return;
         }
         uiForm.invokeSetBindingBean(application);
         application.setModifiedDate(Calendar.getInstance().getTime());
         String displayName = application.getDisplayName();
         if (displayName == null || displayName.trim().length() < 1)
         {
            application.setDisplayName(application.getApplicationName());
         }
         service.update(application);
         //uiOrganizer.setSelectedApplication(uiOrganizer.getSelectedApplication());
         uiOrganizer.reload();
         uiOrganizer.setSelectedApplication(application);
         ctx.addUIComponentToUpdateByAjax(uiOrganizer);
      }
View Full Code Here

      public void execute(Event<UICategoryForm> event) throws Exception
      {
         UICategoryForm uiForm = event.getSource();
         WebuiRequestContext ctx = event.getRequestContext();
         UIApplicationOrganizer uiOrganizer = uiForm.getParent();
         ApplicationRegistryService service = uiForm.getApplicationComponent(ApplicationRegistryService.class);
         ApplicationCategory category = uiForm.getCategory();
         boolean isCreateNew = category == null;
         if (isCreateNew)
         {
            category = new ApplicationCategory();
         }
         UIFormInputSet uiSetting = uiForm.getChildById(FIELD_SETTING);
         UIFormInputSet uiPermission = uiForm.getChildById(FIELD_PERMISSION);
         category.setName(uiSetting.getUIStringInput(FIELD_NAME).getValue());
         String displayName = uiSetting.getUIStringInput(FIELD_DISPLAY_NAME).getValue();
         if (displayName == null || displayName.length() < 1)
         {
            category.setDisplayName(category.getName());
         }
         else
         {
            category.setDisplayName(displayName);
         }
         category.setDescription(uiSetting.getUIFormTextAreaInput(FIELD_DESCRIPTION).getValue());

         UIListPermissionSelector uiListPermissionSelector = uiPermission.getChild(UIListPermissionSelector.class);
         ArrayList<String> pers = new ArrayList<String>();
         if (uiListPermissionSelector.getValue() != null)
         {
            for (String per : uiListPermissionSelector.getValue())
            {
               pers.add(per);
            }
         }
         category.setAccessPermissions(pers);
         ApplicationCategory existCategory = service.getApplicationCategory(category.getName());
         if (!isCreateNew)
         {
            if (existCategory == null)
            {
               uiOrganizer.reload();
               UIApplication uiApp = ctx.getUIApplication();
               uiApp.addMessage(new ApplicationMessage("category.msg.changeNotExist", null));
               ctx.addUIComponentToUpdateByAjax(uiOrganizer);
               return;
            }
            category.setModifiedDate(new Date());
         }
         else
         {
            if (existCategory != null)
            {
               UIApplication uiApp = event.getRequestContext().getUIApplication();
               uiApp.addMessage(new ApplicationMessage("UICategoryForm.msg.SameName", null));
               if (uiOrganizer.getCategory(category.getName()) == null)
               {
                  uiOrganizer.initApplicationCategories();
               }
               return;
            }
            category.setModifiedDate(new Date());
            category.setCreatedDate(new Date());
         }
         service.save(category);
         uiForm.setValue(null);
         uiOrganizer.reload();
         uiOrganizer.setSelectedCategory(category.getName());
         ctx.addUIComponentToUpdateByAjax(uiOrganizer);
      }
View Full Code Here

      uiPortal.broadcast(pnevent, Event.Phase.PROCESS);
   }

   public void initApplicationCategories() throws Exception
   {
      ApplicationRegistryService service = getApplicationComponent(ApplicationRegistryService.class);
      categories = service.getApplicationCategories(new Util.CategoryComparator());
   }
View Full Code Here

TOP

Related Classes of org.exoplatform.application.registry.ApplicationRegistryService

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.