*/
private JHoveTree initFromJHoveProperty(String sampleName,
JHoveFileProperty prop) {
if (prop == null)
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);
return mTree;
}