}
public static Product seek(AtrilSession oSes, String sProductId)
throws ElementNotFoundException, NotEnoughRightsException, DmsException, InstantiationException, IllegalAccessException {
Product p = new Product();
if (sProductId==null) throw new ElementNotFoundException("Product may not be null");
if (sProductId.length()==0) throw new ElementNotFoundException("Product may not be empty");
for (Document d : top(oSes).getDocument().children()) {
if (d.type().name().equals("Product")) {
if (!d.attribute("product_id").isEmpty()) {
if (sProductId.equals(d.attribute("product_id").toString())) {
p.setDocument(d);
return p;
}
}
if (!d.attribute("product_name").isEmpty()) {
if (sProductId.equalsIgnoreCase(d.attribute("product_name").toString())) {
p.setDocument(d);
return p;
}
}
} // fi
} // next
throw new ElementNotFoundException("Product "+sProductId+"not found");
}