Package org.exoplatform.application.registry

Examples of org.exoplatform.application.registry.Application


      public void execute(Event<UICategoryForm> event) throws Exception
      {
         UICategoryForm uiForm = event.getSource();
         UIApplicationOrganizer uiOrganizer = uiForm.getParent();
         Application application = uiOrganizer.getSelectedApplication();
         if (application != null)
         {
            uiOrganizer.setSelectedApplication(application);
         }
         else
View Full Code Here


      public void execute(Event<UIApplicationOrganizer> event) throws Exception
      {
         WebuiRequestContext ctx = event.getRequestContext();
         String appName = ctx.getRequestParameter(OBJECTID);
         UIApplicationOrganizer uiOrganizer = event.getSource();
         Application selectedApp = uiOrganizer.getApplication(appName);
         ApplicationRegistryService service = uiOrganizer.getApplicationComponent(ApplicationRegistryService.class);
         String selectedAppId = selectedApp.getId();
         if (service.getApplication(selectedAppId) == null)
         {
            UIApplication uiApp = ctx.getUIApplication();
            uiApp.addMessage(new ApplicationMessage("UIOrganizer.msg.applicationNoExist", null));
            ApplicationCategory selectedCategory = uiOrganizer.getSelectedCategory();
View Full Code Here

         UIApplicationOrganizer uiOrganizer = event.getSource();
         String appName = event.getRequestContext().getRequestParameter(OBJECTID);
         UIApplicationForm uiApplicationForm = uiOrganizer.getChild(UIApplicationForm.class);
         if (uiApplicationForm != null)
         {
            Application app = uiApplicationForm.getApplication();
            if (app != null && app.getApplicationName().equals(appName))
            {
               UIApplication uiApp = event.getRequestContext().getUIApplication();
               uiApp.addMessage(new ApplicationMessage("UIOrganizer.msg.deleteApplicationInUse", null));
               return;
            }
         }
         ApplicationRegistryService service = uiOrganizer.getApplicationComponent(ApplicationRegistryService.class);
         Application app = uiOrganizer.getApplication(appName);
         if (service.getApplication(app.getId()) != null)
         {
            service.remove(app);
         }
         String cateName = uiOrganizer.getSelectedCategory().getName();
         uiOrganizer.reload();
View Full Code Here

         for (ApplicationCategory category : categories)
         {
            chkInput = selector.getUIInput("category_" + category.getName());
            if (chkInput != null && chkInput.isChecked())
            {
               Application newApp = cloneApplication(selector.getApplication());
               UIApplicationRegistryPortlet.setPermissionToEveryone(newApp);
               appRegService.save(category, newApp);
            }
         }
         UIContainer appInfo = selector.getParent();
View Full Code Here

         event.getRequestContext().addUIComponentToUpdateByAjax(appInfo);
      }

      private Application cloneApplication(Application app)
      {
         Application newApp = new Application();
         newApp.setApplicationName(app.getApplicationName());
         newApp.setDisplayName(app.getDisplayName());
         newApp.setType(app.getType());
         newApp.setDescription(app.getDescription());
         newApp.setAccessPermissions(app.getAccessPermissions());
         newApp.setContentId(app.getContentId());
         return newApp;
      }
View Full Code Here

    public List<Application> getGadgetsOfCategory(final ApplicationCategory appCategory) {
        UserACL acl = Util.getUIPortalApplication().getApplicationComponent(UserACL.class);
        List<Application> listGadgets = new ArrayList<Application>();
        Iterator<Application> gadgetIterator = appCategory.getApplications().iterator();
        while (gadgetIterator.hasNext()) {
            Application app = gadgetIterator.next();
            for (String p : app.getAccessPermissions()) {
                if (acl.hasPermission(p)) {
                    listGadgets.add(app);
                    break;
                }
            }
View Full Code Here

            int col = Integer.parseInt(context.getRequestParameter(COLINDEX));
            int row = Integer.parseInt(context.getRequestParameter(ROWINDEX));
            String objectId = context.getRequestParameter(UIComponent.OBJECTID);

            ApplicationRegistryService service = uiDashboard.getApplicationComponent(ApplicationRegistryService.class);
            Application application = service.getApplication(objectId);
            if (application == null) {
                UIApplication uiApplication = context.getUIApplication();
                uiApplication.addMessage(new ApplicationMessage("UIDashboard.msg.ApplicationNotExisted", null));
                context.setAttribute(UIDashboard.APP_NOT_EXIST, true);
                return;
            }
            UIGadget uiGadget = event.getSource().createUIComponent(context, UIGadget.class, null, null);
            uiGadget.setState(new TransientApplicationState<Gadget>(application.getApplicationName()));
            UIDashboardContainer uiDashboardContainer = uiDashboard.getChild(UIDashboardContainer.class);
            uiDashboardContainer.addUIGadget(uiGadget, col, row);
            uiDashboardContainer.save();
            context.addUIComponentToUpdateByAjax(uiDashboardContainer);
        }
View Full Code Here

                    if (accessPers == null || accessPers.length == 0)
                        accessPers = new String[] { UserACL.EVERYONE };
                    uiContainer.setAccessPermissions(accessPers);
                    uiSource = uiContainer;
                } else {
                    Application app = null;
                    UIApplicationList appList = uiApp.findFirstComponentOfType(UIApplicationList.class);
                    app = appList.getApplication(sourceId);
                    ApplicationType applicationType = app.getType();

                    //
                    UIPortlet uiPortlet = uiTarget.createUIComponent(UIPortlet.class, null, null);
                    // Only setting title for Gadgets as it's using Portlet wrapper for displaying
                    if (app.getType().equals(ApplicationType.GADGET)) {
                        uiPortlet.setTitle(app.getDisplayName());
                    }
                    uiPortlet.setDescription(app.getDescription());
                    List<String> accessPersList = app.getAccessPermissions();
                    String[] accessPers = accessPersList.toArray(new String[accessPersList.size()]);
                    for (String accessPer : accessPers) {
                        if (accessPer.equals(""))
                            accessPers = null;
                    }
                    if (accessPers == null || accessPers.length == 0)
                        accessPers = new String[] { UserACL.EVERYONE };
                    uiPortlet.setAccessPermissions(accessPers);
                    UIPage uiPage = uiTarget.getAncestorOfType(UIPage.class);

                    // Hardcode on state to fix error while drag/drop Dashboard
                    if ("dashboard/DashboardPortlet".equals(app.getContentId())) {
                        TransientApplicationState state = new TransientApplicationState<Object>(app.getContentId());
                        uiPortlet.setState(new PortletState(state, applicationType));
                    } else {
                        ApplicationState state;
                        // if we have a new portlet added to the page we need for it to have its own state.
                        // otherwise all new portlets added to a page will have the same state.
                        if (newComponent) {
                            state = new TransientApplicationState<Object>(app.getContentId());

                            // if the portlet is not new, then we should clone it from the original portlet
                        } else {
                            state = new CloneApplicationState<Object>(app.getStorageId());
                        }
                        uiPortlet.setState(new PortletState(state, applicationType));
                    }
                    uiPortlet.setPortletInPortal(uiTarget instanceof UIPortal);
View Full Code Here

    public List<Application> getGadgetsOfCategory(final ApplicationCategory appCategory) {
        UserACL acl = Util.getUIPortalApplication().getApplicationComponent(UserACL.class);
        List<Application> listGadgets = new ArrayList<Application>();
        Iterator<Application> gadgetIterator = appCategory.getApplications().iterator();
        while (gadgetIterator.hasNext()) {
            Application app = gadgetIterator.next();
            for (String p : app.getAccessPermissions()) {
                if (acl.hasPermission(p)) {
                    /**
                     * Gadgets IDs have "/" characters.
                     * We need to workaround them in the markup to be W3C compliant.
                     *
                     * "/" -> "_slash_"
                     *
                     * @see UIDashboardContainer.AddNewGadgetActionListener#execute(org.exoplatform.webui.event.Event)
                     */
                    app.setId(app.getId().replaceAll("/", "_slash_"));
                    listGadgets.add(app);
                    break;
                }
            }
        }
View Full Code Here

             * @see UIDashboardSelectContainer#getGadgetsOfCategory(org.exoplatform.application.registry.ApplicationCategory)
             */
            objectId = objectId.replaceAll("_slash_", "/");

            ApplicationRegistryService service = uiDashboard.getApplicationComponent(ApplicationRegistryService.class);
            Application application = service.getApplication(objectId);
            if (application == null) {
                UIApplication uiApplication = context.getUIApplication();
                uiApplication.addMessage(new ApplicationMessage("UIDashboard.msg.ApplicationNotExisted", null));
                context.setAttribute(UIDashboard.APP_NOT_EXIST, true);
                return;
            }
            UIGadget uiGadget = event.getSource().createUIComponent(context, UIGadget.class, null, null);
            uiGadget.setState(new TransientApplicationState<Gadget>(application.getApplicationName()));
            UIDashboardContainer uiDashboardContainer = uiDashboard.getChild(UIDashboardContainer.class);
            uiDashboardContainer.addUIGadget(uiGadget, col, row);
            uiDashboardContainer.save();
            context.addUIComponentToUpdateByAjax(uiDashboardContainer);
        }
View Full Code Here

TOP

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

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.