Examples of UnmarshallingContext


Examples of org.jibx.runtime.impl.UnmarshallingContext

    public boolean isPresent(IUnmarshallingContext ctx) throws JiBXException {
        return ctx.isAt(m_uri, m_name);
    }

    public Object unmarshal(Object obj, IUnmarshallingContext ictx) throws JiBXException {
        UnmarshallingContext ctx = (UnmarshallingContext) ictx;
        if (!ctx.isAt(m_uri, m_name)) {
            ctx.throwStartTagNameError(m_uri, m_name);
        }

        //
        if (obj != null) {
            throw new AssertionError("That should not happen");
        }

        // Id
        String id = optionalAttribute(ctx, "id");

        //
        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");
            }

            app.setState(state);
        }

        //
        nextOptionalTag(ctx, "application-type");
        String theme = nextOptionalTag(ctx, "theme");
        String title = nextOptionalTag(ctx, "title");
        String accessPermissions = nextOptionalTag(ctx, "access-permissions");
        boolean showInfoBar = nextOptionalBooleanTag(ctx, "show-info-bar", true);
        boolean showApplicationState = nextOptionalBooleanTag(ctx, "show-application-state", true);
        boolean showApplicationMode = nextOptionalBooleanTag(ctx, "show-application-mode", true);
        String description = nextOptionalTag(ctx, "description");
        String icon = nextOptionalTag(ctx, "icon");
        String width = nextOptionalTag(ctx, "width");
        String height = nextOptionalTag(ctx, "height");

        //
        Properties properties = null;
        if (ctx.isAt(m_uri, "properties")) {
            properties = (Properties) ctx.unmarshalElement();
        }

        //
        ctx.parsePastEndTag(m_uri, m_name);

        //
        app.setId(id);
        app.setTheme(theme);
        app.setTitle(title);
View Full Code Here

Examples of org.jibx.runtime.impl.UnmarshallingContext

        return new MarshallingContext(EMPTY_STRINGS, EMPTY_STRINGS, EMPTY_STRINGS, this);
    }

    public IUnmarshallingContext createUnmarshallingContext()
        throws JiBXException {
        return new UnmarshallingContext(0, EMPTY_STRINGS, EMPTY_STRINGS, EMPTY_STRINGS, EMPTY_STRINGS, this);
    }
View Full Code Here

Examples of org.jibx.runtime.impl.UnmarshallingContext

    public Container getSharedLayout() throws Exception {
        String path = "war:/conf/portal/portal/sharedlayout.xml";
        String out = IOUtil.getStreamContentAsString(confManager_.getInputStream(path));
        ByteArrayInputStream is = new ByteArrayInputStream(out.getBytes("UTF-8"));
        IBindingFactory bfact = BindingDirectory.getFactory(Container.class);
        UnmarshallingContext uctx = (UnmarshallingContext) bfact.createUnmarshallingContext();
        uctx.setDocument(is, null, "UTF-8", false);
        Container container = (Container) uctx.unmarshalElement();
        generateStorageName(container);
        return container;
    }
View Full Code Here

Examples of org.jibx.runtime.impl.UnmarshallingContext

     */
    public boolean isPresent(IUnmarshallingContext iUnmarshallingContext)
        throws JiBXException {

        boolean result = false;
        UnmarshallingContext ctx =
            (UnmarshallingContext) iUnmarshallingContext;
        if (ctx.toStart().equals(name)) {
            result = true;
        }

        return result;
    }
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.