Boolean result = true;
int updated = 0;
int created = 0;
int errors = 0;
JDBQMResult res = new JDBQMResult(getHostID(), getSessionID());
JDBQMSample samp = new JDBQMSample(getHostID(), getSessionID());
JDBQMTest test = new JDBQMTest(getHostID(), getSessionID());
String sampleIDs = "1";
Long sampleID = 1L;
int sampleOccur = 1;
String inspectionID;
String activityID;
while (sampleIDs.length() > 0)
{
sampleIDs = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath("//message/messageData/sample[" + String.valueOf(sampleOccur) + "]/id").trim());
try
{
sampleID = Long.valueOf(sampleIDs);
} catch (Exception ex)
{
sampleID = 0L;
}
if (sampleID > 0)
{
if (samp.isValidSample(sampleID))
{
samp.getProperties();
inspectionID = samp.getInspectionID();
activityID = samp.getActivityID();
String testId = "1";
int testOccur = 1;
while (testId.length() > 0)
{
testId = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath("//message/messageData/sample[" + String.valueOf(sampleOccur) + "]/test[" + String.valueOf(testOccur) + "]/id").trim());
if (testId.length() > 0)
{
if (test.isValid(inspectionID, activityID, testId))
{
String resultData = JUtility.replaceNullStringwithBlank(gmh.getXMLDocument().findXPath("//message/messageData/sample[" + String.valueOf(sampleOccur) + "]/test[" + String.valueOf(testOccur) + "]/data").trim());
if (res.isValidResult(sampleID, testId) == true)
{
res.setValue(resultData);
res.update();
updated++;
} else
{
res.create(sampleID, testId, resultData, "Created", Common.userList.getUser(getSessionID()).getUserId());
created++;
}
}
else
{