Package com.volantis.mcs.context

Examples of com.volantis.mcs.context.MetaData


        return requestContextMock;
    }

    private Object getMetaData(final String id) {
        MetaData metaData = (MetaData) metaDataMap.get(id);
        if (metaData == null) {
            metaData = new MetaData();
            metaDataMap.put(id, metaData);
        }
        return metaData;
    }
View Full Code Here


                "back link text"});
        endElement("meta");

        assertEquals(1, metaDataMap.size());

        final MetaData metaData = (MetaData) metaDataMap.get("fragment-link-id");

        DOMOutputBuffer value = (DOMOutputBuffer) metaData.getPropertyValue(
            MetaPropertyHandlerFactory.FRAGMENT_LINK_LABEL);
        assertNotNull(value);
        Text head = (Text) value.getRoot().getHead();
        assertEquals("link text 1",
            new String(head.getContents(), 0, head.getLength()));
        Element heading = (Element) head.getNext();
        Text headingText = (Text) heading.getHead();
        assertEquals("link heading",
            new String(headingText.getContents(), 0, headingText.getLength()));
        Text tail = (Text) heading.getNext();
        assertEquals("link text 2",
            new String(tail.getContents(), 0, tail.getLength()));
        assertNull(tail.getNext());

        value = (DOMOutputBuffer) metaData.getPropertyValue(
            MetaPropertyHandlerFactory.ENCLOSING_FRAGMENT_LINK_LABEL);
        assertNotNull(value);
        head = (Text) value.getRoot().getHead();
        assertEquals("back link text",
            new String(head.getContents(), 0, head.getLength()));
View Full Code Here

        }

        checkContent(content, context);

        // store the content
        final MetaData metaData;
        if (id == null) {
            metaData = context.getPageMetaData();
        } else {
            metaData = context.getElementMetaData(id);
        }
        if (multipleInstancesAllowed()) {
            metaData.addPropertyValue(propertyName, content);
        } else {
            if (metaData.setPropertyValue(propertyName, content) != null) {
                throw new XDIMEException(LOCALIZER.format(
                    "meta-property-occurrence-error", propertyName));
            }
        }
    }
View Full Code Here

        super.process(content, context, id, propertyName);

        MarinerPageContext ctx = ContextInternals.getMarinerPageContext(
            context.getInitialRequestContext());

        MetaData metaData = context.getPageMetaData();
        MetaAttributes attributes = new MetaAttributes();

        //add all search engine meta tags i.e. description, keywords, author       
        if(MetaPropertyHandlerFactory.DESCRIPTION.equals(propertyName)
                &&  DevicePolicyConstants.FULL_SUPPORT_POLICY_VALUE
                .equals(ctx.getDevicePolicyValue(DevicePolicyConstants.X_ELEMENT_SUPPORTS_META_DESCRIPTION))) {

            attributes.setName(MetaPropertyHandlerFactory.DESCRIPTION);
            attributes.setContent((String) metaData.getPropertyValue(MetaPropertyHandlerFactory.DESCRIPTION));
            ctx.getProtocol().writeMeta(attributes);           
        }   

        if(MetaPropertyHandlerFactory.KEYWORDS.equals(propertyName)
                &&  DevicePolicyConstants.FULL_SUPPORT_POLICY_VALUE
                .equals(ctx.getDevicePolicyValue(DevicePolicyConstants.X_ELEMENT_SUPPORTS_META_KEYWORDS))) {

            attributes.setName(MetaPropertyHandlerFactory.KEYWORDS);
            String value = null;
            if(metaData.getPropertyValue(MetaPropertyHandlerFactory.KEYWORDS) != null) {
                value = normalize((String) metaData.getPropertyValue(MetaPropertyHandlerFactory.KEYWORDS));
            }
            attributes.setContent(value);
            ctx.getProtocol().writeMeta(attributes);
        }           

        if(MetaPropertyHandlerFactory.AUTHOR.equals(propertyName)
                &&  DevicePolicyConstants.FULL_SUPPORT_POLICY_VALUE
                .equals(ctx.getDevicePolicyValue(DevicePolicyConstants.X_ELEMENT_SUPPORTS_META_AUTHOR))) {
           
            attributes.setName(AUTHOR_HTML_META);
            attributes.setContent((String) metaData.getPropertyValue(MetaPropertyHandlerFactory.AUTHOR));
            ctx.getProtocol().writeMeta(attributes);
        }
    }
View Full Code Here

                                        String containerName) {

        if (containerInstance == null && containerName != null &&
                elementID != null && pageContext.getCurrentFragment() != null) {

            final MetaData metaData = pageContext.getElementMetaData(elementID);

            // get the link meta data associated with this container
            OutputBuffer linkToLabel = (OutputBuffer)
                    metaData.getPropertyValue(
                            MetaPropertyHandlerFactory.FRAGMENT_LINK_LABEL);
            OutputBuffer linkFromLabel = (OutputBuffer)
                    metaData.getPropertyValue(
                            MetaPropertyHandlerFactory.ENCLOSING_FRAGMENT_LINK_LABEL);

            // If no labels have been specified using meta data then there is
            // nothing to update the fragment instance with and so
            if (linkToLabel != null || linkFromLabel != null) {
View Full Code Here

TOP

Related Classes of com.volantis.mcs.context.MetaData

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.