Example usage for java.util SortedMap values

List of usage examples for java.util SortedMap values

Introduction

In this page you can find the example usage for java.util SortedMap values.

Prototype

Collection<V> values();

Source Link

Document

Returns a Collection view of the values contained in this map.

Usage

From source file:net.sourceforge.msscodefactory.cfgcash.v2_0.CFGCashXMsgRqstHandler.CFGCashXMsgRqstAccountContactReadAllHandler.java

public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
    try {/*w  w w. j  av a  2  s .  c  o  m*/
        // Common XML Attributes
        String attrId = null;
        // Attribute Extraction
        String attrLocalName;
        int numAttrs;
        int idxAttr;
        final String S_ProcName = "startElement";
        final String S_LocalName = "LocalName";

        assert qName.equals("RqstAccountContactReadAll");

        CFGCashXMsgRqstHandler xmsgRqstHandler = (CFGCashXMsgRqstHandler) getParser();
        if (xmsgRqstHandler == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "getParser()");
        }

        ICFGCashSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj();
        if (schemaObj == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "getParser().getSchemaObj()");
        }

        // Extract Attributes
        numAttrs = attrs.getLength();
        for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) {
            attrLocalName = attrs.getLocalName(idxAttr);
            if (attrLocalName.equals("Id")) {
                if (attrId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("schemaLocation")) {
                // ignored
            } else {
                throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(),
                        S_ProcName, getParser().getLocationInfo(), attrLocalName);
            }
        }

        // Save named attributes to context
        CFLibXmlCoreContext curContext = getParser().getCurContext();
        // Read the objects and prepare the response XML
        SortedMap<CFGCashAccountContactPKey, ICFGCashAccountContactObj> map = schemaObj
                .getAccountContactTableObj().readAllAccountContact(true);
        String responseOpening = CFGCashXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t"
                + CFGCashXMsgAccountContactMessageFormatter.formatAccountContactRspnListOpenTag();
        xmsgRqstHandler.appendResponse(responseOpening);
        Iterator<ICFGCashAccountContactObj> iter = map.values().iterator();
        ICFGCashAccountContactObj cur;
        String subxml;
        while (iter.hasNext()) {
            cur = iter.next();
            subxml = CFGCashXMsgAccountContactMessageFormatter.formatAccountContactRspnDerivedRec("\n\t\t",
                    cur.getAccountContactBuff());
            xmsgRqstHandler.appendResponse(subxml);
        }
        String responseClosing = "\n" + "\t"
                + CFGCashXMsgAccountContactMessageFormatter.formatAccountContactRspnListCloseTag()
                + CFGCashXMsgSchemaMessageFormatter.formatRspnXmlPostamble();
        xmsgRqstHandler.appendResponse(responseClosing);
    } catch (RuntimeException e) {
        String response = CFGCashXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t"
                + CFGCashXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n"
                + CFGCashXMsgSchemaMessageFormatter.formatRspnXmlPostamble();
        CFGCashXMsgRqstHandler xmsgRqstHandler = ((CFGCashXMsgRqstHandler) getParser());
        xmsgRqstHandler.resetResponse();
        xmsgRqstHandler.appendResponse(response);
        xmsgRqstHandler.setCaughtException(true);
    } catch (Error e) {
        String response = CFGCashXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t"
                + CFGCashXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n"
                + CFGCashXMsgSchemaMessageFormatter.formatRspnXmlPostamble();
        CFGCashXMsgRqstHandler xmsgRqstHandler = ((CFGCashXMsgRqstHandler) getParser());
        xmsgRqstHandler.resetResponse();
        xmsgRqstHandler.appendResponse(response);
        xmsgRqstHandler.setCaughtException(true);
    }
}

From source file:net.sourceforge.msscodefactory.cfgcash.v2_0.CFGCashXMsgRqstHandler.CFGCashXMsgRqstSecGroupMemberReadAllHandler.java

public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
    try {//from  w w  w.  ja  v  a2s . c o m
        // Common XML Attributes
        String attrId = null;
        // Attribute Extraction
        String attrLocalName;
        int numAttrs;
        int idxAttr;
        final String S_ProcName = "startElement";
        final String S_LocalName = "LocalName";

        assert qName.equals("RqstSecGroupMemberReadAll");

        CFGCashXMsgRqstHandler xmsgRqstHandler = (CFGCashXMsgRqstHandler) getParser();
        if (xmsgRqstHandler == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "getParser()");
        }

        ICFGCashSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj();
        if (schemaObj == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "getParser().getSchemaObj()");
        }

        // Extract Attributes
        numAttrs = attrs.getLength();
        for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) {
            attrLocalName = attrs.getLocalName(idxAttr);
            if (attrLocalName.equals("Id")) {
                if (attrId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("schemaLocation")) {
                // ignored
            } else {
                throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(),
                        S_ProcName, getParser().getLocationInfo(), attrLocalName);
            }
        }

        // Save named attributes to context
        CFLibXmlCoreContext curContext = getParser().getCurContext();
        // Read the objects and prepare the response XML
        SortedMap<CFGCashSecGroupMemberPKey, ICFGCashSecGroupMemberObj> map = schemaObj
                .getSecGroupMemberTableObj().readAllSecGroupMember(true);
        String responseOpening = CFGCashXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t"
                + CFGCashXMsgSecGroupMemberMessageFormatter.formatSecGroupMemberRspnListOpenTag();
        xmsgRqstHandler.appendResponse(responseOpening);
        Iterator<ICFGCashSecGroupMemberObj> iter = map.values().iterator();
        ICFGCashSecGroupMemberObj cur;
        String subxml;
        while (iter.hasNext()) {
            cur = iter.next();
            subxml = CFGCashXMsgSecGroupMemberMessageFormatter.formatSecGroupMemberRspnDerivedRec("\n\t\t",
                    cur.getSecGroupMemberBuff());
            xmsgRqstHandler.appendResponse(subxml);
        }
        String responseClosing = "\n" + "\t"
                + CFGCashXMsgSecGroupMemberMessageFormatter.formatSecGroupMemberRspnListCloseTag()
                + CFGCashXMsgSchemaMessageFormatter.formatRspnXmlPostamble();
        xmsgRqstHandler.appendResponse(responseClosing);
    } catch (RuntimeException e) {
        String response = CFGCashXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t"
                + CFGCashXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n"
                + CFGCashXMsgSchemaMessageFormatter.formatRspnXmlPostamble();
        CFGCashXMsgRqstHandler xmsgRqstHandler = ((CFGCashXMsgRqstHandler) getParser());
        xmsgRqstHandler.resetResponse();
        xmsgRqstHandler.appendResponse(response);
        xmsgRqstHandler.setCaughtException(true);
    } catch (Error e) {
        String response = CFGCashXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t"
                + CFGCashXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n"
                + CFGCashXMsgSchemaMessageFormatter.formatRspnXmlPostamble();
        CFGCashXMsgRqstHandler xmsgRqstHandler = ((CFGCashXMsgRqstHandler) getParser());
        xmsgRqstHandler.resetResponse();
        xmsgRqstHandler.appendResponse(response);
        xmsgRqstHandler.setCaughtException(true);
    }
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccXMsgClient.CFAccXMsgClientMimeTypeTable.java

public CFAccMimeTypeBuff[] readAllDerived(CFAccAuthorization Authorization) {
    final String S_ProcName = "readAllDerived";
    String rqst = CFAccXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t"
            + CFAccXMsgMimeTypeMessageFormatter.formatMimeTypeRqstReadAll("\n\t\t\t") + "\n"
            + CFAccXMsgSchemaMessageFormatter.formatRqstXmlPostamble();
    String rspn = schema.sendReceive(Authorization, rqst);
    if ((rspn == null) || (rspn.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "rspn");
    }/*from  www.j a  va 2  s. co m*/
    CFAccXMsgRspnHandler responseHandler = schema.getResponseHandler();
    responseHandler.parseStringContents(rspn);
    CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised();
    if (exceptionRaised != null) {
        throw exceptionRaised;
    }
    Object sortedMapObj = responseHandler.getSortedMapOfObjects();
    if (sortedMapObj == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                "responseHandler.getSortedMapOfObjects");
    }
    SortedMap<CFAccMimeTypePKey, ICFAccMimeTypeObj> sortedMap = (SortedMap<CFAccMimeTypePKey, ICFAccMimeTypeObj>) sortedMapObj;
    int sz = sortedMap.size();
    CFAccMimeTypeBuff arr[] = new CFAccMimeTypeBuff[sz];
    Iterator<ICFAccMimeTypeObj> iter = sortedMap.values().iterator();
    ICFAccMimeTypeObj cur;
    for (int idx = 0; idx < sz; idx++) {
        cur = (ICFAccMimeTypeObj) iter.next();
        arr[idx] = cur.getMimeTypeBuff();
    }
    return (arr);
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstXMsgClient.CFAstXMsgClientMimeTypeTable.java

public CFAstMimeTypeBuff[] readAllDerived(CFAstAuthorization Authorization) {
    final String S_ProcName = "readAllDerived";
    String rqst = CFAstXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t"
            + CFAstXMsgMimeTypeMessageFormatter.formatMimeTypeRqstReadAll("\n\t\t\t") + "\n"
            + CFAstXMsgSchemaMessageFormatter.formatRqstXmlPostamble();
    String rspn = schema.sendReceive(Authorization, rqst);
    if ((rspn == null) || (rspn.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "rspn");
    }/*  w w  w . j  a va2 s  . co m*/
    CFAstXMsgRspnHandler responseHandler = schema.getResponseHandler();
    responseHandler.parseStringContents(rspn);
    CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised();
    if (exceptionRaised != null) {
        throw exceptionRaised;
    }
    Object sortedMapObj = responseHandler.getSortedMapOfObjects();
    if (sortedMapObj == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                "responseHandler.getSortedMapOfObjects");
    }
    SortedMap<CFAstMimeTypePKey, ICFAstMimeTypeObj> sortedMap = (SortedMap<CFAstMimeTypePKey, ICFAstMimeTypeObj>) sortedMapObj;
    int sz = sortedMap.size();
    CFAstMimeTypeBuff arr[] = new CFAstMimeTypeBuff[sz];
    Iterator<ICFAstMimeTypeObj> iter = sortedMap.values().iterator();
    ICFAstMimeTypeObj cur;
    for (int idx = 0; idx < sz; idx++) {
        cur = (ICFAstMimeTypeObj) iter.next();
        arr[idx] = cur.getMimeTypeBuff();
    }
    return (arr);
}

From source file:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKbXMsgRqstHandler.CFGenKbXMsgRqstGenTruncReadByScopeIdxHandler.java

public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
    try {/*from w  w  w.  j ava2s  .  c o  m*/
        // Common XML Attributes
        String attrId = null;
        String attrScopeDefId = null;
        // Attribute Extraction
        String attrLocalName;
        int numAttrs;
        int idxAttr;
        final String S_ProcName = "startElement";
        final String S_LocalName = "LocalName";

        assert qName.equals("RqstGenTruncReadByScopeIdx");

        CFGenKbXMsgRqstHandler xmsgRqstHandler = (CFGenKbXMsgRqstHandler) getParser();
        if (xmsgRqstHandler == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "getParser()");
        }

        ICFGenKbSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj();
        if (schemaObj == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "getParser().getSchemaObj()");
        }

        // Extract Attributes
        numAttrs = attrs.getLength();
        for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) {
            attrLocalName = attrs.getLocalName(idxAttr);
            if (attrLocalName.equals("Id")) {
                if (attrId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("ScopeDefId")) {
                if (attrScopeDefId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrScopeDefId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("schemaLocation")) {
                // ignored
            } else {
                throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(),
                        S_ProcName, getParser().getLocationInfo(), attrLocalName);
            }
        }

        // Ensure that required attributes have values$implRqstTableReadByHandlerCheckReqKeyAttrs$

        // Save named attributes to context
        CFLibXmlCoreContext curContext = getParser().getCurContext();
        // Convert string attributes to native Java types
        // and apply the converted attributes to the editBuff.

        Short natScopeDefId;
        natScopeDefId = new Short(Short.parseShort(attrScopeDefId));

        // Read the objects
        SortedMap<CFGenKbGenItemPKey, ICFGenKbGenTruncObj> map = schemaObj.getGenTruncTableObj()
                .readGenTruncByScopeIdx(natScopeDefId);
        String responseOpening = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t"
                + CFGenKbXMsgGenItemMessageFormatter.formatGenItemRspnListOpenTag();
        xmsgRqstHandler.appendResponse(responseOpening);
        Iterator<ICFGenKbGenTruncObj> iter = map.values().iterator();
        ICFGenKbGenTruncObj cur;
        String subxml;
        while (iter.hasNext()) {
            cur = iter.next();
            subxml = CFGenKbXMsgGenItemMessageFormatter.formatGenItemRspnDerivedRec("\n\t\t",
                    cur.getGenItemBuff());
            xmsgRqstHandler.appendResponse(subxml);
        }
        String responseClosing = "\n" + "\t"
                + CFGenKbXMsgGenItemMessageFormatter.formatGenItemRspnListCloseTag()
                + CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPostamble();
        xmsgRqstHandler.appendResponse(responseClosing);
    } catch (RuntimeException e) {
        String response = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t"
                + CFGenKbXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n"
                + CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPostamble();
        CFGenKbXMsgRqstHandler xmsgRqstHandler = ((CFGenKbXMsgRqstHandler) getParser());
        xmsgRqstHandler.resetResponse();
        xmsgRqstHandler.appendResponse(response);
        xmsgRqstHandler.setCaughtException(true);
    } catch (Error e) {
        String response = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t"
                + CFGenKbXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n"
                + CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPostamble();
        CFGenKbXMsgRqstHandler xmsgRqstHandler = ((CFGenKbXMsgRqstHandler) getParser());
        xmsgRqstHandler.resetResponse();
        xmsgRqstHandler.appendResponse(response);
        xmsgRqstHandler.setCaughtException(true);
    }
}

From source file:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKbXMsgRqstHandler.CFGenKbXMsgRqstGenTruncReadByToolSetIdxHandler.java

public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
    try {/*from   w  ww.ja v  a 2  s.co m*/
        // Common XML Attributes
        String attrId = null;
        String attrToolSetId = null;
        // Attribute Extraction
        String attrLocalName;
        int numAttrs;
        int idxAttr;
        final String S_ProcName = "startElement";
        final String S_LocalName = "LocalName";

        assert qName.equals("RqstGenTruncReadByToolSetIdx");

        CFGenKbXMsgRqstHandler xmsgRqstHandler = (CFGenKbXMsgRqstHandler) getParser();
        if (xmsgRqstHandler == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "getParser()");
        }

        ICFGenKbSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj();
        if (schemaObj == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "getParser().getSchemaObj()");
        }

        // Extract Attributes
        numAttrs = attrs.getLength();
        for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) {
            attrLocalName = attrs.getLocalName(idxAttr);
            if (attrLocalName.equals("Id")) {
                if (attrId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("ToolSetId")) {
                if (attrToolSetId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrToolSetId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("schemaLocation")) {
                // ignored
            } else {
                throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(),
                        S_ProcName, getParser().getLocationInfo(), attrLocalName);
            }
        }

        // Ensure that required attributes have values$implRqstTableReadByHandlerCheckReqKeyAttrs$

        // Save named attributes to context
        CFLibXmlCoreContext curContext = getParser().getCurContext();
        // Convert string attributes to native Java types
        // and apply the converted attributes to the editBuff.

        short natToolSetId;
        natToolSetId = Short.parseShort(attrToolSetId);

        // Read the objects
        SortedMap<CFGenKbGenItemPKey, ICFGenKbGenTruncObj> map = schemaObj.getGenTruncTableObj()
                .readGenTruncByToolSetIdx(natToolSetId);
        String responseOpening = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t"
                + CFGenKbXMsgGenItemMessageFormatter.formatGenItemRspnListOpenTag();
        xmsgRqstHandler.appendResponse(responseOpening);
        Iterator<ICFGenKbGenTruncObj> iter = map.values().iterator();
        ICFGenKbGenTruncObj cur;
        String subxml;
        while (iter.hasNext()) {
            cur = iter.next();
            subxml = CFGenKbXMsgGenItemMessageFormatter.formatGenItemRspnDerivedRec("\n\t\t",
                    cur.getGenItemBuff());
            xmsgRqstHandler.appendResponse(subxml);
        }
        String responseClosing = "\n" + "\t"
                + CFGenKbXMsgGenItemMessageFormatter.formatGenItemRspnListCloseTag()
                + CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPostamble();
        xmsgRqstHandler.appendResponse(responseClosing);
    } catch (RuntimeException e) {
        String response = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t"
                + CFGenKbXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n"
                + CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPostamble();
        CFGenKbXMsgRqstHandler xmsgRqstHandler = ((CFGenKbXMsgRqstHandler) getParser());
        xmsgRqstHandler.resetResponse();
        xmsgRqstHandler.appendResponse(response);
        xmsgRqstHandler.setCaughtException(true);
    } catch (Error e) {
        String response = CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t"
                + CFGenKbXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n"
                + CFGenKbXMsgSchemaMessageFormatter.formatRspnXmlPostamble();
        CFGenKbXMsgRqstHandler xmsgRqstHandler = ((CFGenKbXMsgRqstHandler) getParser());
        xmsgRqstHandler.resetResponse();
        xmsgRqstHandler.appendResponse(response);
        xmsgRqstHandler.setCaughtException(true);
    }
}

From source file:com.github.fge.jsonschema.processors.build.ValidatorBuilder.java

/**
 * Process the input/*from  w  w  w.  j  a  v a 2s. co  m*/
 *
 * @param report the report to use while processing
 * @param input the input for this processor
 * @return the output
 * @throws ProcessingException processing failed
 */
@Override
public ValidatorList process(final ProcessingReport report, final SchemaDigest input)
        throws ProcessingException {
    final SortedMap<String, KeywordValidator> map = Maps.newTreeMap();

    String keyword;
    JsonNode digest;
    KeywordValidator validator;
    Constructor<? extends KeywordValidator> constructor;

    for (final Map.Entry<String, JsonNode> entry : input.getDigests().entrySet()) {
        keyword = entry.getKey();
        digest = entry.getValue();
        constructor = constructors.get(keyword);
        validator = buildKeyword(constructor, digest);
        map.put(keyword, validator);
    }
    return new ValidatorList(input.getContext(), map.values());
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccXMsgRqstHandler.CFAccXMsgRqstPhoneReadByContactIdxHandler.java

public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
    try {/* w  ww  .j  a va2  s  .c  o m*/
        // Common XML Attributes
        String attrId = null;
        String attrTenantId = null;
        String attrContactId = null;
        // Attribute Extraction
        String attrLocalName;
        int numAttrs;
        int idxAttr;
        final String S_ProcName = "startElement";
        final String S_LocalName = "LocalName";

        assert qName.equals("RqstPhoneReadByContactIdx");

        CFAccXMsgRqstHandler xmsgRqstHandler = (CFAccXMsgRqstHandler) getParser();
        if (xmsgRqstHandler == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "getParser()");
        }

        ICFAccSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj();
        if (schemaObj == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "getParser().getSchemaObj()");
        }

        // Extract Attributes
        numAttrs = attrs.getLength();
        for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) {
            attrLocalName = attrs.getLocalName(idxAttr);
            if (attrLocalName.equals("Id")) {
                if (attrId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("TenantId")) {
                if (attrTenantId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrTenantId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("ContactId")) {
                if (attrContactId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrContactId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("schemaLocation")) {
                // ignored
            } else {
                throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(),
                        S_ProcName, getParser().getLocationInfo(), attrLocalName);
            }
        }

        // Ensure that required attributes have values$implRqstTableReadByHandlerCheckReqKeyAttrs$

        // Save named attributes to context
        CFLibXmlCoreContext curContext = getParser().getCurContext();
        // Convert string attributes to native Java types
        // and apply the converted attributes to the editBuff.

        long natTenantId;
        natTenantId = Long.parseLong(attrTenantId);

        long natContactId;
        natContactId = Long.parseLong(attrContactId);

        // Read the objects
        SortedMap<CFAccPhonePKey, ICFAccPhoneObj> map = schemaObj.getPhoneTableObj()
                .readPhoneByContactIdx(natTenantId, natContactId);
        String responseOpening = CFAccXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t"
                + CFAccXMsgPhoneMessageFormatter.formatPhoneRspnListOpenTag();
        xmsgRqstHandler.appendResponse(responseOpening);
        Iterator<ICFAccPhoneObj> iter = map.values().iterator();
        ICFAccPhoneObj cur;
        String subxml;
        while (iter.hasNext()) {
            cur = iter.next();
            subxml = CFAccXMsgPhoneMessageFormatter.formatPhoneRspnDerivedRec("\n\t\t", cur.getPhoneBuff());
            xmsgRqstHandler.appendResponse(subxml);
        }
        String responseClosing = "\n" + "\t" + CFAccXMsgPhoneMessageFormatter.formatPhoneRspnListCloseTag()
                + CFAccXMsgSchemaMessageFormatter.formatRspnXmlPostamble();
        xmsgRqstHandler.appendResponse(responseClosing);
    } catch (RuntimeException e) {
        String response = CFAccXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t"
                + CFAccXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n"
                + CFAccXMsgSchemaMessageFormatter.formatRspnXmlPostamble();
        CFAccXMsgRqstHandler xmsgRqstHandler = ((CFAccXMsgRqstHandler) getParser());
        xmsgRqstHandler.resetResponse();
        xmsgRqstHandler.appendResponse(response);
        xmsgRqstHandler.setCaughtException(true);
    } catch (Error e) {
        String response = CFAccXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t"
                + CFAccXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n"
                + CFAccXMsgSchemaMessageFormatter.formatRspnXmlPostamble();
        CFAccXMsgRqstHandler xmsgRqstHandler = ((CFAccXMsgRqstHandler) getParser());
        xmsgRqstHandler.resetResponse();
        xmsgRqstHandler.appendResponse(response);
        xmsgRqstHandler.setCaughtException(true);
    }
}

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccXMsgRqstHandler.CFAccXMsgRqstTopDomainReadByTenantIdxHandler.java

public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
    try {/*www  . ja v a2 s. c o  m*/
        // Common XML Attributes
        String attrId = null;
        String attrTenantId = null;
        // Attribute Extraction
        String attrLocalName;
        int numAttrs;
        int idxAttr;
        final String S_ProcName = "startElement";
        final String S_LocalName = "LocalName";

        assert qName.equals("RqstTopDomainReadByTenantIdx");

        CFAccXMsgRqstHandler xmsgRqstHandler = (CFAccXMsgRqstHandler) getParser();
        if (xmsgRqstHandler == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "getParser()");
        }

        ICFAccSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj();
        if (schemaObj == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "getParser().getSchemaObj()");
        }

        // Extract Attributes
        numAttrs = attrs.getLength();
        for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) {
            attrLocalName = attrs.getLocalName(idxAttr);
            if (attrLocalName.equals("Id")) {
                if (attrId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("TenantId")) {
                if (attrTenantId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrTenantId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("schemaLocation")) {
                // ignored
            } else {
                throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(),
                        S_ProcName, getParser().getLocationInfo(), attrLocalName);
            }
        }

        // Ensure that required attributes have values$implRqstTableReadByHandlerCheckReqKeyAttrs$

        // Save named attributes to context
        CFLibXmlCoreContext curContext = getParser().getCurContext();
        // Convert string attributes to native Java types
        // and apply the converted attributes to the editBuff.

        long natTenantId;
        natTenantId = Long.parseLong(attrTenantId);

        // Read the objects
        SortedMap<CFAccDomainBasePKey, ICFAccTopDomainObj> map = schemaObj.getTopDomainTableObj()
                .readTopDomainByTenantIdx(natTenantId);
        String responseOpening = CFAccXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t"
                + CFAccXMsgDomainBaseMessageFormatter.formatDomainBaseRspnListOpenTag();
        xmsgRqstHandler.appendResponse(responseOpening);
        Iterator<ICFAccTopDomainObj> iter = map.values().iterator();
        ICFAccTopDomainObj cur;
        String subxml;
        while (iter.hasNext()) {
            cur = iter.next();
            subxml = CFAccXMsgDomainBaseMessageFormatter.formatDomainBaseRspnDerivedRec("\n\t\t",
                    cur.getDomainBaseBuff());
            xmsgRqstHandler.appendResponse(subxml);
        }
        String responseClosing = "\n" + "\t"
                + CFAccXMsgDomainBaseMessageFormatter.formatDomainBaseRspnListCloseTag()
                + CFAccXMsgSchemaMessageFormatter.formatRspnXmlPostamble();
        xmsgRqstHandler.appendResponse(responseClosing);
    } catch (RuntimeException e) {
        String response = CFAccXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t"
                + CFAccXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n"
                + CFAccXMsgSchemaMessageFormatter.formatRspnXmlPostamble();
        CFAccXMsgRqstHandler xmsgRqstHandler = ((CFAccXMsgRqstHandler) getParser());
        xmsgRqstHandler.resetResponse();
        xmsgRqstHandler.appendResponse(response);
        xmsgRqstHandler.setCaughtException(true);
    } catch (Error e) {
        String response = CFAccXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t"
                + CFAccXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n"
                + CFAccXMsgSchemaMessageFormatter.formatRspnXmlPostamble();
        CFAccXMsgRqstHandler xmsgRqstHandler = ((CFAccXMsgRqstHandler) getParser());
        xmsgRqstHandler.resetResponse();
        xmsgRqstHandler.appendResponse(response);
        xmsgRqstHandler.setCaughtException(true);
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstXMsgRqstHandler.CFAstXMsgRqstTopDomainReadByTenantIdxHandler.java

public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
    try {/*from   w  w  w  . j a v a2s .c  om*/
        // Common XML Attributes
        String attrId = null;
        String attrTenantId = null;
        // Attribute Extraction
        String attrLocalName;
        int numAttrs;
        int idxAttr;
        final String S_ProcName = "startElement";
        final String S_LocalName = "LocalName";

        assert qName.equals("RqstTopDomainReadByTenantIdx");

        CFAstXMsgRqstHandler xmsgRqstHandler = (CFAstXMsgRqstHandler) getParser();
        if (xmsgRqstHandler == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "getParser()");
        }

        ICFAstSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj();
        if (schemaObj == null) {
            throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0,
                    "getParser().getSchemaObj()");
        }

        // Extract Attributes
        numAttrs = attrs.getLength();
        for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) {
            attrLocalName = attrs.getLocalName(idxAttr);
            if (attrLocalName.equals("Id")) {
                if (attrId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("TenantId")) {
                if (attrTenantId != null) {
                    throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(),
                            S_ProcName, S_LocalName, attrLocalName);
                }
                attrTenantId = attrs.getValue(idxAttr);
            } else if (attrLocalName.equals("schemaLocation")) {
                // ignored
            } else {
                throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(),
                        S_ProcName, getParser().getLocationInfo(), attrLocalName);
            }
        }

        // Ensure that required attributes have values$implRqstTableReadByHandlerCheckReqKeyAttrs$

        // Save named attributes to context
        CFLibXmlCoreContext curContext = getParser().getCurContext();
        // Convert string attributes to native Java types
        // and apply the converted attributes to the editBuff.

        long natTenantId;
        natTenantId = Long.parseLong(attrTenantId);

        // Read the objects
        SortedMap<CFAstDomainBasePKey, ICFAstTopDomainObj> map = schemaObj.getTopDomainTableObj()
                .readTopDomainByTenantIdx(natTenantId);
        String responseOpening = CFAstXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t"
                + CFAstXMsgDomainBaseMessageFormatter.formatDomainBaseRspnListOpenTag();
        xmsgRqstHandler.appendResponse(responseOpening);
        Iterator<ICFAstTopDomainObj> iter = map.values().iterator();
        ICFAstTopDomainObj cur;
        String subxml;
        while (iter.hasNext()) {
            cur = iter.next();
            subxml = CFAstXMsgDomainBaseMessageFormatter.formatDomainBaseRspnDerivedRec("\n\t\t",
                    cur.getDomainBaseBuff());
            xmsgRqstHandler.appendResponse(subxml);
        }
        String responseClosing = "\n" + "\t"
                + CFAstXMsgDomainBaseMessageFormatter.formatDomainBaseRspnListCloseTag()
                + CFAstXMsgSchemaMessageFormatter.formatRspnXmlPostamble();
        xmsgRqstHandler.appendResponse(responseClosing);
    } catch (RuntimeException e) {
        String response = CFAstXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t"
                + CFAstXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n"
                + CFAstXMsgSchemaMessageFormatter.formatRspnXmlPostamble();
        CFAstXMsgRqstHandler xmsgRqstHandler = ((CFAstXMsgRqstHandler) getParser());
        xmsgRqstHandler.resetResponse();
        xmsgRqstHandler.appendResponse(response);
        xmsgRqstHandler.setCaughtException(true);
    } catch (Error e) {
        String response = CFAstXMsgSchemaMessageFormatter.formatRspnXmlPreamble() + "\n" + "\t"
                + CFAstXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n"
                + CFAstXMsgSchemaMessageFormatter.formatRspnXmlPostamble();
        CFAstXMsgRqstHandler xmsgRqstHandler = ((CFAstXMsgRqstHandler) getParser());
        xmsgRqstHandler.resetResponse();
        xmsgRqstHandler.appendResponse(response);
        xmsgRqstHandler.setCaughtException(true);
    }
}