Search in sources :

Example 6 with NotIdentifiableEventImpl

use of javax.xml.bind.helpers.NotIdentifiableEventImpl in project OpenAM by OpenRock.

the class SAXMarshaller method reconcileID.

void reconcileID() throws AbortSerializationException {
    // find objects that were not a part of the object graph 
    idReferencedObjects.removeAll(objectsWithId);
    for (Iterator itr = idReferencedObjects.iterator(); itr.hasNext(); ) {
        IdentifiableObject o = (IdentifiableObject) itr.next();
        reportError(new NotIdentifiableEventImpl(ValidationEvent.ERROR, Messages.format(Messages.ERR_DANGLING_IDREF, o.____jaxb____getId()), new ValidationEventLocatorImpl(o)));
    }
    // clear the garbage
    idReferencedObjects.clear();
    objectsWithId.clear();
}
Also used : ValidationEventLocatorImpl(javax.xml.bind.helpers.ValidationEventLocatorImpl) Iterator(java.util.Iterator) NotIdentifiableEventImpl(javax.xml.bind.helpers.NotIdentifiableEventImpl) IdentifiableObject(com.sun.xml.bind.marshaller.IdentifiableObject)

Example 7 with NotIdentifiableEventImpl

use of javax.xml.bind.helpers.NotIdentifiableEventImpl in project OpenAM by OpenRock.

the class ValidationContext method reconcileIDs.

/** Tests if all IDREFs have corresponding IDs. */
protected void reconcileIDs() throws SAXException {
    if (!validateID)
        return;
    for (Iterator itr = IDREFs.entrySet().iterator(); itr.hasNext(); ) {
        Map.Entry e = (Map.Entry) itr.next();
        if (IDs.contains(e.getKey()))
            // OK.
            continue;
        // ID was not found.
        ValidatableObject source = (ValidatableObject) e.getValue();
        reportEvent(source, new NotIdentifiableEventImpl(ValidationEvent.ERROR, Messages.format(Messages.ID_NOT_FOUND, e.getKey()), new ValidationEventLocatorImpl(source)));
    }
    IDREFs.clear();
}
Also used : ValidationEventLocatorImpl(javax.xml.bind.helpers.ValidationEventLocatorImpl) Iterator(java.util.Iterator) NotIdentifiableEventImpl(javax.xml.bind.helpers.NotIdentifiableEventImpl) HashMap(java.util.HashMap) Map(java.util.Map)

Example 8 with NotIdentifiableEventImpl

use of javax.xml.bind.helpers.NotIdentifiableEventImpl in project Payara by payara.

the class SAXMarshaller method reconcileID.

void reconcileID() throws AbortSerializationException {
    // find objects that were not a part of the object graph
    idReferencedObjects.removeAll(objectsWithId);
    for (Iterator itr = idReferencedObjects.iterator(); itr.hasNext(); ) {
        IdentifiableObject o = (IdentifiableObject) itr.next();
        reportError(new NotIdentifiableEventImpl(ValidationEvent.ERROR, Messages.format(Messages.ERR_DANGLING_IDREF, o.____jaxb____getId()), new ValidationEventLocatorImpl(o)));
    }
    // clear the garbage
    idReferencedObjects.clear();
    objectsWithId.clear();
}
Also used : ValidationEventLocatorImpl(javax.xml.bind.helpers.ValidationEventLocatorImpl) Iterator(java.util.Iterator) NotIdentifiableEventImpl(javax.xml.bind.helpers.NotIdentifiableEventImpl) IdentifiableObject(com.sun.xml.bind.marshaller.IdentifiableObject)

Example 9 with NotIdentifiableEventImpl

use of javax.xml.bind.helpers.NotIdentifiableEventImpl in project OpenAM by OpenRock.

the class ValidationContext method reconcileIDs.

/** Tests if all IDREFs have corresponding IDs. */
protected void reconcileIDs() throws SAXException {
    if (!validateID)
        return;
    for (Iterator itr = IDREFs.entrySet().iterator(); itr.hasNext(); ) {
        Map.Entry e = (Map.Entry) itr.next();
        if (IDs.contains(e.getKey()))
            // OK.
            continue;
        // ID was not found.
        ValidatableObject source = (ValidatableObject) e.getValue();
        reportEvent(source, new NotIdentifiableEventImpl(ValidationEvent.ERROR, Messages.format(Messages.ID_NOT_FOUND, e.getKey()), new ValidationEventLocatorImpl(source)));
    }
    IDREFs.clear();
}
Also used : ValidationEventLocatorImpl(javax.xml.bind.helpers.ValidationEventLocatorImpl) Iterator(java.util.Iterator) NotIdentifiableEventImpl(javax.xml.bind.helpers.NotIdentifiableEventImpl) HashMap(java.util.HashMap) Map(java.util.Map)

Example 10 with NotIdentifiableEventImpl

use of javax.xml.bind.helpers.NotIdentifiableEventImpl in project OpenAM by OpenRock.

the class SAXMarshaller method onIDREF.

public String onIDREF(IdentifiableObject obj) throws SAXException {
    idReferencedObjects.add(obj);
    String id = obj.____jaxb____getId();
    if (id == null) {
        reportError(new NotIdentifiableEventImpl(ValidationEvent.ERROR, Messages.format(Messages.ERR_NOT_IDENTIFIABLE), new ValidationEventLocatorImpl(obj)));
    }
    return id;
}
Also used : ValidationEventLocatorImpl(javax.xml.bind.helpers.ValidationEventLocatorImpl) NotIdentifiableEventImpl(javax.xml.bind.helpers.NotIdentifiableEventImpl)

Aggregations

NotIdentifiableEventImpl (javax.xml.bind.helpers.NotIdentifiableEventImpl)15 ValidationEventLocatorImpl (javax.xml.bind.helpers.ValidationEventLocatorImpl)15 Iterator (java.util.Iterator)10 IdentifiableObject (com.sun.xml.bind.marshaller.IdentifiableObject)5 HashMap (java.util.HashMap)5 Map (java.util.Map)5