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.jasig.portlet.degreeprogress.dao.xml.HttpDegreeProgressDaoImpl.java
@Override public DegreeProgressReport getProgressReport(PortletRequest request) { Map<String, String> params = createParameters(request, urlParams); if (log.isDebugEnabled()) { log.debug("Invoking uri '" + degreeProgressUrlFormat + "' with the following parameters: " + params.toString());/*w ww . j av a 2 s .c om*/ } HttpEntity<?> requestEntity = getRequestEntity(request); HttpEntity<DegreeProgressReport> response = restTemplate.exchange(degreeProgressUrlFormat, HttpMethod.GET, requestEntity, DegreeProgressReport.class, params); DegreeProgressReport report = response.getBody(); for (DegreeRequirementSection section : report.getDegreeRequirementSections()) { for (JAXBElement<? extends GeneralRequirementType> requirement : section.getGeneralRequirements()) { GeneralRequirementType req = requirement.getValue(); if (req instanceof GpaRequirement) { section.setRequiredGpa(((GpaRequirement) req).getRequiredGpa()); } } for (CourseRequirement req : section.getCourseRequirements()) { for (Course course : req.getCourses()) { StudentCourseRegistration registration = new StudentCourseRegistration(); registration.setCredits(course.getCredits()); registration.setSource(course.getSource()); registration.setSemester(course.getSemester()); registration.setCourse(course); Grade grade = new Grade(); grade.setCode(course.getGrade().getCode()); registration.setGrade(grade); req.getRegistrations().add(registration); } } report.addSection(section); } return report; }
From source file:de.intevation.test.irixservice.UploadReportTest.java
public ReportType getReportFromFile(String file) { try {//from w w w. j av a 2 s. com JAXBContext jaxbContext = JAXBContext.newInstance(ReportType.class.getPackage().getName()); SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = schemaFactory.newSchema(testObj.irixSchemaFile); Unmarshaller u = jaxbContext.createUnmarshaller(); u.setSchema(schema); JAXBElement obj = (JAXBElement) u.unmarshal(new File(file)); return (ReportType) obj.getValue(); } catch (JAXBException | SAXException e) { log.debug("Failed to parse report test data: " + file); log.debug(e); return null; } }
From source file:edu.harvard.i2b2.crc.delegate.RequestHandler.java
/** * Function to unmarshall i2b2 request message type * // w w w .j av a 2 s. co m * @param requestXml * @return RequestMessageType * @throws JAXBUtilException */ protected RequestMessageType getI2B2RequestMessageType(String requestXml) throws JAXBUtilException { JAXBUtil jaxbUtil = CRCJAXBUtil.getJAXBUtil(); JAXBElement jaxbElement = jaxbUtil.unMashallFromString(requestXml); RequestMessageType requestMessageType = (RequestMessageType) jaxbElement.getValue(); return requestMessageType; }
From source file:edu.harvard.i2b2.fr.delegate.RequestHandler.java
/** * Class to fetch specific request message * from i2b2 message xml//from w w w. ja v a 2s . c o m * @param requestXml * @param classname * @return object which is of type classname * @throws JAXBUtilException */ protected Object getRequestType(String requestXml, Class classname) throws JAXBUtilException { log.debug("RequestHandler - RequestXML: " + requestXml); Object returnObject = null; log.debug("MM1"); JAXBUtil jaxbUtil = FRJAXBUtil.getJAXBUtil(); JAXBElement jaxbElement = jaxbUtil.unMashallFromString(requestXml); RequestMessageType requestMessageType = (RequestMessageType) jaxbElement.getValue(); BodyType bodyType = requestMessageType.getMessageBody(); JAXBUnWrapHelper unWrapHelper = new JAXBUnWrapHelper(); log.debug("MM6"); //get request header type returnObject = unWrapHelper.getObjectByClass(bodyType.getAny(), classname); log.debug("MM7"); return returnObject; }
From source file:edu.harvard.i2b2.crc.delegate.loader.RequestHandler.java
/** * Function to unmarshall i2b2 request message type * @param requestXml//from ww w .j a v a 2 s .c o m * @return RequestMessageType * @throws JAXBUtilException */ protected RequestMessageType getI2B2RequestMessageType(String requestXml) throws JAXBUtilException { JAXBUtil jaxbUtil = CRCLoaderJAXBUtil.getJAXBUtil(); JAXBElement jaxbElement = jaxbUtil.unMashallFromString(requestXml); RequestMessageType requestMessageType = (RequestMessageType) jaxbElement.getValue(); return requestMessageType; }
From source file:edu.harvard.i2b2.crc.delegate.loader.RequestHandler.java
protected MessageHeaderType getMessageHeaderType(String requestXml) throws JAXBUtilException { JAXBUtil jaxbUtil = CRCLoaderJAXBUtil.getJAXBUtil(); JAXBElement<?> jaxbElement = jaxbUtil.unMashallFromString(requestXml); RequestMessageType requestMessageType = (RequestMessageType) jaxbElement.getValue(); return requestMessageType.getMessageHeader(); }
From source file:edu.harvard.i2b2.crc.delegate.RequestHandler.java
/** * Class to fetch specific request message from i2b2 message xml * /*from www. j av a 2 s .c om*/ * @param requestXml * @param classname * @return object which is of type classname * @throws JAXBUtilException */ protected Object getRequestType(String requestXml, Class classname) throws JAXBUtilException { Object returnObject = null; JAXBUtil jaxbUtil = CRCJAXBUtil.getJAXBUtil(); JAXBElement jaxbElement = jaxbUtil.unMashallFromString(requestXml); RequestMessageType requestMessageType = (RequestMessageType) jaxbElement.getValue(); BodyType bodyType = requestMessageType.getMessageBody(); JAXBUnWrapHelper unWrapHelper = new JAXBUnWrapHelper(); // get request header type returnObject = unWrapHelper.getObjectByClass(bodyType.getAny(), classname); return returnObject; }
From source file:org.socialhistoryservices.pid.ws.PidServiceEndPoint.java
@PayloadRoot(localPart = "UpsertPidRequest", namespace = namespace) @ResponsePayload/*from www .j av a 2 s . co m*/ public JAXBElement<UpsertPidResponseType> upsertPid( @RequestPayload JAXBElement<CreatePidRequestType> requestElement) throws IOException, HandleException { final String na = normalize(requestElement.getValue().getNa(), true); final PidType handle = normalize(requestElement.getValue().getHandle()); final PidType pidType = pidResourceService.upsertPid(na, normalize(handle)); final UpsertPidResponseType response = objectFactory.createUpsertPidResponseType(); response.setHandle(pidType); return objectFactory.createUpsertPidResponse(response); }
From source file:org.socialhistoryservices.pid.ws.PidServiceEndPoint.java
@PayloadRoot(localPart = "CreatePidRequest", namespace = namespace) @ResponsePayload/* w ww.j a v a 2 s. c om*/ public JAXBElement<CreatePidResponseType> createPid( @RequestPayload JAXBElement<CreatePidRequestType> requestElement) throws IOException, HandleException { final String na = normalize(requestElement.getValue().getNa(), true); final PidType handle = normalize(requestElement.getValue().getHandle()); final PidType pidType = pidResourceService.createPid(na, normalize(handle)); final CreatePidResponseType response = objectFactory.createCreatePidResponseType(); response.setHandle(pidType); return objectFactory.createCreatePidResponse(response); }
From source file:edu.harvard.i2b2.crc.delegate.loader.RequestHandler.java
/** * Class to fetch specific request message * from i2b2 message xml// w w w . j a v a 2 s .c o m * @param requestXml * @param classname * @return object which is of type classname * @throws JAXBUtilException */ protected Object getRequestType(String requestXml, Class classname) throws JAXBUtilException { Object returnObject = null; JAXBUtil jaxbUtil = CRCLoaderJAXBUtil.getJAXBUtil(); JAXBElement jaxbElement = jaxbUtil.unMashallFromString(requestXml); RequestMessageType requestMessageType = (RequestMessageType) jaxbElement.getValue(); BodyType bodyType = requestMessageType.getMessageBody(); JAXBUnWrapHelper unWrapHelper = new JAXBUnWrapHelper(); //get request header type returnObject = unWrapHelper.getObjectByClass(bodyType.getAny(), classname); return returnObject; }