Example usage for javax.xml.bind JAXBElement getName

List of usage examples for javax.xml.bind JAXBElement getName

Introduction

In this page you can find the example usage for javax.xml.bind JAXBElement getName.

Prototype

public QName getName() 

Source Link

Document

Returns the xml element tag name.

Usage

From source file:fr.fastconnect.factory.tibco.bw.maven.packaging.ApplicationManagement.java

/**
* This method retrieves the list of objects of type "BWServiceType".
*//*from   w  ww.j a v a  2s . co  m*/
private List<Bw> getBWServices() {
    List<Bw> result = new ArrayList<Bw>();

    for (JAXBElement<? extends ServiceType> jaxbElement : application.getServices().getBaseService()) {
        if (jaxbElement.getName().getLocalPart().equals("bw")) {
            result.add((Bw) jaxbElement.getValue());
        }
    }

    return result;
}

From source file:fr.cls.atoll.motu.library.misc.data.CatalogData.java

/**
 * Search object from a jaxbElement object list according to a specific tag name.
 * /* ww w  .  j av a 2s  .  co  m*/
 * @param listObject list in which one searches
 * @param tagName tag name to search (ignore case)
 * 
 * @return a list that contains object corresponding to tagName parameter (can be empty)
 */
static public List<Object> findJaxbElement(List<Object> listObject, String tagName) {

    List<Object> listObjectFound = new ArrayList<Object>();

    for (Object elt : listObject) {
        if (elt == null) {
            continue;
        }
        if (!(elt instanceof JAXBElement)) {
            continue;
        }

        JAXBElement<?> jabxElement = (JAXBElement<?>) elt;

        if (!jabxElement.getName().getLocalPart().equalsIgnoreCase(tagName)) {
            continue;
        }

        listObjectFound.add(jabxElement.getValue());
    }

    return listObjectFound;

}

From source file:fr.cls.atoll.motu.library.misc.data.CatalogData.java

/**
 * Find jaxb element./*from   w w  w  . ja v a  2s . c om*/
 * 
 * @param tagName the tag name
 * @param listJaxbElement the list jaxb element
 * 
 * @return the list< object>
 */
static public List<Object> findJaxbElement(String tagName, List<JAXBElement<?>> listJaxbElement) {

    List<Object> listObjectFound = new ArrayList<Object>();

    for (Object elt : listJaxbElement) {
        if (elt == null) {
            continue;
        }
        if (!(elt instanceof JAXBElement)) {
            continue;
        }

        JAXBElement<?> jabxElement = (JAXBElement<?>) elt;

        if (!jabxElement.getName().getLocalPart().equalsIgnoreCase(tagName)) {
            continue;
        }

        listObjectFound.add(jabxElement.getValue());
    }

    return listObjectFound;

}

From source file:net.morphbank.mbsvc3.xml.XmlBaseObject.java

public JAXBElement getFirstTag(String tagName) {
    Iterator<Object> tags = getAny().iterator();
    while (tags.hasNext()) {
        JAXBElement obj = (JAXBElement) tags.next();
        QName qname = obj.getName();
        String localPart = qname.getLocalPart();
        if (localPart.equals(tagName)) {
            return obj;
        }//from   w ww. j  a  v  a  2s.com
    }
    return null;
}

From source file:net.morphbank.mbsvc3.xml.XmlBaseObject.java

public Date getFirstTagDateValue(String tagName) {
    Iterator<Object> tags = getAny().iterator();
    while (tags.hasNext()) {
        JAXBElement obj = (JAXBElement) tags.next();
        QName qname = obj.getName();
        if (qname.getLocalPart().equals(tagName)) {
            Object value = obj.getValue();
            if (value instanceof Date) {
                return (Date) value;
            }// ww w .ja v a  2  s .c  om
        }
    }
    return null;
}

From source file:com.evolveum.midpoint.testing.model.client.sample.TestExchangeConnector.java

private Map<String, Object> getAttributesAsMap(ShadowType shadowType) {
    Map<String, Object> rv = new HashMap<>();

    ShadowAttributesType attributes = shadowType.getAttributes();
    for (Object item : attributes.getAny()) {
        if (item instanceof Element) {
            Element e = (Element) item;
            put(rv, e.getLocalName(), e.getTextContent());
        } else if (item instanceof JAXBElement) {
            JAXBElement je = (JAXBElement) item;
            put(rv, je.getName().getLocalPart(), je.getValue());
        } else {//from  ww  w.j a  v a2 s.  com
            // nothing to do here
        }
    }
    return rv;
}

From source file:com.evolveum.midpoint.testing.model.client.sample.AbstractTestForExchangeConnector.java

protected void dumpAttributes(ShadowType shadowType) {
    ShadowAttributesType attributes = shadowType.getAttributes();
    System.out.println("Attributes for " + shadowType.getObjectClass().getLocalPart() + " "
            + getOrig(shadowType.getName()) + " {" + attributes.getAny().size() + " entries):");
    for (Object item : attributes.getAny()) {
        if (item instanceof Element) {
            Element e = (Element) item;
            System.out.println(" - " + e.getLocalName() + ": " + e.getTextContent());
        } else if (item instanceof JAXBElement) {
            JAXBElement je = (JAXBElement) item;
            String typeInfo = je.getValue() instanceof String ? ""
                    : (" (" + je.getValue().getClass().getSimpleName() + ")");
            System.out.println(" - " + je.getName().getLocalPart() + ": " + je.getValue() + typeInfo);
        } else {/*  w ww . j  ava 2 s  .co m*/
            System.out.println(" - " + item);
        }
    }
}

From source file:com.evolveum.midpoint.testing.model.client.sample.TestExchangeConnector.java

private void dumpAttributes(ShadowType shadowType) {
    ShadowAttributesType attributes = shadowType.getAttributes();
    System.out.println("Attributes for " + shadowType.getObjectClass().getLocalPart() + " "
            + getOrig(shadowType.getName()) + " {" + attributes.getAny().size() + " entries):");
    for (Object item : attributes.getAny()) {
        if (item instanceof Element) {
            Element e = (Element) item;
            System.out.println(" - " + e.getLocalName() + ": " + e.getTextContent());
        } else if (item instanceof JAXBElement) {
            JAXBElement je = (JAXBElement) item;
            String typeInfo = je.getValue() instanceof String ? ""
                    : (" (" + je.getValue().getClass().getSimpleName() + ")");
            System.out.println(" - " + je.getName().getLocalPart() + ": " + je.getValue() + typeInfo);
        } else {/*  ww w.j ava 2  s .  c o m*/
            System.out.println(" - " + item);
        }
    }
}

From source file:com.cisco.dvbu.ps.deploytool.services.TriggerManagerImpl.java

private void populateTriggerAttributes(TriggerResource triggerResource, TriggerType triggerType, long loopCount,
        TriggerScheduleListType scheduleList) {

    triggerType.setId("TR-" + loopCount);
    triggerType.setResourcePath(triggerResource.getPath());
    triggerType.setIsEnabled(triggerResource.isEnabled());
    triggerType.setAnnotation(triggerResource.getAnnotation());
    if (logger.isDebugEnabled()) {
        logger.debug("Processing trigger: " + triggerResource.getPath());
        logger.debug("Rest field is of type: " + triggerResource.getRest().getClass().getName());
        logger.debug("Looping through list:");
    }//from  w w w. java  2s .co m

    long objLoopCount = 0;
    String conditionType = null;
    String actionType = null;
    AttributeList conditionAttributes = null;
    Schedule conditionSchedule = null;
    AttributeList actionAttributes = null;
    BigInteger maxEventsQueued = null;

    for (JAXBElement<?> triggerObj : triggerResource.getRest()) {
        objLoopCount++;

        if (logger.isDebugEnabled()) {
            logger.debug("Rest field[" + objLoopCount + "] is of type: " + triggerObj.getClass().getName());
            logger.debug("JAXB Name: " + triggerObj.getName());
            logger.debug("JAXB Declared Type: " + triggerObj.getDeclaredType());

        }
        if (triggerObj.getName().getLocalPart().toString().equalsIgnoreCase("conditionType")) {
            logger.debug("Processing conditionType");
            conditionType = (String) triggerObj.getValue();
        }
        if (triggerObj.getName().getLocalPart().toString().equalsIgnoreCase("conditionAttributes")) {
            logger.debug("Processing condition attributes");
            conditionAttributes = (AttributeList) triggerObj.getValue();
        }
        if (triggerObj.getName().getLocalPart().toString().equalsIgnoreCase("conditionSchedule")) {
            logger.debug("Processing condition schedule");
            conditionSchedule = (Schedule) triggerObj.getValue();
        }
        if (triggerObj.getName().getLocalPart().toString().equalsIgnoreCase("actionType")) {
            logger.debug("Processing actionType");
            actionType = (String) triggerObj.getValue();
        }
        if (triggerObj.getName().getLocalPart().toString().equalsIgnoreCase("actionAttributes")) {
            logger.debug("Processing action attributes");
            actionAttributes = (AttributeList) triggerObj.getValue();
        }
        if (triggerObj.getName().getLocalPart().toString().equalsIgnoreCase("maxEventsQueued")) {
            logger.debug("Processing max events queued");
            maxEventsQueued = (BigInteger) triggerObj.getValue();
        }
    }

    triggerType.setMaxEventsQueued(maxEventsQueued);
    if (logger.isDebugEnabled()) {
        logger.debug("Condition type: " + conditionType);
        logger.debug("Action type: " + actionType);
    }

    triggerType.setCondition(populateTriggerCondition(conditionType, conditionAttributes, conditionSchedule,
            "TR-" + loopCount, scheduleList));
    triggerType.setAction(populateTriggerAction(actionType, actionAttributes, "TR-" + loopCount));

    if (logger.isDebugEnabled()) {
        if (scheduleList.getSchedule().isEmpty()) {
            logger.debug("Schedule List is empty");
        } else {
            logger.debug("Schedule List size: " + scheduleList.getSchedule().size());
        }
    }
}

From source file:com.accela.cers.FacilityConverter.java

private void setHazarousWasteAsi(List<AdditionalInformationGroup> addInfoGroup,
        FacilitySubmittalType facilitySubmittalType) {
    boolean wasteStatusFlag = CapUtil.getStatusFlag(facilitySubmittalType, CapUtil.WASTE_STATUS);
    if (facilitySubmittalType.getOnsiteHazardousWasteTreatmentNotification() != null && wasteStatusFlag) {
        HWFacilityType hwf = facilitySubmittalType.getOnsiteHazardousWasteTreatmentNotification()
                .getHWFacility();/*from w ww .j ava  2  s .c om*/
        if (hwf != null) {
            Object asiGroups[] = getAddInfoSubGroup(addInfoGroup, "DEH_HUPF_T27", "CERS COLLECTED INFO");
            AdditionalInformationSubGroup asiSubGroup = (AdditionalInformationSubGroup) asiGroups[1];
            AdditionalItems asitAdditems = asiSubGroup.getAdditionalItems();
            HWCertificationOfFinancialAssurancesType hwc = hwf.getHWCertificationOfFinancialAssurances();
            if (hwc != null) {
                // setValue(getAddItem(cb.get("TypeOfOperation"), asitAdditems), );
                List<HWCertificationOfFinancialAssuranceType> hwts = hwc
                        .getHWCertificationOfFinancialAssurance();
                if (hwts != null) {
                    for (HWCertificationOfFinancialAssuranceType hwt : hwts) { // That is a big problem.
                        setDropdownValue(hwt.getTypeOfOperation(), "TypeOfOperation", asitAdditems);
                        //setValue(getAddItem(cb.get("TypeOfOperation"), asitAdditems), hwt.getTypeOfOperation());
                        setValue(getAddItem(cb.get("EstimatedClosureCost"), asitAdditems),
                                hwt.getEstimatedClosureCost());

                        List<JAXBElement<?>> exeFroms = hwt
                                .getExemptFromFAOrExemptFromFAOtherOrExemptFromFAPBR();
                        if (exeFroms != null) {
                            for (JAXBElement<?> exeFrom : exeFroms) {
                                if ("ExemptFromFA".equals(exeFrom.getName().toString())) {
                                    setDropdownValue(getValue(exeFrom), "ExemptFromFA", asitAdditems);
                                    //setValue(getAddItem(cb.get("ExemptFromFA"), asitAdditems), exeFrom.getValue());
                                }
                                if ("ExemptFromFAOther".equals(exeFrom.getName().toString())) {
                                    HWCertificationOfFinancialAssuranceType.ExemptFromFAOther exemptFromFAOther = (HWCertificationOfFinancialAssuranceType.ExemptFromFAOther) exeFrom
                                            .getValue();
                                    setDropdownValue(
                                            exemptFromFAOther == null ? ""
                                                    : exemptFromFAOther.getExemptFromFADescriptionOther(),
                                            "ExemptFromFAOther", asitAdditems);
                                    //setValue(getAddItem(cb.get("ExemptFromFAOther"), asitAdditems), exeFrom
                                    //.getValue());
                                }
                                if ("ExemptFromFAPBR".equals(exeFrom.getName().toString())) {
                                    setDropdownValue(getValue(exeFrom), "ExemptFromFAPBR", asitAdditems);
                                    //setValue(getAddItem(cb.get("ExemptFromFAPBR"), asitAdditems), exeFrom
                                    //.getValue());
                                }
                            }
                        }
                        setValue(getAddItem(cb.get("DateOfClosureAssuranceMechanism"), asitAdditems),
                                hwt.getDateOfClosureAssuranceMechanism());
                        setValue(getAddItem(cb.get("MechanismIDNumber"), asitAdditems),
                                hwt.getMechanismIDNumber());
                        setDropdownValue(hwt.getClosureAssuranceMechanism(), "ClosureAssuranceMechanism",
                                asitAdditems);
                        //                     setValue(getAddItem(cb.get("ClosureAssuranceMechanism"), asitAdditems), hwt
                        //                           .getClosureAssuranceMechanism());
                        setValue(getAddItem(cb.get("FinancialInstitutionName"), asitAdditems),
                                hwt.getFinancialInstitutionName());
                        setValue(getAddItem(cb.get("FinancialInstitutionAddress"), asitAdditems),
                                hwt.getFinancialInstitutionAddress());
                        setValue(getAddItem(cb.get("FinancialInstitutionCity"), asitAdditems),
                                hwt.getFinancialInstitutionCity());
                        setValue(getAddItem(cb.get("FinancialInstitutionState"), asitAdditems),
                                hwt.getFinancialInstitutionState());
                        setValue(getAddItem(cb.get("FinancialInstitutionZip"), asitAdditems),
                                hwt.getFinancialInstitutionZip());
                        setValue(getAddItem(cb.get("FinancialInstitutionCountry"), asitAdditems),
                                hwt.getFinancialInstitutionCountry());
                        setDropdownValue(getValue(hwt.getSignerOfCertification()), "SignerOfCertification",
                                asitAdditems);
                        //                     setValue(getAddItem(cb.get("SignerOfCertification"), asitAdditems), hwt
                        //                           .getSignerOfCertification());

                        setValue(getAddItem(cb.get("DateCertified_716"), asitAdditems),
                                toString(hwt.getDateCertified()));
                        setValue(getAddItem(cb.get("OOName"), asitAdditems), hwt.getOOName());
                        setValue(getAddItem(cb.get("OOTitle"), asitAdditems), hwt.getOOTitle());
                    }
                }

            }
            setValue(getAddItem(cb.get("PMFacilityPermit"), asitAdditems), toString(hwf.getPMFacilityPermit()));
            setValue(getAddItem(cb.get("PMInterimStatus"), asitAdditems), toString(hwf.getPMInterimStatus()));
            setValue(getAddItem(cb.get("PMStandardizedPermit"), asitAdditems),
                    toString(hwf.getPMStandardizedPermit()));
            setValue(getAddItem(cb.get("PMVariance"), asitAdditems), toString(hwf.getPMVariance()));
            setValue(getAddItem(cb.get("PMConsentAgreement"), asitAdditems),
                    toString(hwf.getPMConsentAgreement()));
            setValue(getAddItem(cb.get("ShortenedReviewPeriod"), asitAdditems),
                    toString(hwf.getShortenedReviewPeriod()));
            setValue(getAddItem(cb.get("ReviewPeriodReasonForRequest"), asitAdditems),
                    hwf.getReviewPeriodReasonForRequest());
            setValue(getAddItem(cb.get("NumberOfUnitsCECL"), asitAdditems),
                    toString(hwf.getNumberOfUnitsCECL()));
            setValue(getAddItem(cb.get("DateCertified_6"), asitAdditems), toString(hwf.getDateCertified()));
            setValue(getAddItem(cb.get("OOName_6"), asitAdditems), hwf.getOOName());
            setValue(getAddItem(cb.get("OOTitle_6"), asitAdditems), hwf.getOOTitle());
        }

    } else {
        aisCodeAndType = "DEH_HUPF_T27|CERS COLLECTED INFO|";
        if (asiValueMap == null || asiValueMap.size() == 0) {
            return;
        }
        Object asiGroups[] = getAddInfoSubGroup(addInfoGroup, "DEH_HUPF_T27", "CERS COLLECTED INFO");
        AdditionalInformationSubGroup asiSubGroup = (AdditionalInformationSubGroup) asiGroups[1];
        AdditionalItems asitAdditems = asiSubGroup.getAdditionalItems();
        setDropdownValue(asiValueMap, "TypeOfOperation", asitAdditems);
        setValue(getAddItem(cb.get("EstimatedClosureCost"), asitAdditems),
                asiValueMap.get(aisCodeAndType + cb.get("EstimatedClosureCost")));

        setDropdownValue(asiValueMap, "ExemptFromFA", asitAdditems);
        setDropdownValue(asiValueMap, "ExemptFromFAOther", asitAdditems);
        setDropdownValue(asiValueMap, "ExemptFromFAPBR", asitAdditems);

        setValue(getAddItem(cb.get("DateOfClosureAssuranceMechanism"), asitAdditems),
                asiValueMap.get(aisCodeAndType + cb.get("DateOfClosureAssuranceMechanism")));
        setValue(getAddItem(cb.get("MechanismIDNumber"), asitAdditems),
                asiValueMap.get(aisCodeAndType + cb.get("MechanismIDNumber")));
        setDropdownValue(asiValueMap, "ClosureAssuranceMechanism", asitAdditems);
        setValue(getAddItem(cb.get("FinancialInstitutionName"), asitAdditems),
                asiValueMap.get(aisCodeAndType + cb.get("FinancialInstitutionName")));
        setValue(getAddItem(cb.get("FinancialInstitutionAddress"), asitAdditems),
                asiValueMap.get(aisCodeAndType + cb.get("FinancialInstitutionAddress")));
        setValue(getAddItem(cb.get("FinancialInstitutionCity"), asitAdditems),
                asiValueMap.get(aisCodeAndType + cb.get("FinancialInstitutionCity")));
        setValue(getAddItem(cb.get("FinancialInstitutionState"), asitAdditems),
                asiValueMap.get(aisCodeAndType + cb.get("FinancialInstitutionState")));
        setValue(getAddItem(cb.get("FinancialInstitutionZip"), asitAdditems),
                asiValueMap.get(aisCodeAndType + cb.get("FinancialInstitutionZip")));
        setValue(getAddItem(cb.get("FinancialInstitutionCountry"), asitAdditems),
                asiValueMap.get(aisCodeAndType + cb.get("FinancialInstitutionCountry")));
        setDropdownValue(asiValueMap, "SignerOfCertification", asitAdditems);

        setValue(getAddItem(cb.get("DateCertified_716"), asitAdditems),
                asiValueMap.get(aisCodeAndType + cb.get("DateCertified_716")));
        setValue(getAddItem(cb.get("OOName"), asitAdditems),
                asiValueMap.get(aisCodeAndType + cb.get("OOName")));
        setValue(getAddItem(cb.get("OOTitle"), asitAdditems),
                asiValueMap.get(aisCodeAndType + cb.get("OOTitle")));

        setValue(getAddItem(cb.get("PMFacilityPermit"), asitAdditems),
                asiValueMap.get(aisCodeAndType + cb.get("PMFacilityPermit")));
        setValue(getAddItem(cb.get("PMInterimStatus"), asitAdditems),
                asiValueMap.get(aisCodeAndType + cb.get("PMInterimStatus")));
        setValue(getAddItem(cb.get("PMStandardizedPermit"), asitAdditems),
                asiValueMap.get(aisCodeAndType + cb.get("PMStandardizedPermit")));
        setValue(getAddItem(cb.get("PMVariance"), asitAdditems),
                asiValueMap.get(aisCodeAndType + cb.get("PMVariance")));
        setValue(getAddItem(cb.get("PMConsentAgreement"), asitAdditems),
                asiValueMap.get(aisCodeAndType + cb.get("FRCodeGuarantee")));
        setValue(getAddItem(cb.get("ShortenedReviewPeriod"), asitAdditems),
                asiValueMap.get(aisCodeAndType + cb.get("ShortenedReviewPeriod")));
        setValue(getAddItem(cb.get("ReviewPeriodReasonForRequest"), asitAdditems),
                asiValueMap.get(aisCodeAndType + cb.get("ReviewPeriodReasonForRequest")));
        setValue(getAddItem(cb.get("NumberOfUnitsCECL"), asitAdditems),
                asiValueMap.get(aisCodeAndType + cb.get("NumberOfUnitsCECL")));
        setValue(getAddItem(cb.get("DateCertified_6"), asitAdditems),
                asiValueMap.get(aisCodeAndType + cb.get("DateCertified_6")));
        setValue(getAddItem(cb.get("OOName_6"), asitAdditems),
                asiValueMap.get(aisCodeAndType + cb.get("OOName_6")));
        setValue(getAddItem(cb.get("OOTitle_6"), asitAdditems),
                asiValueMap.get(aisCodeAndType + cb.get("OOTitle_6")));

    }
}