Date: 04/11/07 (Code WTF) Keywords: no keywords
diamondPlaceEntity.setPlace(extractPlace(mainNode, diamondPlaceEntity.getPlace()));
private PlaceEntity extractPlace(Node mainNode, PlaceEntity ent) throws Exception {
NodeList properties = mainNode.getChildNodes();
for (int i = 0; i < properties.getLength(); i++) {
Node node = properties.item(i);
String nodeId = node.getAttributes().getNamedItem("id").getNodeValue();
String value = node.getTextContent();
if (nodeId.equals("geoUnitId")) {
ent.setGeoUnitId(NumberUtils.toLong(value));
} else if (nodeId.equals("geoUnitTitle")) {
ent.setGeoUnitName(value);
} else if (nodeId.equals("about")) {
ent.setFieldAbout(value);
} else if (nodeId.equals("startDate")) {
ent.setStartDate(core.Utils.parseDate(value));
} else if (nodeId.equals("stopDate")) {
ent.setStopDate(core.Utils.parseDate(value));
}
}
return ent;
}
Source: http://community.livejournal.com/code_wtf/80150.html
|