private void addReferences()

in src/main/java/org/apache/easyant/tasks/SubModule.java [537:570]


    private void addReferences(Project subproject) throws BuildException {
        @SuppressWarnings("unchecked")
        Map<String, Object> thisReferences = (Map<String, Object>) getProject().getReferences().clone();
        Map<String, Object> newReferences = subproject.getReferences();
        for (Ant.Reference ref : references) {
            String refid = ref.getRefId();
            if (refid == null) {
                throw new BuildException("the refid attribute is required" + " for reference elements");
            }
            if (!thisReferences.containsKey(refid)) {
                log("Parent project doesn't contain any reference '" + refid + "'", Project.MSG_WARN);
                continue;
            }

            thisReferences.remove(refid);
            String toRefid = ref.getToRefid();
            if (toRefid == null) {
                toRefid = refid;
            }
            copyReference(subproject, refid, toRefid);
        }

        // Now add all references that are not defined in the
        // subproject, if inheritRefs is true
        if (inheritRefs) {
            for (String key : thisReferences.keySet()) {
                if (newReferences.containsKey(key)) {
                    continue;
                }
                copyReference(subproject, key, key);
                subproject.inheritIDReferences(getProject());
            }
        }
    }