}
private WSItem getItemFromSolrDoc(SolrDocument sd)
{
WSItem item = new WSItem();
item.setHandle((String) sd.getFieldValue("handle"));
item.setItemID((Integer) sd.getFieldValue("search.resourceid"));
item.setCollection((ArrayList) sd
.getFieldValues(CrisWebservicesExtraIndexPlugin.FIELDNAME_COLLECTIONS));
item.setCollectionName((ArrayList) sd
.getFieldValues(CrisWebservicesExtraIndexPlugin.FIELDNAME_COLLECTIONS_NAME));
item.setCollectionHandle((ArrayList) sd
.getFieldValues(CrisWebservicesExtraIndexPlugin.FIELDNAME_COLLECTIONS_HANDLE));
item.setCommunity((ArrayList) sd
.getFieldValues(CrisWebservicesExtraIndexPlugin.FIELDNAME_COMMUNITIES));
item.setCommunityName((ArrayList) sd
.getFieldValues(CrisWebservicesExtraIndexPlugin.FIELDNAME_COMMUNITIES_NAME));
item.setCommunityHandle((ArrayList) sd
.getFieldValues(CrisWebservicesExtraIndexPlugin.FIELDNAME_COMMUNITIES_HANDLE));
for (String m : sd.getFieldNames())
{
if (!m.startsWith("dc."))
{
continue;
}
WSMetadata metadata = new WSMetadata();
metadata.setName(m);
int place = 1;
for (Object v : sd.getFieldValues(m))
{
String value = (String) v;
String[] mv = value.split("\\|\\|\\|");
WSMetadataValue mvalue = new WSMetadataValue();
mvalue.setValue(mv[0]);
mvalue.setAuthority(mv.length > 1 ? mv[1] : null);
mvalue.setShare(mv.length > 2 ? Integer.parseInt(mv[2]) : null);
mvalue.setPlace(place);
place++;
metadata.getValues().add(mvalue);
}
item.getMetadata().add(metadata);
}
return item;
}