* {@link Product}.
*/
public static Profile buildProfile(Product p, Metadata met,
String dataDelivBaseUrl) {
Profile prof = new Profile();
ProfileAttributes profAttrs = new ProfileAttributes();
profAttrs.setID(PROF_ID_PRE + p.getProductId());
profAttrs.setRegAuthority("CAS");
profAttrs.setType(PROF_TYPE);
prof.setProfileAttributes(profAttrs);
ResourceAttributes resAttrs = new ResourceAttributes();
resAttrs.setDescription(p.getProductType().getDescription());
resAttrs.setIdentifier(p.getProductId());
resAttrs.setResClass(p.getProductType().getName());
resAttrs.setTitle(p.getProductName());
resAttrs.getPublishers().add("CAS");
resAttrs.getResLocations().add(
dataDelivBaseUrl + "?productID=" + p.getProductId());
prof.setResourceAttributes(resAttrs);
// build up profile elements
for(Iterator i = met.getHashtable().keySet().iterator(); i.hasNext(); ){
String key = (String)i.next();
List vals = met.getAllMetadata(key);
EnumeratedProfileElement elem = new EnumeratedProfileElement(prof);
System.out.println("Adding ["+key+"]=>"+vals);
elem.setName(key);
elem.getValues().addAll(vals);
prof.getProfileElements().put(key, elem);
}
return prof;