Search in sources :

Example 1 with UpgradeStepInfo

use of org.forgerock.openam.upgrade.UpgradeStepInfo in project OpenAM by OpenRock.

the class UpgradeStepProcessor method process.

@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    if (!roundEnv.processingOver()) {
        Set<? extends Element> elements = roundEnv.getElementsAnnotatedWith(UpgradeStepInfo.class);
        for (Element element : elements) {
            Set<DependencyInfo> depends = new LinkedHashSet<DependencyInfo>(2);
            String annotatedType = element.asType().toString();
            UpgradeStepInfo annotation = element.getAnnotation(UpgradeStepInfo.class);
            for (String name : annotation.dependsOn()) {
                DependencyInfo depInfo = stepMappings.get(name);
                if (depInfo == null) {
                    depInfo = new DependencyInfo(name);
                    stepMappings.put(name, depInfo);
                }
                depends.add(depInfo);
            }
            DependencyInfo depInfo = stepMappings.get(annotatedType);
            if (depInfo == null) {
                depInfo = new DependencyInfo(annotatedType);
                stepMappings.put(annotatedType, depInfo);
            }
            for (DependencyInfo dep : depends) {
                depInfo.dependencies.add(dep);
            }
        }
        createDAG();
    }
    return true;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) Element(javax.lang.model.element.Element) TypeElement(javax.lang.model.element.TypeElement) UpgradeStepInfo(org.forgerock.openam.upgrade.UpgradeStepInfo)

Aggregations

LinkedHashSet (java.util.LinkedHashSet)1 Element (javax.lang.model.element.Element)1 TypeElement (javax.lang.model.element.TypeElement)1 UpgradeStepInfo (org.forgerock.openam.upgrade.UpgradeStepInfo)1