/** Write the message with attributes and set the result. */ @Override public void run() throws IOException { MessageWriter writer = scon.startMessage(T_BINDER_UPDATE); writer.writeAttribute(A_PAGE_ID, pageId); if (isToRemovePage) { writer.writeAttribute(A_REMOVE, "YES"); } addStandardAttributes(writer); writer.endElement(); writer.close(); Log.print("(TaskBinderUpdate.run) page=" + pageId + " isToRemovePage=" + isToRemovePage); Element reply = scon.receiveMessage(); String ok = reply.getNodeName(); if (!T_OK.equals(ok) && !T_FAIL.equals(ok)) { Log.quit("BatchBoundary unexpected message type: " + ok); } }
public void run(ServerTask task, Element action) throws SQLException, IOException { int volumeId = task.getLockVolumeId(); assert volumeId != 0; assert task.getLockBatchId() == 0; int percent = Integer.parseInt(action.getAttribute(A_PERCENT)); String usersIdString = action.getAttribute(A_USERS_ID); String teamsIdString = action.getAttribute(A_TEAMS_ID); boolean newSample = "YES".equals(action.getAttribute(A_NEW_SAMPLE)); Log.print( "in Handler_sample_qa.run vol=" + volumeId + " pct=" + percent + " user: "******" team: " + teamsIdString + " new_sample: " + newSample); Statement st = null; int count; if (newSample) { // save batches around choose code st = task.getStatement(); st.executeUpdate( "update batch" + " set status =''" + " where volume_id=" + volumeId + " and status = 'QA'"); } if (usersIdString.length() > 0) { assert teamsIdString.length() == 0; if (newSample) { // move QCComplete batches to QA (managed) task.executeUpdate( "update batch B" + " inner join batchuser BU using (batch_id)" + " set B.status ='QA'" + " where B.volume_id=" + volumeId + " and B.status = 'QCComplete'" + " and BU.coder_id=" + usersIdString); } count = chooseQAChildrenForCoder(task, percent, Integer.parseInt(usersIdString)); } else if (teamsIdString.length() > 0) { if (newSample) { // move QCComplete batches to QA (managed) task.executeUpdate( "update batch B" + " inner join batchuser BU using (batch_id)" + " inner join users U on BU.coder_id=U.users_id" + " set B.status ='QA'" + " where B.volume_id=" + volumeId + " and B.status = 'QCComplete'" + " and U.teams_id=" + teamsIdString); } count = chooseQAChildrenForTeam(task, percent, Integer.parseInt(teamsIdString)); } else { if (newSample) { // move QCComplete batches to QA (managed) task.executeUpdate( "update batch" + " set status ='QA'" + " where volume_id=" + volumeId + " and status = 'QCComplete'"); } count = chooseQAChildren(task, percent); } if (newSample) { // restore old QA batches st.executeUpdate( "update batch" + " set status ='QA'" + " where volume_id=" + volumeId + " and status = ''"); } // send back info MessageWriter writer = task.getMessageWriter(); writer.startElement(T_UPDATE_COUNT); writer.writeAttribute(A_COUNT, count); writer.endElement(); }