/** * Perform operation for the given request using business class(ejb) and return response * * @throws I2B2Exception * @see edu.harvard.i2b2.crc.delegate.RequestHandler#execute() */ public BodyType execute() throws I2B2Exception { QueryProcessorUtil qpUtil = QueryProcessorUtil.getInstance(); String response = null; BodyType bodyType = new BodyType(); MasterInstanceResultResponseType masterInstanceResponse = null; try { StartAnalysisLocal startAnalysisLocal = qpUtil.getStartAnalysisLocal(); DAOFactoryHelper daoFactoryHelper = new DAOFactoryHelper( this.getDataSourceLookup().getDomainId(), getDataSourceLookup().getProjectPath(), getDataSourceLookup().getOwnerId()); IDAOFactory daoFactory = daoFactoryHelper.getDAOFactory(); // response = queryManagerLocal.processQuery(requestXml); masterInstanceResponse = startAnalysisLocal.start(daoFactory, requestXml); // processQuery(this.getDataSourceLookup(), requestXml); // masterInstanceResponse.setStatus(this.buildCRCStausType( // RequestHandlerDelegate.DONE_TYPE, "DONE")); // response = this.buildResponseMessage(requestXml, bodyType); } catch (I2B2Exception e) { masterInstanceResponse = new MasterInstanceResultResponseType(); masterInstanceResponse.setStatus( this.buildCRCStausType(RequestHandlerDelegate.ERROR_TYPE, e.getMessage())); } finally { edu.harvard.i2b2.crc.datavo.setfinder.query.ObjectFactory psmObjFactory = new edu.harvard.i2b2.crc.datavo.setfinder.query.ObjectFactory(); bodyType.getAny().add(psmObjFactory.createResponse(masterInstanceResponse)); } return bodyType; }
public AnalysisDefinitionType getAnalysisDefinition() throws JAXBUtilException { BodyType bodyType = getBodyType(); AnalysisDefinitionRequestType analysisDefReqType = (AnalysisDefinitionRequestType) unWrapHelper.getObjectByClass(bodyType.getAny(), AnalysisDefinitionRequestType.class); AnalysisDefinitionType analysisDef = null; if (analysisDefReqType != null) { analysisDef = analysisDefReqType.getAnalysisDefinition(); } return analysisDef; }
public QueryDefinitionType getQueryDefinition() throws JAXBUtilException { BodyType bodyType = getBodyType(); QueryDefinitionRequestType queryDefReqType = (QueryDefinitionRequestType) unWrapHelper.getObjectByClass(bodyType.getAny(), QueryDefinitionRequestType.class); QueryDefinitionType queryDef = null; if (queryDefReqType != null) { queryDef = queryDefReqType.getQueryDefinition(); } return queryDef; }
/** Perform operation for the given request using business class(ejb) and return response */ public BodyType execute() throws I2B2Exception { // call ejb and pass input object QueryProcessorUtil qpUtil = QueryProcessorUtil.getInstance(); String responseString = null; BodyType bodyType = new BodyType(); InstanceResponseType instanceResponseType = null; try { QueryRunLocalHome queryRunLocalHome = qpUtil.getQueryRunLocalHome(); QueryRunLocal queryRunLocal = queryRunLocalHome.create(); UserType userType = headerType.getUser(); String userId = null; if (userType != null) { userId = userType.getLogin(); } instanceResponseType = queryRunLocal.getQueryInstanceFromMasterId( getDataSourceLookup(), userId, masterRequestType); instanceResponseType.setStatus( this.buildCRCStausType(RequestHandlerDelegate.DONE_TYPE, "DONE")); // ResponseMessageType responseMessageType = new ResponseMessageType(); // responseMessageType.setMessageBody(bodyType); // responseString = getResponseString(responseMessageType); } catch (I2B2Exception e) { instanceResponseType = new InstanceResponseType(); instanceResponseType.setStatus( this.buildCRCStausType(RequestHandlerDelegate.ERROR_TYPE, e.getMessage())); } catch (ServiceLocatorException e) { log.error(e); throw new I2B2Exception("Servicelocator exception", e); } catch (CreateException e) { log.error(e); throw new I2B2Exception("Ejb create exception", e); } finally { edu.harvard.i2b2.crc.datavo.setfinder.query.ObjectFactory of = new edu.harvard.i2b2.crc.datavo.setfinder.query.ObjectFactory(); bodyType.getAny().add(of.createResponse(instanceResponseType)); } return bodyType; }