Package org.jboss.shrinkwrap.descriptor.api.portletapp20

Examples of org.jboss.shrinkwrap.descriptor.api.portletapp20.PortletDescriptor


            }
        }
    }

    private boolean processPortletXml(Archive<?> applicationArchive) {
        PortletDescriptor portletXml;
        try {
            portletXml = Descriptors.importAs(PortletDescriptor.class).fromStream(
                    applicationArchive.get("WEB-INF/portlet.xml").getAsset().openStream());

            if (null != portletXml) {
                PortletArchiveMetadata metadata = new PortletArchiveMetadata();
                List<PortletType<PortletDescriptor>> portlets = portletXml.getAllPortlet();
                for (PortletType<PortletDescriptor> portlet : portlets) {
                    metadata.addPortletName(portlet.getPortletName());
                }
                portletMetadata.set(metadata);
            }
View Full Code Here


    @Override
    public PortletArchive createSimplePortlet(Class<? extends Portlet> portletClass) {
        String name = portletClass.getSimpleName();

        PortletDescriptor desc = getOrCreatePortletDescriptor()
                .createPortlet()
                    .portletName(name)
                    .portletClass(portletClass.getName())
                    .createSupports()
                        .mimeType("text/html")
                        .portletMode(PortletMode.VIEW.toString())
                        .portletMode(PortletMode.EDIT.toString())
                        .portletMode(PortletMode.HELP.toString())
                        .up()
                    .getOrCreatePortletInfo()
                        .title(name)
                        .up()
                    .up();

        this.setPortletXML(new StringAsset(desc.exportAsString()));
        return covarientReturn();
    }
View Full Code Here

        return covarientReturn();
    }

    @Override
    public PortletArchive createSimplePortlet(Class<? extends Portlet> portletClass, String name, String title) {
        PortletDescriptor desc = getOrCreatePortletDescriptor()
                .createPortlet()
                    .portletName(name)
                    .portletClass(portletClass.getName())
                    .createSupports()
                        .mimeType("text/html")
                        .portletMode(PortletMode.VIEW.toString())
                        .portletMode(PortletMode.EDIT.toString())
                        .portletMode(PortletMode.HELP.toString())
                        .up()
                    .getOrCreatePortletInfo()
                        .title(title)
                        .up()
                    .up();

        this.setPortletXML(new StringAsset(desc.exportAsString()));
        return covarientReturn();
    }
View Full Code Here

        return covarientReturn();
    }

    @Override
    public PortletArchive createSimplePortlet(Class<? extends Portlet> portletClass, String name, String title, String mimeType, PortletMode... modes) {
        PortletDescriptor desc = getOrCreatePortletDescriptor()
                .createPortlet()
                    .portletName(name)
                    .portletClass(portletClass.getName())
                    .createSupports()
                        .mimeType(mimeType)
                        .portletMode(PortletMode.valuesAsString(modes))
                        .up()
                    .getOrCreatePortletInfo()
                        .title(title)
                        .up()
                    .up();

        this.setPortletXML(new StringAsset(desc.exportAsString()));
        return covarientReturn();
    }
View Full Code Here

        return covarientReturn();
    }

    @Override
    public PortletArchive createFacesPortlet(String name) {
        PortletDescriptor desc = getOrCreatePortletDescriptor()
                .createPortlet()
                    .portletName(name)
                    .portletClass(GENERIC_FACES_PORTLET_CLASS)
                    .createInitParam()
                        .name(DEFAULT_VIEW_ID_PARAM_NAME)
                        .value("/index.xhtml")
                        .up()
                    .createSupports()
                        .mimeType("text/html")
                        .portletMode(PortletMode.VIEW.toString())
                        .up()
                    .getOrCreatePortletInfo()
                        .title(name)
                        .up()
                    .up();

        this.setPortletXML(new StringAsset(desc.exportAsString()));
        return covarientReturn();
    }
View Full Code Here

        return covarientReturn();
    }

    @Override
    public PortletArchive createFacesPortlet(String name, String title) {
        PortletDescriptor desc = getOrCreatePortletDescriptor()
                .createPortlet()
                .portletName(name)
                .portletClass(GENERIC_FACES_PORTLET_CLASS)
                .createInitParam()
                .name(DEFAULT_VIEW_ID_PARAM_NAME)
                .value("/index.xhtml")
                .up()
                .createSupports()
                .mimeType("text/html")
                .portletMode(PortletMode.VIEW.toString())
                .up()
                .getOrCreatePortletInfo()
                .title(title)
                .up()
                .up();

        this.setPortletXML(new StringAsset(desc.exportAsString()));
        return covarientReturn();
    }
View Full Code Here

    @Override
    public PortletArchive createFacesPortlet(String name, String title, String viewModeViewId) {
        viewModeViewId = checkForLeadingSlash(viewModeViewId);

        PortletDescriptor desc = getOrCreatePortletDescriptor()
                .createPortlet()
                    .portletName(name)
                    .portletClass(GENERIC_FACES_PORTLET_CLASS)
                    .createInitParam()
                        .name(DEFAULT_VIEW_ID_PARAM_NAME)
                        .value(viewModeViewId)
                        .up()
                    .createSupports()
                        .mimeType("text/html")
                        .portletMode(PortletMode.VIEW.toString())
                        .up()
                    .getOrCreatePortletInfo()
                        .title(title)
                        .up()
                    .up();

        this.setPortletXML(new StringAsset(desc.exportAsString()));
        return covarientReturn();
    }
View Full Code Here

    @Override
    public PortletArchive createFacesPortlet(String name, String title, String viewModeViewId, String editModeViewId) {
        viewModeViewId = checkForLeadingSlash(viewModeViewId);
        editModeViewId = checkForLeadingSlash(editModeViewId);

        PortletDescriptor desc = getOrCreatePortletDescriptor()
                .createPortlet()
                    .portletName(name)
                    .portletClass(GENERIC_FACES_PORTLET_CLASS)
                    .createInitParam()
                        .name(DEFAULT_VIEW_ID_PARAM_NAME)
                        .value(viewModeViewId)
                        .up()
                    .createInitParam()
                        .name(DEFAULT_EDIT_ID_PARAM_NAME)
                        .value(editModeViewId)
                        .up()
                    .createSupports()
                        .mimeType("text/html")
                        .portletMode(PortletMode.VIEW.toString())
                        .portletMode(PortletMode.EDIT.toString())
                        .up()
                    .getOrCreatePortletInfo()
                        .title(title)
                        .up()
                    .up();

        this.setPortletXML(new StringAsset(desc.exportAsString()));
        return covarientReturn();
    }
View Full Code Here

    public PortletArchive createFacesPortlet(String name, String title, String viewModeViewId, String editModeViewId, String helpModeViewId) {
        viewModeViewId = checkForLeadingSlash(viewModeViewId);
        editModeViewId = checkForLeadingSlash(editModeViewId);
        helpModeViewId = checkForLeadingSlash(helpModeViewId);

        PortletDescriptor desc = getOrCreatePortletDescriptor()
                .createPortlet()
                    .portletName(name)
                    .portletClass(GENERIC_FACES_PORTLET_CLASS)
                    .createInitParam()
                        .name(DEFAULT_VIEW_ID_PARAM_NAME)
                        .value(viewModeViewId)
                        .up()
                    .createInitParam()
                        .name(DEFAULT_EDIT_ID_PARAM_NAME)
                        .value(editModeViewId)
                        .up()
                    .createInitParam()
                        .name(DEFAULT_HELP_ID_PARAM_NAME)
                        .value(helpModeViewId)
                        .up()
                    .createSupports()
                        .mimeType("text/html")
                        .portletMode(PortletMode.VIEW.toString())
                        .portletMode(PortletMode.EDIT.toString())
                        .portletMode(PortletMode.HELP.toString())
                        .up()
                    .getOrCreatePortletInfo()
                        .title(title)
                        .up()
                    .up();

        this.setPortletXML(new StringAsset(desc.exportAsString()));
        return covarientReturn();
    }
View Full Code Here

    private String checkForLeadingSlash(String viewId) {
        return viewId.indexOf("/") != 0 ? "/" + viewId : viewId;
    }

    private PortletDescriptor getOrCreatePortletDescriptor() {
        PortletDescriptor descriptor;

        Node portletXmlNode = this.get(PATH_PORTLET_DESCRIPTOR);
        if (null != portletXmlNode) {
            descriptor = Descriptors.importAs(PortletDescriptor.class).fromStream(portletXmlNode.getAsset().openStream());
            this.delete(PATH_PORTLET_DESCRIPTOR);
View Full Code Here

TOP

Related Classes of org.jboss.shrinkwrap.descriptor.api.portletapp20.PortletDescriptor

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.