List of usage examples for javax.xml.bind JAXBElement getValue
public T getValue()
Return the content model and attribute values for this element.
See #isNil() for a description of a property constraint when this value is null
From source file:com.evolveum.midpoint.prism.util.JaxbTestUtil.java
public <T> T unmarshalToObject(Node node, Class<T> type) throws JAXBException, SchemaException { JAXBElement<T> element = unmarshalElement(node, type); if (element == null) { return null; }//ww w.ja v a2 s. c o m adopt(element); return element.getValue(); }
From source file:com.evolveum.midpoint.prism.util.JaxbTestUtil.java
private <T extends Containerable> PrismContainer<T> unmarshalSingleValueContainer(JAXBElement<T> element) throws JAXBException, SchemaException { if (element == null) { return null; }//w w w.j a v a2s . c om T value = element.getValue(); // this is a bit tricky - we have to create a container and put the newly obtained value into it PrismContainerValue<T> containerValue = value.asPrismContainerValue(); containerValue.revive(prismContext); PrismContainerDefinition definition = prismContext.getSchemaRegistry() .findContainerDefinitionByElementName(element.getName()); if (definition == null) { throw new IllegalStateException( "There's no container definition for element name " + element.getName()); } containerValue.applyDefinition(definition, false); PrismContainer container = definition.instantiate(); container.add(containerValue); return container; }
From source file:edu.harvard.i2b2.crc.delegate.setfinder.QueryRequestDelegate.java
/** * @see edu.harvard.i2b2.crc.delegate.RequestHandlerDelegate#handleRequest(java.lang.String) */// ww w . j a va 2 s .c om public String handleRequest(String requestXml) throws I2B2Exception { PsmQryHeaderType headerType = null; String response = null; JAXBUtil jaxbUtil = CRCJAXBUtil.getJAXBUtil(); try { JAXBElement jaxbElement = jaxbUtil.unMashallFromString(requestXml); if (jaxbElement == null) { throw new I2B2Exception("Request is null after unmashall" + requestXml); } RequestMessageType requestMessageType = (RequestMessageType) jaxbElement.getValue(); BodyType bodyType = requestMessageType.getMessageBody(); if (bodyType == null) { log.error("null value in body type"); throw new I2B2Exception("null value in body type"); } // Call PM cell to validate user ProjectType projectType = null; StatusType procStatus = null; try { SecurityType securityType = null; String projectId = null; if (requestMessageType.getMessageHeader() != null) { if (requestMessageType.getMessageHeader().getSecurity() != null) { securityType = requestMessageType.getMessageHeader().getSecurity(); } projectId = requestMessageType.getMessageHeader().getProjectId(); } if (securityType == null) { procStatus = new StatusType(); procStatus.setType("ERROR"); procStatus.setValue("Request message missing user/password"); response = I2B2MessageResponseFactory.buildResponseMessage(requestXml, procStatus, bodyType); return response; } // String pmResponse = // PMServiceDriver.checkValidUser(securityType); PMServiceDriver pmServiceDriver = new PMServiceDriver(); projectType = pmServiceDriver.checkValidUser(securityType, projectId); if (projectType == null) { procStatus = new StatusType(); procStatus.setType("ERROR"); procStatus.setValue("Invalid user/password for the given project[" + projectId + "]"); response = I2B2MessageResponseFactory.buildResponseMessage(requestXml, procStatus, bodyType); return response; } log.debug("project name from PM " + projectType.getName()); log.debug("project id from PM " + projectType.getId()); if (projectType.getRole() != null) { log.debug("project role from PM " + projectType.getRole().get(0)); this.putRoles(projectId, securityType.getUsername(), securityType.getDomain(), projectType.getRole()); //TODO removed cache // Node rootNode = CacheUtil.getCache().getRoot(); //List<String> roles = (List<String>) rootNode // .get(securityType.getDomain() + "/" + projectId // + "/" + securityType.getUsername()); List<String> roles = (List<String>) CacheUtil .get(securityType.getDomain() + "/" + projectId + "/" + securityType.getUsername()); if (roles != null) { log.debug("User Roles count " + roles.size()); } } else { log.error("Project role not set for the user "); } //check if process_timing_flag is set log.debug("check if process_timing_flag is set"); LogTimingUtil.clearPocessTiming(projectId, securityType.getUsername(), securityType.getDomain()); ParamUtil paramUtil = new ParamUtil(); paramUtil.clearParam(projectId, securityType.getUsername(), securityType.getDomain(), ParamUtil.CRC_ENABLE_UNITCD_CONVERSION); if (projectType.getParam() != null) { for (ParamType param : projectType.getParam()) { if (param.getName() != null && param.getName().trim() .equalsIgnoreCase(LogTimingUtil.PM_ENABLE_PROCESS_TIMING)) { //this.putPocessTiming(projectId, securityType.getUsername(), securityType.getDomain(), param); LogTimingUtil.putPocessTiming(projectId, securityType.getUsername(), securityType.getDomain(), param); String cacheValue = LogTimingUtil.getPocessTiming(projectId, securityType.getUsername(), securityType.getDomain()); log.debug("CRC param stored in the cache Project Id [" + projectId + "] user [" + securityType.getUsername() + "] domain [" + securityType.getDomain() + "] " + ParamUtil.PM_ENABLE_PROCESS_TIMING + "[" + cacheValue + "]"); } else if (param.getName() != null && param.getName().trim() .equalsIgnoreCase(ParamUtil.CRC_ENABLE_UNITCD_CONVERSION)) { paramUtil.putParam(projectId, securityType.getUsername(), securityType.getDomain(), ParamUtil.CRC_ENABLE_UNITCD_CONVERSION, param); String unitCdCache = paramUtil.getParam(projectId, securityType.getUsername(), securityType.getDomain(), ParamUtil.CRC_ENABLE_UNITCD_CONVERSION); log.debug("CRC param stored in the cache Project Id [" + projectId + "] user [" + securityType.getUsername() + "] domain [" + securityType.getDomain() + "] " + ParamUtil.CRC_ENABLE_UNITCD_CONVERSION + "[" + unitCdCache + "]"); } } } } catch (AxisFault e) { procStatus = new StatusType(); procStatus.setType("ERROR"); procStatus.setValue("Could not connect to server"); response = I2B2MessageResponseFactory.buildResponseMessage(requestXml, procStatus, bodyType); return response; } catch (I2B2Exception e) { procStatus = new StatusType(); procStatus.setType("ERROR"); procStatus.setValue("Message error connecting Project Management cell"); response = I2B2MessageResponseFactory.buildResponseMessage(requestXml, procStatus, bodyType); return response; } catch (JAXBUtilException e) { procStatus = new StatusType(); procStatus.setType("ERROR"); procStatus.setValue("Message error from Project Management cell"); response = I2B2MessageResponseFactory.buildResponseMessage(requestXml, procStatus, bodyType); return response; } // check if the role is DATA_AGG to proceed log.debug("check if the role is DATA_AGG to proceed"); boolean errorFlag = false; JAXBUnWrapHelper unWrapHelper = new JAXBUnWrapHelper(); headerType = (PsmQryHeaderType) unWrapHelper.getObjectByClass(bodyType.getAny(), edu.harvard.i2b2.crc.datavo.setfinder.query.PsmQryHeaderType.class); BodyType responseBodyType = null; if (headerType.getRequestType().equals(PsmRequestTypeType.CRC_QRY_GET_QUERY_MASTER_LIST_FROM_USER_ID)) { GetQueryMasterListFromUserIdHandler handler = new GetQueryMasterListFromUserIdHandler(requestXml); responseBodyType = handler.execute(); } else if (headerType.getRequestType() .equals(PsmRequestTypeType.CRC_QRY_GET_QUERY_MASTER_LIST_FROM_GROUP_ID)) { // check if user have right permission to access this request if (projectType != null && projectType.getRole().size() > 0) { if ((!projectType.getRole().contains("MANAGER"))) { // Not authorized procStatus = new StatusType(); procStatus.setType("ERROR"); procStatus.setValue("Authorization failure, should have MANAGER role"); response = I2B2MessageResponseFactory.buildResponseMessage(requestXml, procStatus, bodyType); return response; } } else { // Not authorized procStatus = new StatusType(); procStatus.setType("ERROR"); procStatus.setValue("Authorization failure, should have MANAGER role"); response = I2B2MessageResponseFactory.buildResponseMessage(requestXml, procStatus, bodyType); return response; } GetQueryMasterListFromGroupIdHandler handler = new GetQueryMasterListFromGroupIdHandler(requestXml); responseBodyType = handler.execute(); } else if (headerType.getRequestType() .equals(PsmRequestTypeType.CRC_QRY_RUN_QUERY_INSTANCE_FROM_QUERY_DEFINITION)) { log.debug("Running in " + PsmRequestTypeType.CRC_QRY_RUN_QUERY_INSTANCE_FROM_QUERY_DEFINITION); ParamType lockedParamType = null; List<ParamType> paramList = projectType.getParam(); for (ParamType paramType : paramList) { if (paramType.getName().equals(EJBPMUtil.LOCKEDOUT)) { lockedParamType = paramType; break; } } log.debug("Check if user is locked out"); if (lockedParamType != null) { // Not authorized procStatus = new StatusType(); procStatus.setType("ERROR"); procStatus.setValue("LOCKEDOUT error: The user account is lockedout at [" + lockedParamType.getValue() + "]"); bodyType = new BodyType(); response = I2B2MessageResponseFactory.buildResponseMessage(requestXml, procStatus, bodyType); return response; } else { RunQueryInstanceFromQueryDefinitionHandler handler = new RunQueryInstanceFromQueryDefinitionHandler( requestXml); responseBodyType = handler.execute(); // check if the response body type has lockedout error if (handler.getLockedoutFlag()) { procStatus = new StatusType(); procStatus.setType("ERROR"); procStatus.setValue("LOCKEDOUT error: The user account is lockedout at [" + new Date(System.currentTimeMillis()) + "]"); response = I2B2MessageResponseFactory.buildResponseMessage(requestXml, procStatus, responseBodyType); return response; } //if (handler.getErrorFlag()) { // errorFlag = true; //} } } else if (headerType.getRequestType() .equals(PsmRequestTypeType.CRC_QRY_RUN_QUERY_INSTANCE_FROM_QUERY_MASTER_ID)) { RunQueryInstanceFromQueryMasterHandler handler = new RunQueryInstanceFromQueryMasterHandler( requestXml); responseBodyType = handler.execute(); } else if (headerType.getRequestType() .equals(PsmRequestTypeType.CRC_QRY_GET_QUERY_RESULT_INSTANCE_LIST_FROM_QUERY_INSTANCE_ID)) { GetQueryResultInstanceListFromQueryInstanceIdHandler handler = new GetQueryResultInstanceListFromQueryInstanceIdHandler( requestXml); responseBodyType = handler.execute(); } else if (headerType.getRequestType() .equals(PsmRequestTypeType.CRC_QRY_GET_QUERY_INSTANCE_LIST_FROM_QUERY_MASTER_ID)) { GetQueryInstanceListFromMasterIdHandler handler = new GetQueryInstanceListFromMasterIdHandler( requestXml); responseBodyType = handler.execute(); } else if (headerType.getRequestType() .equals(PsmRequestTypeType.CRC_QRY_GET_REQUEST_XML_FROM_QUERY_MASTER_ID)) { GetRequestXmlFromQueryMasterIdHandler handler = new GetRequestXmlFromQueryMasterIdHandler( requestXml); responseBodyType = handler.execute(); } else if (headerType.getRequestType().equals(PsmRequestTypeType.CRC_QRY_DELETE_QUERY_MASTER)) { DeleteQueryMasterHandler handler = new DeleteQueryMasterHandler(requestXml); responseBodyType = handler.execute(); } else if (headerType.getRequestType().equals(PsmRequestTypeType.CRC_QRY_RENAME_QUERY_MASTER)) { RenameQueryMasterHandler handler = new RenameQueryMasterHandler(requestXml); responseBodyType = handler.execute(); } else if (headerType.getRequestType() .equals(PsmRequestTypeType.CRC_QRY_UPDATE_RESULT_INSTANCE_DESCRIPTION)) { UpdateQueryResultInstanceDescriptionHandler handler = new UpdateQueryResultInstanceDescriptionHandler( requestXml); responseBodyType = handler.execute(); } else if (headerType.getRequestType() .equals(PsmRequestTypeType.CRC_QRY_GET_RESULT_DOCUMENT_FROM_RESULT_INSTANCE_ID)) { GetXmlResultFromQueryResultIdHandler handler = new GetXmlResultFromQueryResultIdHandler(requestXml); responseBodyType = handler.execute(); } else if (headerType.getRequestType().equals(PsmRequestTypeType.CRC_QRY_GET_RESULT_TYPE)) { GetAllQueryResultTypeHandler handler = new GetAllQueryResultTypeHandler(requestXml); responseBodyType = handler.execute(); } else if (headerType.getRequestType() .equals(PsmRequestTypeType.CRC_QRY_RUN_QUERY_INSTANCE_FROM_ANALYSIS_DEFINITION)) { RunQueryInstanceFromAnalysisDefinitionHandler handler = new RunQueryInstanceFromAnalysisDefinitionHandler( requestXml); responseBodyType = handler.execute(); } else if (headerType.getRequestType().equals(PsmRequestTypeType.CRC_QRY_CANCEL_QUERY)) { CancelQueryInstanceHandler handler = new CancelQueryInstanceHandler(requestXml); responseBodyType = handler.execute(); } else if (headerType.getRequestType() .equals(PsmRequestTypeType.CRC_QRY_GET_ANALYSIS_PLUGIN_METADATA)) { GetAnalysisPluginMetadataTypeHandler handler = new GetAnalysisPluginMetadataTypeHandler(requestXml); responseBodyType = handler.execute(); } procStatus = new StatusType(); if (errorFlag == false) { procStatus.setType("DONE"); procStatus.setValue("DONE"); } else { procStatus.setType("ERROR"); procStatus.setValue("ERROR"); } response = I2B2MessageResponseFactory.buildResponseMessage(requestXml, procStatus, responseBodyType); } catch (JAXBUtilException e) { log.error("JAXBUtilException", e); StatusType procStatus = new StatusType(); procStatus.setType("ERROR"); procStatus.setValue(requestXml + "\n\n" + StackTraceUtil.getStackTrace(e)); try { response = I2B2MessageResponseFactory.buildResponseMessage(null, procStatus, null); } catch (JAXBUtilException e1) { e1.printStackTrace(); } // throw new I2B2Exception("JAXBUtil exception",e); } catch (I2B2Exception e) { log.error("I2B2Exception", e); StatusType procStatus = new StatusType(); procStatus.setType("ERROR"); procStatus.setValue(StackTraceUtil.getStackTrace(e)); try { response = I2B2MessageResponseFactory.buildResponseMessage(requestXml, procStatus, null); } catch (JAXBUtilException e1) { e1.printStackTrace(); } } catch (Throwable e) { log.error("Throwable", e); StatusType procStatus = new StatusType(); procStatus.setType("ERROR"); procStatus.setValue(StackTraceUtil.getStackTrace(e)); try { response = I2B2MessageResponseFactory.buildResponseMessage(requestXml, procStatus, null); } catch (JAXBUtilException e1) { e1.printStackTrace(); } } return response; }
From source file:de.extra.client.plugins.dataplugin.helper.DataPluginHelper.java
/** * Hilfsklasse zum unmarshalling des Auftragssatzes. * /*from w w w. j a va 2 s . c om*/ * @param auftragssatzName * @return JaxB-Element vom Typ AuftragssatzType */ public AuftragssatzType unmarshalAuftragssatz(final String auftragssatzName) { JAXBContext jc; JAXBElement<?> element = null; try { // Initialisieren des JaxB-Contextes jc = JAXBContext.newInstance("de.extra.client.plugins.dataPlugin.auftragssatz"); // Aufruf des Unmarshallers final Unmarshaller u = jc.createUnmarshaller(); final File auftragsFile = new File(auftragssatzName); element = (JAXBElement<?>) u.unmarshal(auftragsFile); } catch (final JAXBException e) { LOG.error("Fehler beim Verarbeiten des XML", e); } catch (final Exception e) { LOG.error("Fehler beim Verarbeiten des XML", e); } return (AuftragssatzType) element.getValue(); }
From source file:com.evolveum.midpoint.prism.util.JaxbTestUtil.java
public <T> T unmarshalObject(InputStream input, Class<T> type) throws JAXBException, SchemaException { Object object = getUnmarshaller().unmarshal(input); JAXBElement<T> jaxbElement = (JAXBElement<T>) object; adopt(jaxbElement);//from w w w. j av a 2 s .co m if (jaxbElement == null) { return null; } T value = jaxbElement.getValue(); // adopt not needed, already adopted in unmarshalElement call above return value; }
From source file:com.evolveum.midpoint.prism.util.JaxbTestUtil.java
public <T> T unmarshalObject(InputStream input) throws JAXBException, SchemaException { Object object = getUnmarshaller().unmarshal(input); JAXBElement<T> jaxbElement = (JAXBElement<T>) object; adopt(jaxbElement);//from w ww.j a v a 2 s.c om if (jaxbElement == null) { return null; } T value = jaxbElement.getValue(); // adopt not needed, already adopted in unmarshalElement call above return value; }
From source file:org.castor.jaxb.CastorUnmarshallerTest.java
/** * Tests the passed {@link JAXBElement}. * * @param jaxbElement the {@link JAXBElement} to test *//*from www. java2s . com*/ private void testJAXBElement(JAXBElement<Entity> jaxbElement) { assertNotNull("Entity can not be null.", jaxbElement); testEntity(jaxbElement.getValue()); }
From source file:ca.phon.session.io.xml.v12.XMLSessionReader_v12.java
@Override public Session read(Document doc, Element ele) throws IOException { Session retVal = null;// w w w . j a va 2s . c o m final ObjectFactory xmlFactory = new ObjectFactory(); try { // TODO JAXB is good enough for reading in this type of session final JAXBContext context = JAXBContext.newInstance(xmlFactory.getClass()); final Unmarshaller unmarshaller = context.createUnmarshaller(); final JAXBElement<SessionType> sessionTypeEle = unmarshaller.unmarshal(doc.getDocumentElement(), SessionType.class); if (sessionTypeEle != null && sessionTypeEle.getValue() != null) { final SessionType sessionType = sessionTypeEle.getValue(); retVal = readSessionType(sessionType); } } catch (JAXBException e) { throw new IOException(e); } return retVal; }
From source file:com.inmobi.grill.client.GrillMetadataClient.java
public XStorageTableElement getStorageOfDimension(String dimName, String storage) { WebTarget target = getMetastoreWebTarget(); JAXBElement<XStorageTableElement> result = target.path("dimensions").path(dimName).path("storages") .path(storage).queryParam("sessionid", this.connection.getSessionHandle()) .request(MediaType.APPLICATION_XML).get(new GenericType<JAXBElement<XStorageTableElement>>() { });/*ww w . j av a 2 s.co m*/ return result.getValue(); }
From source file:edu.harvard.i2b2.crc.ejb.PdoQueryBean.java
/** * Function to get plain pdo from the given pdo request * /* w w w.j a va 2 s. c o m*/ * @ejb.interface-method view-type="both" * @ejb.transaction type="Required" */ public PatientDataResponseType getPlainPatientData(DataSourceLookup dataSourceLookup, GetPDOFromInputListRequestType getPDOFromInputListReqType, String requestXml) throws I2B2Exception { PatientDataType patientDataType = null; DAOFactoryHelper helper = new DAOFactoryHelper(dataSourceLookup.getDomainId(), dataSourceLookup.getProjectPath(), dataSourceLookup.getOwnerId()); IDAOFactory daoFactory = helper.getDAOFactory(); IQueryPdoMasterDao queryPdoMasterDao = daoFactory.getSetFinderDAOFactory().getQueryPdoMasterDAO(); savePdoQueryMaster(queryPdoMasterDao, requestXml); String version = getVersion(queryPdoMasterDao, requestXml); // check if the user have the blob permission boolean blobFlag = checkForBlob(getPDOFromInputListReqType); if (blobFlag) { // String domainId = dataSourceLookup.getDomainId(); String projectId = dataSourceLookup.getProjectPath(); String userId = dataSourceLookup.getOwnerId(); daoFactory = helper.getDAOFactory(); AuthrizationHelper authHelper = new AuthrizationHelper(domainId, projectId, userId, daoFactory); authHelper.checkRoleForProtectionLabel("PDO_WITH_BLOB"); } // get unit cd conversion project param from cache ParamUtil paramUtil = new ParamUtil(); DataSourceLookup origDataSourceLookup = daoFactory.getPatientDataDAOFactory().getOriginalDataSourceLookup(); String unitCdConversionParam = paramUtil.getParam(origDataSourceLookup.getProjectPath(), origDataSourceLookup.getOwnerId(), origDataSourceLookup.getDomainId(), ParamUtil.CRC_ENABLE_UNITCD_CONVERSION); Map projectParamMap = null; if (unitCdConversionParam != null) { projectParamMap = new HashMap(); projectParamMap.put(ParamUtil.CRC_ENABLE_UNITCD_CONVERSION, unitCdConversionParam.trim()); } // call ontology cell to get the item's metadata to build the query sql FilterListType filterList = getPDOFromInputListReqType.getFilterList(); Map<String, XmlValueType> modifierMetadataXmlMap = new HashMap<String, XmlValueType>(); if (filterList != null) { try { //CallOntologyUtil ontologyUtil = new CallOntologyUtil(requestXml); JAXBElement responseJaxb = CRCJAXBUtil.getJAXBUtil().unMashallFromString(requestXml); RequestMessageType request = (RequestMessageType) responseJaxb.getValue(); String projectId = request.getMessageHeader().getProjectId(); SecurityType tempSecurityType = request.getMessageHeader().getSecurity(); SecurityType securityType = PMServiceAccountUtil .getServiceSecurityType(tempSecurityType.getDomain()); // if regular concepts for (PanelType panel : filterList.getPanel()) { for (ItemType item : panel.getItem()) { //ConceptType conceptType = ontologyUtil.callOntology(item.getItemKey()); ConceptType conceptType = CallOntologyUtil.callOntology(item.getItemKey(), securityType, projectId, QueryProcessorUtil.getInstance().getOntologyUrl()); log.debug("fetching the metadata information from ontology [" + item.getItemKey() + "]"); if (conceptType != null) { item.setDimDimcode(conceptType.getDimcode()); item.setDimColumnname(conceptType.getColumnname()); item.setDimOperator(conceptType.getOperator()); item.setDimTablename(conceptType.getTablename()); item.setFacttablecolumn(conceptType.getFacttablecolumn()); item.setDimColumndatatype(conceptType.getColumndatatype()); if (conceptType.getMetadataxml() != null && conceptType.getMetadataxml().getAny().get(0) != null) { MetadataxmlValueType metadataXmlType = new MetadataxmlValueType(); metadataXmlType.getContent().add(conceptType.getMetadataxml().getAny().get(0)); item.setMetadataxml(metadataXmlType); } log.debug("metadata from ontology received for [" + item.getItemKey() + "]" + conceptType.getTablename()); //check for modifier constrain and get modifier metadata ItemType.ConstrainByModifier modifierConstrain = item.getConstrainByModifier(); if (modifierConstrain != null) { ItemMetaDataHandler itemMetaDataHandler = new ItemMetaDataHandler(requestXml); String modifierKey = modifierConstrain.getModifierKey(); String modifierAppliedPath = modifierConstrain.getAppliedPath(); ModifierType modifierType = itemMetaDataHandler.getModifierDataFromOntologyCell( modifierKey, modifierAppliedPath, helper.getDataSourceLookup().getServerType()); copyModifierToItem(item, modifierType); //cache the modifier metadat in the map if (projectParamMap != null) { String unitConversionFlag = (String) projectParamMap .get(ParamUtil.CRC_ENABLE_UNITCD_CONVERSION); if (unitConversionFlag != null && unitConversionFlag.equals("ON")) { if (modifierType.getMetadataxml() != null) { log.debug("Adding modifier metadata xml to lookup map for modifier key" + modifierType.getKey() + modifierType.getAppliedPath()); modifierMetadataXmlMap.put( modifierType.getKey() + modifierType.getAppliedPath(), modifierType.getMetadataxml()); } } } } } else { log.debug( "Unable to get item's metadata from ontology cell [" + item.getItemKey() + "]"); } } } } catch (JAXBUtilException jaxEx) { jaxEx.printStackTrace(); throw new I2B2Exception( "Error in getting item's metadata from the ontology : " + jaxEx.getMessage(), jaxEx); } catch (AxisFault e) { e.printStackTrace(); throw new I2B2Exception("Error in getting item's metadata from the ontology : " + e.getMessage(), e); } catch (XMLStreamException e) { e.printStackTrace(); throw new I2B2Exception("Error in getting item's metadata from the ontology : " + e.getMessage(), e); } } PatientDataDAOFactory pdoDaoFactory = daoFactory.getPatientDataDAOFactory(); PatientDataResponseType patientDataResponseType = new PatientDataResponseType(); try { OutputOptionNameType ot = getPDOFromInputListReqType.getOutputOption().getNames(); QueryProcessorUtil qpUtil = QueryProcessorUtil.getInstance(); String pageMethod = qpUtil.getPagingMethod(); log.debug("PageMethod value [" + pageMethod + "]"); InputOptionListType origInputList = getPDOFromInputListReqType.getInputList(); InputOptionListType inputList = getPDOFromInputListReqType.getInputList(); IInputOptionListHandler inputListHandler = PDOFactory.buildInputListHandler(inputList, helper.getDataSourceLookup()); int requestedMinIndex = inputListHandler.getMinIndex(); int requestedMaxIndex = inputListHandler.getMaxIndex(); // if the request missing the max index, then default the maxindex // to size of the input list if (requestedMaxIndex < 1) { requestedMaxIndex = inputListHandler.getInputSize(); RangeType rangeType = PDOFactory.getRangeType(inputList); rangeType.setMax(requestedMaxIndex); } // before doing the paging, check if the output option list has // observaion OutputOptionFactRelatedHelper opFactRelatedHelper = new OutputOptionFactRelatedHelper( getPDOFromInputListReqType.getOutputOption()); boolean pagingNeeded = opFactRelatedHelper.isFactRelated(); if (pagingNeeded) { PagingHandler ph = new PagingHandler(helper, getPDOFromInputListReqType.getInputList(), getPDOFromInputListReqType.getFilterList(), pageMethod); ph.setProjectParamMap(projectParamMap); ph.setModifierMetadataXmlMap(modifierMetadataXmlMap); HashMap calculatedValueMap = ph.calculateMaxPageInputList(); // do paging if required if ((Boolean) calculatedValueMap.get(PagingHandler.PAGING_REQUIRED_FLAG)) { long totalSize = (Long) calculatedValueMap.get(PagingHandler.TOTAL_OBSERVATION); int maxInputSize = (Integer) calculatedValueMap.get(PagingHandler.MAX_INPUT_LIST); long pageSize = ph.getPageSize(); // build page type PageType pageType = buildPageType(requestedMinIndex, requestedMaxIndex, maxInputSize, totalSize, pageSize); patientDataResponseType.setPage(pageType); RangeType rangeType = PDOFactory.getRangeType(inputList); rangeType.setMax(requestedMinIndex + maxInputSize - 1); // inputList.getPatientList().setMax( // requestedMinIndex + maxInputSize); } } boolean tablePDO = false; if (getPDOFromInputListReqType.getOutputOption().getNames() != null) { if (getPDOFromInputListReqType.getOutputOption().getNames().name() .equalsIgnoreCase(OutputOptionNameType.ASATTRIBUTES.name())) { tablePDO = true; } } log.debug("PDO reading metadat for patient_dimension table"); //get patient dimension metadata List<ParamType> patientMetaDataList = getPDOTemplate("patient_dimension", dataSourceLookup, tablePDO); //get visit dimension metadata log.debug("PDO reading metadat for visit_dimension table"); List<ParamType> visitMetaDataList = getPDOTemplate("visit_dimension", dataSourceLookup, tablePDO); if ((ot != null) && ot.name().equalsIgnoreCase(OutputOptionNameType.ASATTRIBUTES.name())) { PdoQueryHandler pdoQueryHandler = new PdoQueryHandler(pdoDaoFactory, PdoQueryHandler.TABLE_PDO_TYPE, origInputList, inputList, // /getPDOFromInputListReqType.getInputList(), getPDOFromInputListReqType.getFilterList(), getPDOFromInputListReqType.getOutputOption()); pdoQueryHandler.setProjectParamMap(projectParamMap); pdoQueryHandler.setModifierMetadataXmlMap(modifierMetadataXmlMap); pdoQueryHandler.setRequestVersion(version); pdoQueryHandler.setDimensionMetaDataParamList(patientMetaDataList, visitMetaDataList); pdoQueryHandler.processPDORequest(); patientDataType = pdoQueryHandler.getTablePdo(); } else { PdoQueryHandler pdoQueryHandler = new PdoQueryHandler(pdoDaoFactory, PdoQueryHandler.PLAIN_PDO_TYPE, origInputList, inputList, // getPDOFromInputListReqType.getInputList(), getPDOFromInputListReqType.getFilterList(), getPDOFromInputListReqType.getOutputOption()); pdoQueryHandler.setProjectParamMap(projectParamMap); pdoQueryHandler.setModifierMetadataXmlMap(modifierMetadataXmlMap); pdoQueryHandler.setRequestVersion(version); pdoQueryHandler.setDimensionMetaDataParamList(patientMetaDataList, visitMetaDataList); pdoQueryHandler.processPDORequest(); patientDataType = pdoQueryHandler.getPlainPdo(); } } catch (Exception ex) { ex.printStackTrace(); log.error(ex.getMessage(), ex); throw new I2B2Exception(ex.getMessage(), ex); } patientDataResponseType.setPatientData(patientDataType); return patientDataResponseType; }