}
private SampleObject parseSample(Element sample) {
String uid = sample.attributeValue("uid");
SampleObject sampleObject = new SampleObject(uid);
sampleObject.setFullname(uid);
List<Element> mimes = new ArrayList<Element>();
List<Element> size = new ArrayList<Element>();
List<Element> records = sample.elements("record");
for (Element rec : records) {
if (rec.attributeValue("name").equals("mimetype")) {
mimes.add(rec);
}
if (rec.attributeValue("name").equals("size")) {
size.add(rec);
}
}
if (mimes.size() > 1) {
sampleObject.setContentType("Conflict");
} else if (mimes.size() == 1) {
Element mimetype = (Element) mimes.get(0);
sampleObject.setContentType(mimetype.attributeValue("value"));
}
if (size.size() == 1) {
Element s = (Element) size.get(0);
sampleObject.setSizeInBytes(Long.parseLong(s.attributeValue("value")));
}
FormatInfo info = this.getFormatInfo(sample, sampleObject.getContentType());
sampleObject.setFormatInfo(info);
return sampleObject;
}