public void produceStepTemplateElement(ConfigurationStep step, Map stepData) { String output = ""; try { stepData.put("step_id", step.getId()); List stepManualDecisionsList = new LinkedList(); if (step.getDecisions().isEmpty()) { Map tempMap = new HashMap(); tempMap.put("featureName", "auto-completion"); tempMap.put("featureId", "auto-completion"); tempMap.put("featureValue", ""); stepManualDecisionsList.add(tempMap); } else { for (FeatureTreeNode manualDecisionFeature : step.getDecisions()) { Map tempMap = new HashMap(); tempMap.put("featureName", manualDecisionFeature.getName()); tempMap.put("featureId", manualDecisionFeature.getID()); tempMap.put("featureValue", manualDecisionFeature.getValue()); stepManualDecisionsList.add(tempMap); } } stepData.put("step_manualDecisions", stepManualDecisionsList); stepData.put("step_countDecisions", step.countDecisions()); stepData.put("step_countPropagations", step.countPropagations()); // Step attributes stepData.putAll(step.getAttributesMap()); } catch (Exception e) { } }
protected String getFeatureName(FeatureTreeNode feature) { if (feature instanceof FeatureGroup) { int min = ((FeatureGroup) feature).getMin(); int max = ((FeatureGroup) feature).getMax(); max = (max == -1) ? feature.getChildCount() : max; return "[" + min + ".." + max + "]"; } return feature.getName(); }
public String produceStepElement(ConfigurationStep step, Map stepData) { String output = ""; try { if (stepElementTemplate == null) { stepElementTemplate = cfg.getTemplate("interactive_configuration_element_step.ftl"); } stepData.put("step_id", step.getId()); List stepManualDecisionsList = new LinkedList(); if (step.getDecisions().isEmpty()) { Map tempMap = new HashMap(); tempMap.put("featureName", "auto-completion"); tempMap.put("featureId", "auto-completion"); tempMap.put("featureValue", ""); stepManualDecisionsList.add(tempMap); } else { for (FeatureTreeNode manualDecisionFeature : step.getDecisions()) { Map tempMap = new HashMap(); tempMap.put("featureName", manualDecisionFeature.getName()); tempMap.put("featureId", manualDecisionFeature.getID()); tempMap.put("featureValue", manualDecisionFeature.getValue()); stepManualDecisionsList.add(tempMap); } } stepData.put("step_manualDecisions", stepManualDecisionsList); stepData.put("step_countDecisions", step.countDecisions()); stepData.put("step_countPropagations", step.countPropagations()); // Step attributes stepData.putAll(step.getAttributesMap()); StringWriter outputWriter = new StringWriter(); stepElementTemplate.process(stepData, outputWriter); output = outputWriter.toString(); } catch (Exception e) { output = e.getMessage(); } return output; }