public final Model process()

in src/main/java/org/apache/sling/provisioning/model/ModelProcessor.java [36:90]


    public final Model process(final Model model) {
        final Model result = new Model();
        result.setLocation(model.getLocation());

        for(final Feature feature : model.getFeatures()) {
            final Feature newFeature = result.getOrCreateFeature(feature.getName());
            newFeature.setType(feature.getType());
            newFeature.setComment(feature.getComment());
            newFeature.setLocation(feature.getLocation());
            newFeature.setVersion(feature.getVersion());
            newFeature.getAdditionalSections().addAll(feature.getAdditionalSections());

            newFeature.getVariables().setComment(feature.getVariables().getComment());
            newFeature.getVariables().setLocation(feature.getVariables().getLocation());
            newFeature.getVariables().putAll(processVariables(feature.getVariables(), feature));

            for(final RunMode runMode : feature.getRunModes()) {
                final RunMode newRunMode = newFeature.getOrCreateRunMode(runMode.getNames());
                newRunMode.setLocation(runMode.getLocation());

                for(final ArtifactGroup group : runMode.getArtifactGroups()) {
                    final ArtifactGroup newGroup = newRunMode.getOrCreateArtifactGroup(group.getStartLevel());
                    newGroup.setComment(group.getComment());
                    newGroup.setLocation(group.getLocation());

                    for(final Artifact artifact : group) {
                        final Artifact newArtifact = processArtifact(artifact, newFeature, newRunMode);
                        newArtifact.setComment(artifact.getComment());
                        newArtifact.setLocation(artifact.getLocation());
                        newGroup.add(newArtifact);
                    }
                }

                newRunMode.getConfigurations().setComment(runMode.getConfigurations().getComment());
                newRunMode.getConfigurations().setLocation(runMode.getConfigurations().getLocation());
                for(final Configuration config : runMode.getConfigurations()) {
                    final Configuration processedConfig = processConfiguration(config, newFeature, newRunMode);
                    final Configuration newConfig = newRunMode.getOrCreateConfiguration(processedConfig.getPid(), processedConfig.getFactoryPid());
                    newConfig.setLocation(config.getLocation());
                    newConfig.setComment(config.getComment());
                    final Enumeration<String> i = processedConfig.getProperties().keys();
                    while ( i.hasMoreElements() ) {
                        final String key = i.nextElement();
                        newConfig.getProperties().put(key, processedConfig.getProperties().get(key));
                    }
                }

                newRunMode.getSettings().setComment(runMode.getSettings().getComment());
                newRunMode.getSettings().setLocation(runMode.getSettings().getLocation());
                newRunMode.getSettings().putAll(processSettings(runMode.getSettings(), newFeature, newRunMode));
            }

        }
        return result;
    }