Package org.apache.lenya.cms.metadata

Examples of org.apache.lenya.cms.metadata.MetaData


    protected void setMetaData(Document document) throws MetaDataException {

        if (document == null)
            throw new IllegalArgumentException("parameter document may not be null");

        MetaData dcMetaData = document.getMetaData(DublinCore.DC_NAMESPACE);
        dcMetaData.setValue(DublinCore.ELEMENT_TITLE, document.getName());
        dcMetaData.setValue(DublinCore.ELEMENT_CREATOR, "");
        dcMetaData.setValue(DublinCore.ELEMENT_PUBLISHER, "");
        dcMetaData.setValue(DublinCore.ELEMENT_SUBJECT, "");
        dcMetaData.setValue(DublinCore.ELEMENT_DATE, "");
        dcMetaData.setValue(DublinCore.ELEMENT_RIGHTS, "");
        dcMetaData.setValue(DublinCore.ELEMENT_LANGUAGE, document.getLanguage());
    }
View Full Code Here


    protected void setMetaData(Document document) throws MetaDataException {

        if (document == null)
            throw new IllegalArgumentException("parameter document may not be null");

        MetaData dcMetaData = document.getMetaData(DublinCore.DC_NAMESPACE);
        dcMetaData.setValue(DublinCore.ELEMENT_TITLE, document.getName());
        dcMetaData.setValue(DublinCore.ELEMENT_CREATOR, "");
        dcMetaData.setValue(DublinCore.ELEMENT_PUBLISHER, "");
        dcMetaData.setValue(DublinCore.ELEMENT_SUBJECT, "");
        dcMetaData.setValue(DublinCore.ELEMENT_DATE, "");
        dcMetaData.setValue(DublinCore.ELEMENT_RIGHTS, "");
        dcMetaData.setValue(DublinCore.ELEMENT_LANGUAGE, document.getLanguage());
    }
View Full Code Here

       
        Document doc = publication.getArea(AREA).getSite().getNode(PATH).getLink(LANGUAGE).getDocument();
       
        doc.getRepositoryNode().lock();
       
        MetaData dcCore = doc.getMetaData(DublinCore.DC_NAMESPACE);
        String title = dcCore.getFirstValue(DublinCore.ELEMENT_TITLE);
        String subject = dcCore.getFirstValue(DublinCore.ELEMENT_SUBJECT);
        String creator = dcCore.getFirstValue(DublinCore.ELEMENT_CREATOR);
       
        if (creator == null) {
            creator = "test";
        }

        String newCreator = creator + "-test";
        dcCore.setValue(DublinCore.ELEMENT_CREATOR, newCreator);

        Document doc2 = publication.getArea(AREA).getSite().getNode(PATH).getLink(LANGUAGE).getDocument();

        MetaData dcCore2 = doc2.getMetaData(DublinCore.DC_NAMESPACE);
        assertEquals(title, dcCore2.getFirstValue(DublinCore.ELEMENT_TITLE));
        assertEquals(subject, dcCore2.getFirstValue(DublinCore.ELEMENT_SUBJECT));
        assertFalse(creator.equals(dcCore2.getFirstValue(DublinCore.ELEMENT_CREATOR)));
        assertEquals(newCreator, dcCore2.getFirstValue(DublinCore.ELEMENT_CREATOR));
       
        doc.getRepositoryNode().unlock();
    }
View Full Code Here

        final ByteArrayOutputStream sourceBos = new ByteArrayOutputStream();
        IOUtils.copy(inputStream, sourceBos);

        InputStream input = new ByteArrayInputStream(sourceBos.toByteArray());

        MetaData mediaMeta = null;

        OutputStream destOutputStream = null;
        try {
            mediaMeta = document.getMetaData(MEDIA_METADATA_NAMESPACE);
            addResourceMeta(fileName, mimeType, input, mediaMeta);
View Full Code Here

            Element dcElement = helper.getFirstChild(metaElement, "dc");
            NamespaceHelper dcHelper = new NamespaceHelper(dcNamespace, "dc", xml);
            Element[] dcElements = dcHelper.getChildren(dcElement);

            MetaData meta = newDoc.getMetaData(dcNamespace);
            for (int i = 0; i < dcElements.length; i++) {
                String key = dcElements[i].getLocalName();
                String value = DocumentHelper.getSimpleElementText(dcElements[i]);
                meta.setValue(key, value);
            }
           
        } catch (Exception e) {
            throw new RuntimeException(e);
        } finally {
View Full Code Here

            super.startElement(uri, localName, qName, attr);
        }
    }

    protected boolean isFolderNode(Document doc) throws MetaDataException {
        MetaData meta = doc.getMetaData(NAMESPACE);
        String value = meta.getFirstValue(ELEM_FOLDER_NODE);
        boolean isFolderNode = value != null && Boolean.valueOf(value).booleanValue();
        return isFolderNode;
    }
View Full Code Here

        boolean isFolderNode = value != null && Boolean.valueOf(value).booleanValue();
        return isFolderNode;
    }

    protected String getExternalLink(Document doc) throws MetaDataException {
        MetaData meta = doc.getMetaData(NAMESPACE);
        return meta.getFirstValue(ELEM_EXTERNAL_LINK);
    }
View Full Code Here

    /**
     * @see org.apache.lenya.workflow.Workflowable#getVersions()
     */
    public Version[] getVersions() {
        try {
            MetaData meta = this.document.getMetaData(METADATA_NAMESPACE);
           
            org.apache.lenya.cms.repository.History history = this.document.getRepositoryNode().getHistory();
            boolean checkedIn = history.getRevisionNumbers().length > 0;
            if (this.versions == null || (checkedIn && history.getLatestRevision().getNumber() > this.revision)) {
                String[] versionStrings = meta.getValues(METADATA_VERSION);
                this.versions = new Version[versionStrings.length];
               
                SortedMap number2version = new TreeMap();
               
                for (int i = 0; i < versionStrings.length; i++) {
View Full Code Here

        try {
            String[] areas = getDocument().getPublication().getAreaNames();
            for (int i = 0; i < areas.length; i++) {
                if (getDocument().existsAreaVersion(areas[i])) {
                    Document doc = getDocument().getAreaVersion(areas[i]);
                    MetaData meta = doc.getMetaData(METADATA_NAMESPACE);
                    meta.addValue(METADATA_VERSION, versionString);
                }
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
View Full Code Here

     */
    public Date getExpires() throws DocumentException {
        Date expires = null;
        long secs = 0;

        MetaData metaData = null;
        String expiresMeta = null;
        try {
            metaData = this.getMetaData(METADATA_NAMESPACE);
            expiresMeta = metaData.getFirstValue("expires");
        } catch (MetaDataException e) {
            throw new DocumentException(e);
        }
        if (expiresMeta != null) {
            secs = Long.parseLong(expiresMeta);
View Full Code Here

TOP

Related Classes of org.apache.lenya.cms.metadata.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.