Package org.exoplatform.application.registry

Examples of org.exoplatform.application.registry.Application


                container.setId(String.valueOf(Math.abs(container.hashCode())));
                uiContainer.setStorageId(container.getStorageId());
                PortalDataMapper.toUIContainer(uiContainer, container);
                uiSource = uiContainer;
            } else {
                Application app = null;
                UIApplicationList appList = uiApp.findFirstComponentOfType(UIApplicationList.class);
                app = appList.getApplication(sourceId);
                @SuppressWarnings("unchecked")
                ApplicationType<Object> applicationType = app.getType();

                //
                @SuppressWarnings("unchecked")
                UIPortlet<Object, ?> 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);

                // Hardcode on state to fix error while drag/drop Dashboard
                if ("dashboard/DashboardPortlet".equals(app.getContentId())) {
                    TransientApplicationState<Object> state = new TransientApplicationState<Object>(app.getContentId());
                    uiPortlet.setState(new PortletState<Object>(state, applicationType));
                } else {
                    ApplicationState<Object> 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<Object>(state, applicationType));
                }
                uiPortlet.setPortletInPortal(uiTarget instanceof UIPortal);
View Full Code Here


         uiPage = uiPortalToolPanel.findFirstComponentOfType(UIPage.class);
      }

      String applicationId = event.getRequestContext().getRequestParameter(UIComponent.OBJECTID);

      Application application = event.getSource().getApplication(applicationId);
      ApplicationType appType = application.getType();
      String portletName = application.getApplicationName();
//      String appGroup = application.getApplicationGroup();

      // TODO review windowId for eXoWidget and eXoApplication
      UIComponent component = null;
      if (ApplicationType.GADGET.equals(appType))
      {
         UIGadget uiGadget = uiPage.createUIComponent(event.getRequestContext(), UIGadget.class, null, null);

         uiGadget.setState(new TransientApplicationState<Gadget>(portletName));

         // Set Properties For gadget
         int posX = (int)(Math.random() * 400);
         int posY = (int)(Math.random() * 200);

         uiGadget.getProperties().put(UIApplication.locationX, String.valueOf(posX));
         uiGadget.getProperties().put(UIApplication.locationY, String.valueOf(posY));

         component = uiGadget;
      }
      else
      {
         boolean remote = ApplicationType.WSRP_PORTLET.equals(appType);

         UIPortlet uiPortlet = uiPage.createUIComponent(UIPortlet.class, null, null);

         CloneApplicationState appState;
         Object appId;
         if (!remote)
         {
            appState = new CloneApplicationState<Portlet>(application.getId());
         }
         else
         {
            appState = new CloneApplicationState<WSRPState>(application.getId());
         }

         ApplicationType applicationType = remote ? ApplicationType.WSRP_PORTLET : ApplicationType.PORTLET;
         PortletState portletState = new PortletState(appState, applicationType);

         uiPortlet.setState(portletState);
         uiPortlet.setPortletInPortal(false);

         if (atStartup)
         {
            uiPortlet.getProperties().setProperty("appStatus", "HIDE");
         }

         if (application != null)
         {
            String displayName = application.getDisplayName();
            if (displayName != null)
            {
               uiPortlet.setTitle(displayName);
            }
            else if (portletName != null)
            {
               uiPortlet.setTitle(portletName);
            }
            uiPortlet.setDescription(application.getDescription());
            List<String> accessPers = application.getAccessPermissions();
            String[] accessPermissions = accessPers.toArray(new String[accessPers.size()]);
            uiPortlet.setAccessPermissions(accessPermissions);

            component = uiPortlet;
         }
View Full Code Here

               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);
               if (app.getDisplayName() != null)
               {
                  uiPortlet.setTitle(app.getDisplayName());
               }
               else if (app.getApplicationName() != null)
               {
                  uiPortlet.setTitle(app.getApplicationName());
               }
               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
               {
                  CloneApplicationState state = new CloneApplicationState<Object>(app.getStorageId());
                  uiPortlet.setState(new PortletState(state, applicationType));
               }
               uiPortlet.setPortletInPortal(uiTarget instanceof UIPortal);
               uiPortlet.setShowEditControl(true);
               uiSource = uiPortlet;
View Full Code Here

        category.setCreatedDate(categoryDef.getCreationDate());
        category.setModifiedDate(categoryDef.getLastModificationDate());

        //
        for (ContentDefinition contentDef : categoryDef.getContentList()) {
            Application application = load(contentDef);
            if (isApplicationType(application, appTypes)) {
                category.getApplications().add(application);
            }
        }
View Full Code Here

        //
        ContentType<?> contentType = customization.getType();
        ApplicationType<?> applicationType = ApplicationType.getType(contentType);

        //
        Application application = new Application();
        application.setId(contentDef.getCategory().getName() + "/" + contentDef.getName());
        application.setCategoryName(contentDef.getCategory().getName());
        application.setType(applicationType);
        application.setApplicationName(contentDef.getName());
        application.setIconURL(getApplicationIconURL(contentDef));
        application.setDisplayName(contentDef.getDisplayName());
        application.setDescription(contentDef.getDescription());
        application.setAccessPermissions(new ArrayList<String>(contentDef.getAccessPermissions()));
        application.setCreatedDate(contentDef.getCreationDate());
        application.setModifiedDate(contentDef.getLastModificationDate());
        application.setStorageId(customization.getId());
        application.setContentId(customization.getContentId());
        return application;
    }
View Full Code Here

      category.setModifiedDate(categoryDef.getLastModificationDate());

      //
      for (ContentDefinition contentDef : categoryDef.getContentList())
      {
         Application application = load(contentDef);
         if (isApplicationType(application, appTypes))
         {
            category.getApplications().add(application);
         }
      }
View Full Code Here

      //
      ContentType<?> contentType = customization.getType();
      ApplicationType<?> applicationType = ApplicationType.getType(contentType);

      //
      Application application = new Application();
      application.setId(contentDef.getCategory().getName() + "/" + contentDef.getName());
      application.setCategoryName(contentDef.getCategory().getName());
      application.setType(applicationType);
      application.setApplicationName(contentDef.getName());
      application.setIconURL(getApplicationIconURL(contentDef));
      application.setDisplayName(contentDef.getDisplayName());
      application.setDescription(contentDef.getDescription());
      application.setAccessPermissions(new ArrayList<String>(contentDef.getAccessPermissions()));
      application.setCreatedDate(contentDef.getCreationDate());
      application.setModifiedDate(contentDef.getLastModificationDate());
      application.setStorageId(customization.getId());
      application.setContentId(customization.getContentId());
      return application;
   }
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));
            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

        category.setCreatedDate(categoryDef.getCreationDate());
        category.setModifiedDate(categoryDef.getLastModificationDate());

        //
        for (ContentDefinition contentDef : categoryDef.getContentList()) {
            Application application = load(contentDef);
            if (isApplicationType(application, appTypes)) {
                category.getApplications().add(application);
            }
        }
View Full Code Here

        //
        ContentType<?> contentType = customization.getType();
        ApplicationType<?> applicationType = ApplicationType.getType(contentType);

        //
        Application application = new Application();
        /**
         * Apps ID has a "/" character that is rendered into id markup.
         * We need to workaround it to be W3C compliant.
         */
        application.setId(contentDef.getCategory().getName() + "_slash_" + contentDef.getName());
        application.setCategoryName(contentDef.getCategory().getName());
        application.setType(applicationType);
        application.setApplicationName(contentDef.getName());
        application.setIconURL(getApplicationIconURL(contentDef));
        application.setDisplayName(contentDef.getDisplayName());
        application.setDescription(contentDef.getDescription());
        application.setAccessPermissions(new ArrayList<String>(contentDef.getAccessPermissions()));
        application.setCreatedDate(contentDef.getCreationDate());
        application.setModifiedDate(contentDef.getLastModificationDate());
        application.setStorageId(customization.getId());
        application.setContentId(customization.getContentId());
        return application;
    }
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.