Examples of GadgetRegistryService


Examples of org.exoplatform.application.gadget.GadgetRegistryService

   {
      WebAppController webController = getApplicationComponent(WebAppController.class);
      GadgetApplication application = webController.getApplication("eXoGadgets/" + gadgetId);
      if (application == null)
      {
         GadgetRegistryService gadgetService = getApplicationComponent(GadgetRegistryService.class);
         Gadget model;
         try
         {
            model = gadgetService.getGadget(gadgetId);
         }
         catch (Exception ex)
         {
            return null;
         }
View Full Code Here

Examples of org.exoplatform.application.gadget.GadgetRegistryService

      public void execute(Event<UIAddGadget> event) throws Exception
      {
         UIAddGadget uiForm = event.getSource();
         WebuiRequestContext context = event.getRequestContext();
         GadgetRegistryService service = uiForm.getApplicationComponent(GadgetRegistryService.class);
         String url = uiForm.getUIStringInput(FIELD_URL).getValue();
         String name = "gadget" + url.hashCode();
         UIGadgetManagement uiManagement = uiForm.getParent();
         // check url exist
         boolean urlExist = checkUrlExist(uiManagement.getGadgets(), url);
         if (urlExist == true)
         {
            UIApplication uiApp = context.getUIApplication();
            uiApp.addMessage(new ApplicationMessage("UIAddGadget.label.urlExist", null));
            return;
         }
         Gadget gadget;
         try
         {
            gadget = GadgetUtil.toGadget(name, url, false);
         }
         catch (Exception e)
         {
            UIApplication uiApp = context.getUIApplication();
            uiApp.addMessage(new ApplicationMessage("UIAddGadget.label.urlError", new String[]{url}));
            return;
         }
         service.saveGadget(gadget);
         uiManagement.initData();
         uiManagement.setSelectedGadget(name);
         context.addUIComponentToUpdateByAjax(uiManagement);
      }
View Full Code Here

Examples of org.exoplatform.application.gadget.GadgetRegistryService

      {
         UIGadgetEditor uiForm = event.getSource();
         UIGadgetManagement uiManagement = uiForm.getParent();
         String gadgetName;
         String text = uiForm.getUIFormTextAreaInput(UIGadgetEditor.FIELD_SOURCE).getValue();
         GadgetRegistryService service = uiForm.getApplicationComponent(GadgetRegistryService.class);
         SourceStorage sourceStorage = uiForm.getApplicationComponent(SourceStorage.class);
         boolean isEdit = uiForm.isEdit();
         if (isEdit)
         {
           gadgetName = uiForm.getSourceFullName();
         }
         else
         {
           gadgetName = uiForm.getUIStringInput(UIGadgetEditor.FIELD_NAME).getValue();
         }

         //
         Gadget gadget = service.getGadget(gadgetName);
        
         if(isEdit) {
           if (gadget == null)
             {
                UIApplication uiApp = event.getRequestContext().getUIApplication();
                uiApp.addMessage(new ApplicationMessage("gadget.msg.changeNotExist", null, ApplicationMessage.WARNING));
                uiManagement.reload();
                return;
             }
         }
         else {
          // If gadget is null we need to create it first
             if (gadget == null)
             {
                gadget = new Gadget();
                gadget.setName(gadgetName);

                // Those data will be taken from the gadget XML anyway
                gadget.setDescription("");
                gadget.setThumbnail("");
                gadget.setLocal(true);
                gadget.setTitle("");
                gadget.setReferenceUrl("");

                // Save gadget with empty data first
                service.saveGadget(gadget);
             }
             else {
             UIApplication uiApp = event.getRequestContext().getUIApplication();
                 uiApp.addMessage(new ApplicationMessage("UIGadgetEditor.gadget.msg.gadgetIsExist", null, ApplicationMessage.WARNING));
                 return;
View Full Code Here

Examples of org.exoplatform.application.gadget.GadgetRegistryService

      {
         UIGadgetInfo uiInfo = event.getSource();
         WebuiRequestContext ctx = event.getRequestContext();
         UIGadgetManagement uiManagement = uiInfo.getParent();
         Gadget gadget = uiInfo.getGadget();
         GadgetRegistryService service = uiInfo.getApplicationComponent(GadgetRegistryService.class);
         if (service.getGadget(gadget.getName()) == null)
         {
            UIApplication uiApp = ctx.getUIApplication();
            uiApp.addMessage(new ApplicationMessage("UIGadgetInfo.msg.gadgetNotExist", null));
            uiManagement.reload();
            return;
         }
         service.saveGadget(GadgetUtil.toGadget(gadget.getName(), gadget.getUrl(), gadget.isLocal()));
         uiManagement.initData();
         uiManagement.setSelectedGadget(gadget.getName());
         ctx.addUIComponentToUpdateByAjax(uiManagement);
      }
View Full Code Here

Examples of org.exoplatform.application.gadget.GadgetRegistryService

      {
         UIGadgetInfo uiInfo = event.getSource();
         Gadget gadget = uiInfo.getGadget();

         UIGadgetManagement uiManagement = uiInfo.getParent();
         GadgetRegistryService service = uiInfo.getApplicationComponent(GadgetRegistryService.class);
         if (service.getGadget(gadget.getName()) == null)
         {
            UIApplication uiApp = event.getRequestContext().getUIApplication();
            uiApp.addMessage(new ApplicationMessage("UIGadgetInfo.msg.gadgetNotExist", null));
            uiManagement.reload();
            return;
View Full Code Here

Examples of org.exoplatform.application.gadget.GadgetRegistryService

         return;
      }
      Collections.sort(applications, new Util.ApplicationComparator());

      //Correct IconUrl of gadget
      GadgetRegistryService gadgetService = getApplicationComponent(GadgetRegistryService.class);
      for (Application app : applications)
      {
         if (ApplicationType.GADGET.equals(app.getType()))
         {
            Gadget gadget = gadgetService.getGadget(app.getApplicationName());
            if (gadget != null)
               app.setIconURL(gadget.getThumbnail());
         }
      }
View Full Code Here

Examples of org.exoplatform.application.gadget.GadgetRegistryService

            UIAddGadgetForm uiForm = event.getSource();

            UIDashboard uiDashboard = uiForm.getAncestorOfType(UIDashboard.class);
            UIDashboardContainer uiContainer = uiDashboard.getChild(UIDashboardContainer.class);

            GadgetRegistryService service = uiForm.getApplicationComponent(GadgetRegistryService.class);
            String url = uiForm.getUIStringInput(FIELD_URL).getValue();
            UIApplication uiApplication = context.getUIApplication();
            if (url == null || url.trim().length() == 0) {
                uiApplication.addMessage(new ApplicationMessage("UIDashboard.msg.required", null));
                return;
            }
            url = url.trim();
            if (!url.matches(URLValidator.URL_REGEX)) {
                uiApplication.addMessage(new ApplicationMessage("UIDashboard.msg.notUrl", null));
                return;
            }
            Gadget gadget;
            UIGadget uiGadget;

            // TODO check the way we create the unique ID, is it really unique?
            try {
                String name = "gadget" + url.hashCode();
                gadget = GadgetUtil.toGadget(name, url, false);
                service.saveGadget(gadget);
                uiGadget = uiForm.createUIComponent(context, UIGadget.class, null, null);
                uiGadget.setState(new TransientApplicationState<org.exoplatform.portal.pom.spi.gadget.Gadget>(gadget.getName()));
            } catch (Exception e) {
                String aggregatorId = uiDashboard.getAggregatorId();
                gadget = service.getGadget(aggregatorId);
                // TODO make sure it's an rss feed
                // TODO make sure that we did not add it already
                uiGadget = uiForm.createUIComponent(context, UIGadget.class, null, null);

                org.exoplatform.portal.pom.spi.gadget.Gadget contentState = new org.exoplatform.portal.pom.spi.gadget.Gadget();
View Full Code Here

Examples of org.exoplatform.application.gadget.GadgetRegistryService

      if (selectedCategory == null)
         return null;
      List<Application> apps = selectedCategory.getApplications();

      //Correct IconURL of Gadget
      GadgetRegistryService gadgetService = getApplicationComponent(GadgetRegistryService.class);
      for (Application app : apps)
      {
         if (ApplicationType.GADGET.equals(app.getType()))
         {
            try
            {
               Gadget gadget;
               gadget = gadgetService.getGadget(app.getApplicationName());
               if (gadget != null)
                  app.setIconURL(gadget.getThumbnail());
            }
            catch (Exception e)
            {
View Full Code Here

Examples of org.exoplatform.application.gadget.GadgetRegistryService

   public static String fetchGagdetMetadata(String urlStr)
   {
      String result = null;

      ExoContainer container = ExoContainerContext.getCurrentContainer();
      GadgetRegistryService gadgetService =
         (GadgetRegistryService)container.getComponentInstanceOfType(GadgetRegistryService.class);
      try
      {
         String data =
            "{\"context\":{\"country\":\"" + gadgetService.getCountry() + "\",\"language\":\""
               + gadgetService.getLanguage() + "\"},\"gadgets\":[" + "{\"moduleId\":" + gadgetService.getModuleId()
               + ",\"url\":\"" + urlStr + "\",\"prefs\":[]}]}";
         // Send data
         String gadgetServer = getGadgetServerUrl();
         URL url = new URL(gadgetServer + (gadgetServer.endsWith("/") ? "" : "/") + "metadata");
         URLConnection conn = url.openConnection();
View Full Code Here

Examples of org.exoplatform.application.gadget.GadgetRegistryService

   }

   static private String getHostName()
   {
      ExoContainer container = ExoContainerContext.getCurrentContainer();
      GadgetRegistryService gadgetService =
         (GadgetRegistryService)container.getComponentInstanceOfType(GadgetRegistryService.class);
      return gadgetService.getHostName();
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.