Package org.apache.lenya.cms.metadata

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


            document.setResourceType(documentType);
            document.setSourceExtension(extension);
            document.setMimeType(mimeType);

            // Write Lenya-internal meta-data
            MetaData lenyaMetaData = document.getMetaData(DocumentImpl.METADATA_NAMESPACE);
            lenyaMetaData.setValue(DocumentImpl.METADATA_CONTENT_TYPE, "xml");

            if (getLogger().isDebugEnabled()) {
                getLogger().debug("Create");
                getLogger().debug("    document:     [" + document + "]");
            }
View Full Code Here


    private Map namespace2metadata = new HashMap();

    public MetaData getMetaData(String namespaceUri) throws MetaDataException {

        MetaData meta = (MetaData) this.namespace2metadata.get(namespaceUri);
        if (meta == null) {
           
            MetaDataRegistry registry = null;
            try {
                registry = (MetaDataRegistry) this.manager.lookup(MetaDataRegistry.ROLE);
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

        WorkflowManager resolver = null;
        try {
            Document doc = getSourceDocument();
            if (doc != null) {
                // read parameters from Dublin Core meta-data
                MetaData dc = doc.getMetaData(DublinCore.DC_NAMESPACE);
                setParameter(DublinCore.ELEMENT_TITLE, dc.getFirstValue(DublinCore.ELEMENT_TITLE));
                setParameter(DublinCore.ELEMENT_DESCRIPTION, dc
                        .getFirstValue(DublinCore.ELEMENT_DESCRIPTION));

                // read parameters from document attributes
                setParameter(LANGUAGES, doc.getLanguages());
                SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z");
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

                List returnValues = new ArrayList();
                try {
                    Area areaObj = pub.getArea(this.area);
                    if (areaObj.contains(uuid, lang)) {
                        Document document = areaObj.getDocument(uuid, lang);
                        MetaData metaData = document.getMetaData(ns);
                        returnValues.addAll(Arrays.asList(metaData.getValues(key)));
                    } else if (defaultValue != null) {
                        returnValues.add(defaultValue);
                    } else {
                        String doc = this.publicationId + ":" + this.area + ":" + uuid + ":" + lang;
                        throw new SAXException("The document [" + doc
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("http://apache.org/lenya/metadata/media/1.0");
            addResourceMeta(fileName, mimeType, input, mediaMeta);
View Full Code Here

                    throw new SAXException("Error by setting up the transformation. Please fix the calling code.");
                if (lang==null)
                    lang=pub.getDefaultLanguage();
                try {
                    Document document = pub.getArea(area).getDocument(uuid, lang);
                    MetaData metaData = document.getMetaData(ns);
                    String [] returnValue=metaData.getValues(key);
                    if (returnValue.length>1){
                        for (int i = 0; i < returnValue.length; i++) {
                            AttributesImpl attributes = new AttributesImpl();
                            attributes.addAttribute("", VALUE_ELEMENT, VALUE_ELEMENT, "CDATA", returnValue[i]);
                            attributes.addAttribute("", ELEMENT_ATT, ELEMENT_ATT, "CDATA", key);
View Full Code Here

        }

    }

    private void parseMetaData(String namespace) throws ProcessingException, SAXException {
        MetaData metaData = getMetaData(namespace);
        String[] names = metaData.getAvailableKeys();
        for (int i = 0; i < names.length; i++) {
            String[] values;
            try {
                values = metaData.getValues(names[i]);
            } catch (MetaDataException e) {
                throw new ProcessingException(e);
            }
            for (int j = 0; j < values.length; j++) {
                this.contentHandler.startElement(namespace, names[i], names[i],
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.