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:eu.trentorise.smartcampus.permissionprovider.manager.ResourceAdapter.java
/** * Read the resources from the XML descriptor * @return/*from w ww. j a v a2s. c o m*/ */ private List<Service> loadResourceTemplates() { try { JAXBContext jaxb = JAXBContext.newInstance(Service.class, Services.class, ResourceMapping.class, ResourceDeclaration.class); Unmarshaller unm = jaxb.createUnmarshaller(); JAXBElement<Services> element = (JAXBElement<Services>) unm.unmarshal( new StreamSource(getClass().getResourceAsStream("resourceTemplates.xml")), Services.class); return element.getValue().getService(); } catch (JAXBException e) { logger.error("Failed to load resource templates: " + e.getMessage(), e); return Collections.emptyList(); } }
From source file:com.microsoft.exchange.impl.ExchangeResponseUtilsImpl.java
@Override public boolean parseEmptyFolderResponse(EmptyFolderResponse response) { if (confirmSuccess(response)) { ArrayOfResponseMessagesType responseMessages = response.getResponseMessages(); List<JAXBElement<? extends ResponseMessageType>> messages = responseMessages .getCreateItemResponseMessagesAndDeleteItemResponseMessagesAndGetItemResponseMessages(); for (JAXBElement<? extends ResponseMessageType> message : messages) { ResponseMessageType value = message.getValue(); //TODO parse response value(s) appropriately return true; }// w w w .j av a 2 s . c o m } return false; }
From source file:com.catify.processengine.core.EntityInitialization.java
/** * Creates a sub process. /*from w w w . j a v a2 s . c o m*/ * <p> * Can be called recursively to create nested sub processes. * * @param clientId the client id * @param processJaxb the process jaxb * @param subProcessesJaxb the sub processes jaxb * @param parentNodeRunning the parent node * @param runningPath true, if working the running process path, false if working on the archive process path */ private void createSubProcessNodes(String clientId, TProcess processJaxb, ArrayList<TSubProcess> subProcessesJaxb, FlowNode parentNodeRunning, FlowNode parentNodeArchive) { List<TFlowNode> flowNodesJaxb = new ArrayList<TFlowNode>(); List<TSequenceFlow> sequenceFlowsJaxb = new ArrayList<TSequenceFlow>(); // only check the (currently) last iteration of the list sub processes if (subProcessesJaxb.size() > 0) { TSubProcess subProcessJaxb = subProcessesJaxb.get(subProcessesJaxb.size() - 1); for (JAXBElement<? extends TFlowElement> flowElementJaxb : subProcessJaxb.getFlowElement()) { if (flowElementJaxb.getDeclaredType().equals(TSequenceFlow.class)) { sequenceFlowsJaxb.add((TSequenceFlow) flowElementJaxb.getValue()); } else if (flowElementJaxb.getValue() instanceof TFlowNode) { flowNodesJaxb.add((TFlowNode) flowElementJaxb.getValue()); } } // create the flow nodes that belong to this sub process this.createFlowNodes(clientId, processJaxb, subProcessesJaxb, flowNodesJaxb, sequenceFlowsJaxb, parentNodeRunning, parentNodeArchive); } }
From source file:edu.indiana.d2i.htrc.portal.HTRCPersistenceAPIClient.java
private Object parseXML(String xmlStr) throws JAXBException { // if (log.isDebugEnabled()) { // Logger.debug("Workset Response: \n" + xmlStr); // }//from w w w . ja v a 2 s.c o m JAXBContext jaxbContext = JAXBContext.newInstance("edu.illinois.i3.htrc.registry.entities.workset"); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); unmarshaller.setEventHandler(new RSLValidationEventHandler()); JAXBElement<Object> worksets = (JAXBElement<Object>) unmarshaller .unmarshal(new ByteArrayInputStream(xmlStr.getBytes())); return worksets.getValue(); }
From source file:com.catify.processengine.core.EntityInitialization.java
/** * Initialize neo4j data beans.//from w w w . j ava 2s . c o m * * @param clientId the client id * @param processJaxb the process object generated by jaxb */ @Transactional public synchronized void initializeProcess(String clientId, TProcess processJaxb) { List<TFlowNode> flowNodesJaxb = new ArrayList<TFlowNode>(); List<TSequenceFlow> sequenceFlowsJaxb = new ArrayList<TSequenceFlow>(); // iterate through process elements and separate flow nodes and // sequenceFlows (because they need to be activated after each other) for (JAXBElement<? extends TFlowElement> flowElementJaxb : processJaxb.getFlowElement()) { LOG.debug(String.format("Instantiating %s:%s as a neo4j data node", flowElementJaxb.getDeclaredType().getSimpleName(), flowElementJaxb.getValue().getId())); if (flowElementJaxb.getDeclaredType().equals(TSequenceFlow.class)) { sequenceFlowsJaxb.add((TSequenceFlow) flowElementJaxb.getValue()); } else if (flowElementJaxb.getValue() instanceof TFlowNode) { flowNodesJaxb.add((TFlowNode) flowElementJaxb.getValue()); } } // Save the process to the neo4j db or retrieve it if it already exists this.createEntities(clientId, processJaxb, flowNodesJaxb, sequenceFlowsJaxb); }
From source file:eu.europa.esig.dss.tsl.service.TSLParser.java
@Override @SuppressWarnings("unchecked") public TSLParserResult call() throws Exception { try {// ww w . jav a2 s.c om Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); JAXBElement<TrustStatusListType> jaxbElement = (JAXBElement<TrustStatusListType>) unmarshaller .unmarshal(inputStream); TrustStatusListType trustStatusList = jaxbElement.getValue(); return getTslModel(trustStatusList); } catch (Exception e) { throw new DSSException("Unable to parse inputstream : " + e.getMessage(), e); } }
From source file:com.microsoft.exchange.impl.ExchangeResponseUtilsImpl.java
@Override public List<String> getCreateItemErrors(CreateItemResponse response) { List<String> errs = new ArrayList<String>(); if (null == response || null == response.getResponseMessages()) { errs.add("NO RESPONSE"); return errs; }/*from w ww. j a v a 2 s . c o m*/ ArrayOfResponseMessagesType messages = response.getResponseMessages(); List<JAXBElement<? extends ResponseMessageType>> inner = messages .getCreateItemResponseMessagesAndDeleteItemResponseMessagesAndGetItemResponseMessages(); for (JAXBElement<? extends ResponseMessageType> innerResponse : inner) { ResponseCodeType responseCode = innerResponse.getValue().getResponseCode(); String err = parseInnerResponse(innerResponse); if (!ResponseCodeType.NO_ERROR.equals(responseCode)) { errs.add(err); } } return errs; }
From source file:com.microsoft.exchange.impl.ExchangeResponseUtilsImpl.java
@Override public List<TimeZoneDefinitionType> parseGetServerTimeZonesResponse(GetServerTimeZonesResponse response) { List<TimeZoneDefinitionType> zones = new ArrayList<TimeZoneDefinitionType>(); if (confirmSuccess(response)) { ArrayOfResponseMessagesType responseMessages = response.getResponseMessages(); List<JAXBElement<? extends ResponseMessageType>> tzResponseMessages = responseMessages .getCreateItemResponseMessagesAndDeleteItemResponseMessagesAndGetItemResponseMessages(); for (JAXBElement<? extends ResponseMessageType> message : tzResponseMessages) { ResponseMessageType r = message.getValue(); GetServerTimeZonesResponseMessageType itemInfo = (GetServerTimeZonesResponseMessageType) r; ArrayOfTimeZoneDefinitionType timeZoneDefinitions = itemInfo.getTimeZoneDefinitions(); List<TimeZoneDefinitionType> timeZoneDefinitionsList = timeZoneDefinitions.getTimeZoneDefinitions(); zones = timeZoneDefinitionsList; }// ww w . ja v a 2 s. c om } return zones; }
From source file:eu.europa.esig.dss.tsl.service.TSLParser.java
private void fillPointerTerritoryAndMimeType(OtherTSLPointerType otherTSLPointerType, TSLPointer pointer) { List<Serializable> textualInformationOrOtherInformation = otherTSLPointerType.getAdditionalInformation() .getTextualInformationOrOtherInformation(); if (CollectionUtils.isNotEmpty(textualInformationOrOtherInformation)) { Map<String, String> properties = new HashMap<String, String>(); for (Serializable serializable : textualInformationOrOtherInformation) { if (serializable instanceof AnyType) { AnyType anyInfo = (AnyType) serializable; for (Object content : anyInfo.getContent()) { if (content instanceof JAXBElement) { @SuppressWarnings("rawtypes") JAXBElement jaxbElement = (JAXBElement) content; properties.put(jaxbElement.getName().toString(), jaxbElement.getValue().toString()); } else if (content instanceof Element) { Element element = (Element) content; properties.put("{" + element.getNamespaceURI() + "}" + element.getLocalName(), element.getTextContent()); }/* w w w . j av a 2s.c o m*/ } } } pointer.setMimeType(properties.get("{http://uri.etsi.org/02231/v2/additionaltypes#}MimeType")); pointer.setTerritory(properties.get("{http://uri.etsi.org/02231/v2#}SchemeTerritory")); } }
From source file:com.microsoft.exchange.impl.ExchangeResponseUtilsImpl.java
@Override public Set<ItemIdType> getCreatedItemIds(CreateItemResponse response) { Set<ItemIdType> successfulItems = new HashSet<ItemIdType>(); if (null == response) { return successfulItems; }//from w w w . j a v a2 s.co m ArrayOfResponseMessagesType messages = response.getResponseMessages(); List<JAXBElement<? extends ResponseMessageType>> inner = messages .getCreateItemResponseMessagesAndDeleteItemResponseMessagesAndGetItemResponseMessages(); for (JAXBElement<? extends ResponseMessageType> innerResponse : inner) { ResponseCodeType responseCode = innerResponse.getValue().getResponseCode(); String err = parseInnerResponse(innerResponse); if (ResponseCodeType.NO_ERROR.equals(responseCode)) { ItemInfoResponseMessageType itemInfo = (ItemInfoResponseMessageType) innerResponse.getValue(); ArrayOfRealItemsType items = itemInfo.getItems(); List<ItemType> calendarItems = items.getItemsAndMessagesAndCalendarItems(); for (ItemType itemType : calendarItems) { successfulItems.add(itemType.getItemId()); } } else { log.trace("Failed to create item, " + err); } } return successfulItems; }