Package eu.planets_project.pp.plato.services.characterisation.jhove.tree

Examples of eu.planets_project.pp.plato.services.characterisation.jhove.tree.JHoveTreeNode


            return null;
        JHoveTree mTree = new JHoveTree();
        mTree.initRoot(sampleName);
        if (prop.getExtractionDate() != null)
            mTree.getRoot().addChild(
                    new JHoveTreeNode("Extraction date: "
                            + prop.getExtractionDate(), "leaf"));
        if (prop.getStatus().compareTo("Not well-formed") == 0) {
            mTree.getRoot().addChild(
                    new JHoveTreeNode("Status: " + prop.getStatus(), "leaf"));
            return mTree;
        }
        mTree.getRoot().addChild(
                new JHoveTreeNode("Size: " + prop.getFileSize(), "leaf"));
        mTree.getRoot().addChild(
                new JHoveTreeNode("Mime-Type: " + prop.getMimetype(), "leaf"));
        mTree.getRoot().addChild(
                new JHoveTreeNode("Format: " + prop.getFormat(), "leaf"));
        if (prop.getVersion() != null)
            mTree.getRoot().addChild(
                    new JHoveTreeNode("Version: " + prop.getVersion(), "leaf"));
        mTree.getRoot().addChild(
                new JHoveTreeNode("Status: " + prop.getStatus(), "leaf"));

        // if not a bytestream, display also the properties
        if (prop.getFormat().compareTo("bytestream") != 0) {
            // Add Module to the tree
            JHoveTreeNode tmpMaterialTreeNode = new JHoveTreeNode("Module",
                    "node");
            tmpMaterialTreeNode.addChild(new JHoveTreeNode("Name: "
                    + prop.getModule().getName(), "leaf"));
            tmpMaterialTreeNode.addChild(new JHoveTreeNode("Release: "
                    + prop.getModule().getRelease(), "leaf"));
            tmpMaterialTreeNode.addChild(new JHoveTreeNode("Date: "
                    + prop.getModule().getDate(), "leaf"));
            mTree.getRoot().addChild(tmpMaterialTreeNode);

            // Add Profiles
            tmpMaterialTreeNode = new JHoveTreeNode("Profiles", "node");
            Vector<String> profiles = prop.getProfiles();
            if (profiles != null) {
                for (String profile : profiles) {
                    tmpMaterialTreeNode.addChild(new JHoveTreeNode(profile,
                            "leaf"));
                }
            }

            mTree.getRoot().addChild(tmpMaterialTreeNode);

            JHoveTreeNode tmpProp = new JHoveTreeNode("Properties", "node");

            // Add Properties
            for (Property property : prop.getProperties()) {
                tmpProp.addChild(getPropertyTreeNode(property));
            }
            mTree.getRoot().addChild(tmpProp);

        }
        log.debug("JHoveTree created from Samplerecord " + sampleName);
View Full Code Here


     */
    private JHoveTreeNode getPropertyTreeNode(Property property) {
        if (property.getName().compareTo("") == 0)
            return null;

        JHoveTreeNode tmp = new JHoveTreeNode(property.getName(), "node");
        // can use the type for setting the different node
        for (Object tmpObject : property.getValues()) {
            if (((Property) tmpObject).getType().compareTo("Property") == 0) {
                tmp.addChild(getPropertyTreeNode((Property) tmpObject));
            } else {
                if (((Property) tmpObject).getName().compareTo("XMP") == 0)
                    tmp.addChild(getJHoveTreeNodeFromXML(((Property) tmpObject)
                            .getValues().toString(), "XMP Charachteristics"));
                else
                    tmp
                            .addChild(new JHoveTreeNode(tmpObject.toString(),
                                    "leaf"));
            }
        }
        return tmp;
    }
View Full Code Here

                    new StringReader("<XMPInfo>" + XMPasString + "</XMPInfo>"));
           
            return getJHoveTreeNodeFromXPathNode(rootNode);
        } catch (Exception e) {
            log.warn("Error in JHove identification: " + e.getMessage(), e);
            return new JHoveTreeNode("Error in Processing XMP", "leaf");
        }
    }
View Full Code Here

     *
     * @param node
     * @return
     */
    private JHoveTreeNode getJHoveTreeNodeFromXPathNode(Node node) {
        JHoveTreeNode tmpNode;
        if (node.hasChildNodes()) {
            tmpNode = new JHoveTreeNode(node.getNodeName(), "node");
            NodeList nodelist = node.getChildNodes();
            for (int i = 0; i < node.getChildNodes().getLength(); i++) {
                tmpNode
                        .addChild(getJHoveTreeNodeFromXPathNode(nodelist
                                .item(i)));
            }
        } else {
            String tmpNodeContext = node.getNodeValue();
           
            // node value can be null. if it is null we change it to an empty string
            if (tmpNodeContext == null) {
                tmpNodeContext = "";
            }
            tmpNodeContext = tmpNodeContext.replaceAll("\n", "");
            tmpNodeContext = tmpNodeContext.replaceAll(" ", "");
            tmpNode = new JHoveTreeNode(tmpNodeContext, "leaf");
        }
        return tmpNode;
    }
View Full Code Here

TOP

Related Classes of eu.planets_project.pp.plato.services.characterisation.jhove.tree.JHoveTreeNode

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.