*
* @param nodeEventList, index, events, historicLogArray
*/
public void createHistoricLogLine(NodeList nodeEventList, int index, ArrayList<Element> events,
ArrayList<HistoricLogLine> historicLogArray) {
HistoricLogLine historicLogLine = new HistoricLogLine();
Element elementEvent = (Element) nodeEventList.item(index);
String action = null;
if (elementEvent.hasAttribute("action")) {
action = elementEvent.getAttribute("action");
events.add(elementEvent);
}
NodeList nodeActuatorList = elementEvent.getElementsByTagName("actuators");
int nbrNodeActuator = nodeActuatorList.getLength();
if ((action != null) && action.equalsIgnoreCase("start") && (nbrNodeActuator != 0)) {
for (int id = 0; id < nbrNodeActuator; id++) {
Element elementActuator = (Element) nodeActuatorList.item(id);
NodeList nodeActuatorElementList = elementActuator.getElementsByTagName("actuator");
int nbrnodeActuatorElement = nodeActuatorElementList.getLength();
if (nbrnodeActuatorElement != 0) {
ArrayList<ITrajectory> trajectoriesList = new ArrayList<ITrajectory>();
Element element = null;
for (int i = 0; i < nbrnodeActuatorElement; i++) {
element = (Element) nodeActuatorElementList.item(i);
ITrajectory tmpTrajectory = copyToTrajectoryImpl(element);
if (tmpTrajectory != null) {
trajectoriesList.add(tmpTrajectory);
}
}
historicLogLine.setTrajectories(trajectoriesList);
}
}
} else {
ArrayList<ITrajectory> trajectoriesList = new ArrayList<ITrajectory>();
historicLogLine.setTrajectories(trajectoriesList);
}
String date = elementEvent.getAttribute("date");
String time = elementEvent.getAttribute("hour");
String month = date.substring(0, 2);
String day = date.substring(2, 4);
String year = "20" + date.substring(4, 6);
String hour = time.substring(0, 2);
String minute = time.substring(3, 5);
String second = time.substring(6, 8);
String stringDate = day + month + year + hour + minute + second;
Date dateEvent = null;
try {
dateEvent = stringToDate(stringDate, "ddMMyyyyHHmmss");
} catch (Exception e) {
String errorMessage = "Cannot convert date " + stringDate + " " + e.getMessage();
LOGGER.warn(errorMessage);
LOGGER.debug("Stack trace", e);
}
historicLogLine.setDate(dateEvent);
historicLogLine.setScanId(elementEvent.getAttribute("scanId"));
historicLogLine.setAction(elementEvent.getAttribute("action"));
historicLogLine.setNexusFile(elementEvent.getAttribute("nexusFile"));
historicLogLine.setNxEntry(elementEvent.getAttribute("nxEntryName"));
historicLogLine.setScan(elementEvent.getAttribute("scan"));
historicLogArray.add(historicLogLine);
}