Package org.exoplatform.portal.config.model

Examples of org.exoplatform.portal.config.model.TransientApplicationState


      IBindingFactory bfact = BindingDirectory.getFactory(PortalConfig.class);
      IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
      Application<Portlet> app =
         (Application<Portlet>)uctx.unmarshalDocument(new FileInputStream(
            "src/test/resources/jibx/portlet-application.xml"), null);
      TransientApplicationState portletState = (TransientApplicationState)app.getState();
      assertNotNull(portletState);
      assertEquals("web/BannerPortlet", portletState.getContentId());
      Portlet preferences = (Portlet)portletState.getContentState();
      assertEquals(new PortletBuilder().add("template", "template_value").build(), preferences);
   }
View Full Code Here


    }

    public <S> String getId(ApplicationState<S> state) throws Exception {
        String contentId;
        if (state instanceof TransientApplicationState) {
            TransientApplicationState tstate = (TransientApplicationState) state;
            contentId = tstate.getContentId();
        } else if (state instanceof PersistentApplicationState) {
            PersistentApplicationState pstate = (PersistentApplicationState) state;
            contentId = pomMgr.execute(new PreferencesTask.GetContentId<S>(pstate.getStorageId()));
        } else if (state instanceof CloneApplicationState) {
            CloneApplicationState cstate = (CloneApplicationState) state;
View Full Code Here

   public <S> String getId(ApplicationState<S> state) throws Exception
   {
      String contentId;
      if (state instanceof TransientApplicationState)
      {
         TransientApplicationState tstate = (TransientApplicationState)state;
         contentId = tstate.getContentId();
      }
      else if (state instanceof PersistentApplicationState)
      {
         PersistentApplicationState pstate = (PersistentApplicationState)state;
         contentId = pomMgr.execute(new PreferencesTask.GetContentId<S>(pstate.getStorageId()));
View Full Code Here

         }
      }
      else if (object instanceof Application)
      {
         Application application = (Application)object;
         TransientApplicationState applicationState = (TransientApplicationState)application.getState();
         if (applicationState != null
            && (applicationState.getOwnerType() == null || applicationState.getOwnerId() == null))
         {
            applicationState.setOwnerType(ownerType);
            applicationState.setOwnerId(ownerId);
         }
      }
   }
View Full Code Here

            for (ModelObject child : container.getChildren()) {
                updateOwnership(child, ownerType, ownerId);
            }
        } else if (object instanceof Application) {
            Application application = (Application) object;
            TransientApplicationState applicationState = (TransientApplicationState) application.getState();
            if (applicationState != null && (applicationState.getOwnerType() == null || applicationState.getOwnerId() == null)) {
                applicationState.setOwnerType(ownerType);
                applicationState.setOwnerId(ownerId);
            }
        }
    }
View Full Code Here

        //
        ctx.parsePastStartTag(m_uri, m_name);

        //
        Application<?> app;
        TransientApplicationState state;
        // Since we don't support dashboard's here, this only works for gadgets using the gadget wrapper portlet.
        if ("gadget-application".equals(m_name)) {
            ctx.parsePastStartTag(m_uri, "gadget");
            String gadgetName = ctx.parseElementText(m_uri, "gadget-ref");
            Gadget gadget = null;
            // Once the gadget portlet wrapper is able to use gadget userPref's, include parsing logic here.
            // Gadget gadget = new Gadget();
            // gadget.setUserPref();
            state = new TransientApplicationState<Gadget>(gadgetName, gadget);
            app = Application.createGadgetApplication();
            app.setState(state);
            ctx.parsePastEndTag(m_uri, "gadget");
        } else {
            String contentId;
            boolean isWSRP = false;
            if (ctx.isAt(m_uri, "wsrp")) {
                contentId = ctx.parseElementText(m_uri, "wsrp");
                app = Application.createWSRPApplication();
                isWSRP = true;
            } else {

                ctx.parsePastStartTag(m_uri, "portlet");
                String applicationName = ctx.parseElementText(m_uri, "application-ref");
                String portletName = ctx.parseElementText(m_uri, "portlet-ref");
                contentId = applicationName + "/" + portletName;
                app = Application.createPortletApplication();
            }

            if (ctx.isAt(m_uri, "preferences")) {
                PortletBuilder builder = new PortletBuilder();
                ctx.parsePastStartTag(m_uri, "preferences");
                while (ctx.isAt(m_uri, "preference")) {
                    Preference value = (Preference) ctx.unmarshalElement();
                    builder.add(value.getName(), value.getValues(), value.isReadOnly());
                }
                ctx.parsePastEndTag(m_uri, "preferences");
                state = new TransientApplicationState(contentId, builder.build());
            } else {
                state = new TransientApplicationState(contentId, null);
            }

            if (!isWSRP) {
                ctx.parsePastEndTag(m_uri, "portlet");
            }
View Full Code Here

                    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.
View Full Code Here

            for (ModelObject child : container.getChildren()) {
                updateOwnership(child, ownerType, ownerId);
            }
        } else if (object instanceof Application) {
            Application application = (Application) object;
            TransientApplicationState applicationState = (TransientApplicationState) application.getState();
            if (applicationState != null && (applicationState.getOwnerType() == null || applicationState.getOwnerId() == null)) {
                applicationState.setOwnerType(ownerType);
                applicationState.setOwnerId(ownerId);
            }
        }
    }
View Full Code Here

    }

    public <S> String getId(ApplicationState<S> state) throws Exception {
        String contentId;
        if (state instanceof TransientApplicationState) {
            TransientApplicationState tstate = (TransientApplicationState) state;
            contentId = tstate.getContentId();
        } else if (state instanceof PersistentApplicationState) {
            PersistentApplicationState pstate = (PersistentApplicationState) state;
            contentId = pomMgr.execute(new PreferencesTask.GetContentId<S>(pstate.getStorageId()));
        } else if (state instanceof CloneApplicationState) {
            CloneApplicationState cstate = (CloneApplicationState) state;
View Full Code Here

                    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.
View Full Code Here

TOP

Related Classes of org.exoplatform.portal.config.model.TransientApplicationState

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.