Examples of BadRecordSourceException


Examples of ke.go.moh.oec.adt.exceptions.BadRecordSourceException

            if (resultSet.next()) {
                List<String> truePrimaryKeyList = Arrays.asList(resultSet.getString("primary_keys").split(","));
                int configuredPkCount = recordSource.getPrimaryKeyColumnMap().size();
                int truePkCount = truePrimaryKeyList.size();
                if (configuredPkCount != truePkCount) {
                    throw new BadRecordSourceException("The number of configured primary key columns (" + configuredPkCount
                            + ") does not match the number of true primary key columns (" + truePkCount + ")");
                }
                for (Column column : recordSource.getPrimaryKeyColumnMap().values()) {
                    if (!truePrimaryKeyList.contains(column.getName())) {
                        throw new BadRecordSourceException("The column " + column.getName()
                                + " is configured as a primary key for the table " + recordSource.getTableName()
                                + " but it is not actually a primary key.");
                    }
                }
            }
View Full Code Here

Examples of ke.go.moh.oec.adt.exceptions.BadRecordSourceException

            }
        }
        Map<String, Column> primaryKeyColumnMap = masterRecordSource.getPrimaryKeyColumnMap();
        int primaryKeySize = primaryKeyColumnMap.size();
        if (foreignKeySize != primaryKeySize) {
            throw new BadRecordSourceException("Foreign key - primary key mismatch!");
        }
        String compositePrimaryKeyValue = "";
        List<String> foreignKeyValueList = new ArrayList<String>(foreignKeyMap.values());
        for (String string : foreignKeyValueList) {
            compositePrimaryKeyValue += string;
View Full Code Here

Examples of ke.go.moh.oec.adt.exceptions.BadRecordSourceException

        for (int i = 0; i < recordSourceCount; i++) {
            Node recordSourceNode = recordSourceNodeList.item(i);
            if (recordSourceNode.getNodeType() == Node.ELEMENT_NODE) {
                RecordSource recordSource = createRecordSource(recordSourceNode);
                if (orderList.contains(recordSource.getOrder())) {
                    throw new BadRecordSourceException("The order " + recordSource.getOrder()
                            + " has been allocated to more than one record sources. Unique order expected.");
                }
                if (recordSourceList.contains(recordSource)) {
                    throw new BadRecordSourceException("Record source for "
                            + recordSource.getTableName() + " configured more than once in the xml "
                            + "configuration file. Only one instance is expected.");
                }
                recordSourceList.add(recordSource);
                orderList.add(recordSource.getOrder());
View Full Code Here

Examples of ke.go.moh.oec.adt.exceptions.BadRecordSourceException

        return columnList;
    }

    private void validateRecordSource(RecordSource recordSource) throws BadRecordSourceException {
        if (recordSource.getOrder() == null) {
            throw new BadRecordSourceException("Null 'order' not allowed.");
        }
        if (recordSource.getTableName() == null) {
            throw new BadRecordSourceException("Null 'table name' not allowed.");
        }
        if (recordSource.getPrimaryKeyColumnMap() == null || recordSource.getPrimaryKeyColumnMap().isEmpty()) {
            throw new BadRecordSourceException("Null 'pk columns' not allowed.");
        }
        if (recordSource.getRelationship() == RecordSource.Relationship.SLAVE) {
            if (recordSource.getForeignKeyColumnMap() == null) {
                throw new BadRecordSourceException("Null 'fk columns' not allowed for record sources related to master.");
            }
        }
        if (recordSource.getColumnList() == null || recordSource.getColumnList().isEmpty()) {
            throw new BadRecordSourceException("Null 'columns' not allowed.");
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.