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.samples.platform.serviceprovider.library.internal.CreateBookOperation.java
/** * @param message/*from ww w . j ava 2s. co m*/ * the {@link JAXBElement} containing a * {@link CreateBookRequestType}. * @return the {@link JAXBElement} with a {@link CreateBookResponseType}. */ @InsightEndPoint @ServiceActivator public final JAXBElement<CreateBookResponseType> createBook(final JAXBElement<CreateBookRequestType> message) { this.logger.debug("+createBook"); CreateBookRequestType request = message.getValue(); CreateBookResponseType response = this.of.createCreateBookResponseType(); long start = System.currentTimeMillis(); try { for (BookType book : request.getBook()) { response.getBook().add(this.dao.createBook(book)); } } catch (Exception e) { FailureType f = FailureHandler.getFailureType("E_ALL_NOT_KNOWN_ERROR", e); response.getFailure().add(f); } finally { this.logger.debug(" createBook duration {}", DateUtil.getDuration(start, System.currentTimeMillis())); this.logger.debug("-createBook #{}, #f{}", response.getBook().size(), response.getFailure().size()); } return this.of.createCreateBookResponse(response); }
From source file:com.qpark.eip.core.model.analysis.operation.GetDataTypeOperation.java
/** * @param message/*from w w w . j a v a2 s . co m*/ * the {@link JAXBElement} containing a * {@link GetDataTypeRequestType}. * @return the {@link JAXBElement} with a {@link GetDataTypeResponseType}. */ @Override public final JAXBElement<GetDataTypeResponseType> invoke(final JAXBElement<GetDataTypeRequestType> message) { this.logger.debug("+getDataType"); GetDataTypeRequestType request = message.getValue(); GetDataTypeResponseType response = this.of.createGetDataTypeResponseType(); long start = System.currentTimeMillis(); try { String modelVersion = request.getRevision(); if (Objects.isNull(modelVersion) || modelVersion.trim().length() == 0) { modelVersion = this.dao.getLastModelVersion(); } response.getDataType().addAll(this.dao.getDataTypesById(modelVersion, request.getId())); } catch (Throwable e) { /* Add a not covered error to the response. */ this.logger.error(e.getMessage(), e); } finally { this.logger.debug(" getDataType duration {}", DateUtil.getDuration(start, System.currentTimeMillis())); this.logger.debug("-getDataType #{}", response.getDataType().size()); } return this.of.createGetDataTypeResponse(response); }
From source file:edu.harvard.i2b2.eclipse.plugins.query.workplaceMessaging.ExportChildResponseMessage.java
public String processBody(String response) { String status = null;// w ww . j ava 2 s .c o m try { JAXBElement jaxbElement = QueryJAXBUtil.getJAXBUtil().unMashallFromString(response); ResponseMessageType respMessageType = (ResponseMessageType) jaxbElement.getValue(); // Get response message status BodyType responseHeader = respMessageType.getMessageBody(); //.getResponseHeader(); JAXBElement jaxb = (JAXBElement) responseHeader.getAny().get(0); //.toString(); //.g.getResultStatus().getStatus(); status = jaxb.getValue().toString(); //XMLUtil.convertDOMElementToString(jaxb); } catch (JAXBUtilException e) { log.error(e.getMessage()); } return status; }
From source file:com.qpark.eip.core.model.analysis.operation.GetServiceOperation.java
/** * @param message// w ww. j a v a 2 s. c om * the {@link JAXBElement} containing a * {@link GetServiceRequestType}. * @return the {@link JAXBElement} with a {@link GetServiceResponseType}. */ @Override public final JAXBElement<GetServiceResponseType> invoke(final JAXBElement<GetServiceRequestType> message) { this.logger.debug("+getService"); GetServiceRequestType request = message.getValue(); GetServiceResponseType response = this.of.createGetServiceResponseType(); long start = System.currentTimeMillis(); try { String modelVersion = request.getRevision(); if (Objects.isNull(modelVersion) || modelVersion.trim().length() == 0) { modelVersion = this.dao.getLastModelVersion(); } if (Objects.isNull(modelVersion) || modelVersion.trim().length() == 0) { modelVersion = this.dao.getLastModelVersion(); } response.setService(this.dao.getServiceByServiceId(modelVersion, request.getServiceId())); } catch (Throwable e) { /* Add a not covered error to the response. */ this.logger.error(e.getMessage(), e); } finally { this.logger.debug(" getService duration {}", DateUtil.getDuration(start, System.currentTimeMillis())); this.logger.debug("-getService #{}", response.getService() != null ? 1 : 0); } return this.of.createGetServiceResponse(response); }
From source file:com.codercowboy.photo.organizer.service.LibraryMarshaller.java
public Library loadLibrary(String fileName) throws Exception { byte[] fileData = FileUtils.readFileToByteArray(new File(fileName)); ByteArrayInputStream bais = new ByteArrayInputStream(fileData); try {/* w w w . j a va 2s .com*/ Unmarshaller unmarshaller = this.createContext().createUnmarshaller(); @SuppressWarnings("unchecked") JAXBElement<Library> jaxbElement = (JAXBElement<Library>) unmarshaller.unmarshal(bais); return jaxbElement.getValue(); } finally { bais.close(); } }
From source file:edu.harvard.i2b2.eclipse.plugins.workplace.ws.ExportChildResponseMessage.java
public String processBody(String response) { String status = null;/*w w w .j a va 2 s . co m*/ try { JAXBElement jaxbElement = WorkplaceJAXBUtil.getJAXBUtil().unMashallFromString(response); ResponseMessageType respMessageType = (ResponseMessageType) jaxbElement.getValue(); // Get response message status BodyType responseHeader = respMessageType.getMessageBody(); //.getResponseHeader(); JAXBElement jaxb = (JAXBElement) responseHeader.getAny().get(0); //.toString(); //.g.getResultStatus().getStatus(); status = jaxb.getValue().toString(); //XMLUtil.convertDOMElementToString(jaxb); } catch (JAXBUtilException e) { log.error(e.getMessage()); } return status; }
From source file:edu.harvard.i2b2.eclipse.plugins.patientSet.workplaceMessaging.ExportChildResponseMessage.java
public String processBody(String response) { String status = null;//w w w . j av a2 s .co m try { JAXBElement jaxbElement = PatientSetJAXBUtil.getJAXBUtil().unMashallFromString(response); ResponseMessageType respMessageType = (ResponseMessageType) jaxbElement.getValue(); // Get response message status BodyType responseHeader = respMessageType.getMessageBody(); //.getResponseHeader(); JAXBElement jaxb = (JAXBElement) responseHeader.getAny().get(0); //.toString(); //.g.getResultStatus().getStatus(); status = jaxb.getValue().toString(); //XMLUtil.convertDOMElementToString(jaxb); } catch (JAXBUtilException e) { log.error(e.getMessage()); } return status; }
From source file:io.mapzone.controller.catalog.csw.FilterParser.java
protected void handleLogic(JAXBElement<? extends LogicOpsType> jaxb) { if (jaxb != null && jaxb.getValue() != null) { throw new UnsupportedOperationException("Logic ops are not supported yet."); }// w w w . j a va 2 s .c o m }
From source file:edu.harvard.i2b2.fr.delegate.pm.PMResponseMessage.java
public StatusType processResult(String response) throws JAXBUtilException { StatusType status = null;// w w w .java2 s . c o m try { JAXBElement jaxbElement = FRJAXBUtil.getJAXBUtil().unMashallFromString(response); pmRespMessageType = (ResponseMessageType) jaxbElement.getValue(); // Get response message status ResponseHeaderType responseHeader = pmRespMessageType.getResponseHeader(); status = responseHeader.getResultStatus().getStatus(); String procStatus = status.getType(); String procMessage = status.getValue(); if (procStatus.equals("ERROR")) { log.error("Error reported by CRC web Service " + procMessage); } else if (procStatus.equals("WARNING")) { log.debug("Warning reported by CRC web Service" + procMessage); } } catch (JAXBUtilException e) { log.error(e); throw e; } return status; }
From source file:com.qpark.eip.core.model.analysis.operation.GetServiceIdOperation.java
/** * @param message//from w ww . ja va 2s .c o m * the {@link JAXBElement} containing a * {@link GetServiceIdRequestType}. * @return the {@link JAXBElement} with a {@link GetServiceIdResponseType}. */ @Override public final JAXBElement<GetServiceIdResponseType> invoke(final JAXBElement<GetServiceIdRequestType> message) { this.logger.debug("+getServiceId"); final GetServiceIdRequestType request = message.getValue(); final GetServiceIdResponseType response = this.of.createGetServiceIdResponseType(); final long start = System.currentTimeMillis(); try { String modelVersion = request.getRevision(); if (Objects.isNull(modelVersion) || modelVersion.trim().length() == 0) { modelVersion = this.dao.getLastModelVersion(); } response.getServiceId().addAll(this.dao.getServiceIds(modelVersion)); } catch (final Throwable e) { /* Add a not covered error to the response. */ this.logger.error(e.getMessage(), e); } finally { this.logger.debug(" getServiceId duration {}", DateUtil.getDuration(start, System.currentTimeMillis())); this.logger.debug("-getServiceId #{}", response.getServiceId().size()); } return this.of.createGetServiceIdResponse(response); }