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:org.apache.taverna.scufl2.translator.t2flow.defaultactivities.AbstractActivityParser.java
public <ConfigType> ConfigType unmarshallElement(T2FlowParser t2FlowParser, Element element, Class<ConfigType> configType) throws ReaderException { Unmarshaller unmarshaller2 = t2FlowParser.getUnmarshaller(); unmarshaller2.setSchema(null);// w w w . j a v a 2 s .co m try { JAXBElement<ConfigType> configElemElem = unmarshaller2.unmarshal(element, configType); return configElemElem.getValue(); } catch (JAXBException | ClassCastException e) { throw new ReaderException("Can't parse element " + element, e); } }
From source file:org.apache.taverna.scufl2.translator.t2flow.defaultactivities.AbstractActivityParser.java
public <ConfigType> ConfigType unmarshallXml(T2FlowParser t2FlowParser, String xml, Class<ConfigType> configType) throws ReaderException { Unmarshaller unmarshaller2 = t2FlowParser.getUnmarshaller(); unmarshaller2.setSchema(null);/* w w w .j a v a 2 s . co m*/ Source source = new StreamSource(new StringReader(xml)); try { JAXBElement<ConfigType> configElemElem = unmarshaller2.unmarshal(source, configType); return configElemElem.getValue(); } catch (JAXBException | ClassCastException e) { throw new ReaderException("Can't parse xml " + xml, e); } }
From source file:edu.harvard.i2b2.eclipse.plugins.ontology.ws.GetPsmResponseMessage.java
public QueryResultInstanceType extractResultInstance(String response) { QueryResultInstanceType resultInstance = null; try {/*from w w w .j a va 2 s . c o m*/ JAXBElement jaxbElement = OntologyJAXBUtil.getJAXBUtil().unMashallFromString(response); respMessageType = (ResponseMessageType) jaxbElement.getValue(); // Get response message status BodyType body = respMessageType.getMessageBody(); JAXBUnWrapHelper helper = new JAXBUnWrapHelper(); MasterInstanceResultResponseType responseType = (MasterInstanceResultResponseType) helper .getObjectByClass(body.getAny(), MasterInstanceResultResponseType.class); resultInstance = responseType.getQueryResultInstance().get(0); } catch (JAXBUtilException e) { // TODO Auto-generated catch block log.error(e.getMessage()); return null; } return resultInstance; }
From source file:edu.harvard.i2b2.eclipse.plugins.ontology.ws.GetPsmResponseMessage.java
public QueryMasterType extractQueryMaster(String response) { QueryMasterType queryMaster = null;/* w w w . j av a 2 s. c o m*/ try { JAXBElement jaxbElement = OntologyJAXBUtil.getJAXBUtil().unMashallFromString(response); respMessageType = (ResponseMessageType) jaxbElement.getValue(); // Get response message status BodyType body = respMessageType.getMessageBody(); JAXBUnWrapHelper helper = new JAXBUnWrapHelper(); MasterInstanceResultResponseType responseType = (MasterInstanceResultResponseType) helper .getObjectByClass(body.getAny(), MasterInstanceResultResponseType.class); queryMaster = responseType.getQueryMaster(); } catch (JAXBUtilException e) { // TODO Auto-generated catch block log.error(e.getMessage()); return null; } return queryMaster; }
From source file:edu.harvard.i2b2.fr.delegate.RequestHandler.java
/** * Function to unmarshall i2b2 request message type * @param requestXml/*from w w w . ja v a 2 s. c o m*/ * @return RequestMessageType * @throws JAXBUtilException */ protected RequestMessageType getI2B2RequestMessageType(String requestXml) throws JAXBUtilException { JAXBUtil jaxbUtil = FRJAXBUtil.getJAXBUtil(); JAXBElement jaxbElement = jaxbUtil.unMashallFromString(requestXml); RequestMessageType requestMessageType = (RequestMessageType) jaxbElement.getValue(); return requestMessageType; }
From source file:fileMapper.ws.GetPsmResponseMessage.java
public QueryResultInstanceType extractResultInstance(String response) { QueryResultInstanceType resultInstance = null; try {//from w w w. ja v a 2 s. com JAXBElement jaxbElement = FileMapperJAXBUtil.getJAXBUtil().unMashallFromString(response); respMessageType = (ResponseMessageType) jaxbElement.getValue(); // Get response message status BodyType body = respMessageType.getMessageBody(); JAXBUnWrapHelper helper = new JAXBUnWrapHelper(); MasterInstanceResultResponseType responseType = (MasterInstanceResultResponseType) helper .getObjectByClass(body.getAny(), MasterInstanceResultResponseType.class); resultInstance = responseType.getQueryResultInstance().get(0); } catch (JAXBUtilException e) { // TODO Auto-generated catch block log.error(e.getMessage()); return null; } return resultInstance; }
From source file:fileMapper.ws.GetPsmResponseMessage.java
public QueryMasterType extractQueryMaster(String response) { QueryMasterType queryMaster = null;//from w w w.j a va 2 s. c o m try { JAXBElement jaxbElement = FileMapperJAXBUtil.getJAXBUtil().unMashallFromString(response); respMessageType = (ResponseMessageType) jaxbElement.getValue(); // Get response message status BodyType body = respMessageType.getMessageBody(); JAXBUnWrapHelper helper = new JAXBUnWrapHelper(); MasterInstanceResultResponseType responseType = (MasterInstanceResultResponseType) helper .getObjectByClass(body.getAny(), MasterInstanceResultResponseType.class); queryMaster = responseType.getQueryMaster(); } catch (JAXBUtilException e) { // TODO Auto-generated catch block log.error(e.getMessage()); return null; } return queryMaster; }
From source file:edu.harvard.i2b2.eclipse.plugins.ontology.ws.GetPsmResponseMessage.java
public StatusType processResult(String response) { StatusType status = null;// w w w . j ava 2s . c o m try { JAXBElement jaxbElement = OntologyJAXBUtil.getJAXBUtil().unMashallFromString(response); respMessageType = (ResponseMessageType) jaxbElement.getValue(); // Get response message status ResponseHeaderType responseHeader = respMessageType.getResponseHeader(); status = responseHeader.getResultStatus().getStatus(); String procStatus = status.getType(); String procMessage = status.getValue(); if (procStatus.equals("ERROR")) { log.info("Error reported by Crc web Service " + procMessage); } else if (procStatus.equals("WARNING")) { log.info("Warning reported by Crc web Service" + procMessage); } } catch (JAXBUtilException e) { // TODO Auto-generated catch block log.error(e.getMessage()); } return status; }
From source file:edu.harvard.i2b2.fr.delegate.RequestHandler.java
protected MessageHeaderType getMessageHeaderType(String requestXml) throws JAXBUtilException { JAXBUtil jaxbUtil = FRJAXBUtil.getJAXBUtil(); JAXBElement<?> jaxbElement = jaxbUtil.unMashallFromString(requestXml); RequestMessageType requestMessageType = (RequestMessageType) jaxbElement.getValue(); return requestMessageType.getMessageHeader(); }
From source file:edu.harvard.i2b2.pm.ws.PMResponseMessage.java
public StatusType processResult(String response) { StatusType status = null;//from w ww .j a va 2s . c o m JAXBElement jaxbElement; try { jaxbElement = WorkplaceJAXBUtil.getJAXBUtil().unMashallFromString(response); } catch (JAXBUtilException e) { return status; } pmRespMessageType = (ResponseMessageType) jaxbElement.getValue(); // Get response message status ResponseHeaderType responseHeader = pmRespMessageType.getResponseHeader(); status = responseHeader.getResultStatus().getStatus(); return status; }