if (!transactionStarted) {
registry.beginTransaction();
}
for (OMElement scenarioEle : elements) {
SecurityScenario scenario = new SecurityScenario();
String scenarioId = scenarioEle.getAttribute(SecurityConstants.ID_QN)
.getAttributeValue();
scenario.setScenarioId(scenarioId);
scenario.setSummary(scenarioEle.getFirstChildWithName(SecurityConstants.SUMMARY_QN)
.getText());
scenario.setDescription(scenarioEle.getFirstChildWithName(
SecurityConstants.DESCRIPTION_QN).getText());
scenario.setCategory(scenarioEle.getFirstChildWithName(SecurityConstants.CATEGORY_QN)
.getText());
scenario.setWsuId(scenarioEle.getFirstChildWithName(SecurityConstants.WSUID_QN)
.getText());
scenario.setType(scenarioEle.getFirstChildWithName(SecurityConstants.TYPE_QN).getText());
OMElement genPolicyElem = scenarioEle.getFirstChildWithName(SecurityConstants.IS_GEN_POLICY_QN);
if (genPolicyElem != null && genPolicyElem.getText().equals("false")) {
scenario.setGeneralPolicy(false);
}
String resourceUri = SecurityConstants.SECURITY_POLICY + "/" + scenarioId;
for (Iterator modules = scenarioEle.getFirstChildWithName(SecurityConstants.MODULES_QN)
.getChildElements(); modules.hasNext();) {
String module = ((OMElement) modules.next()).getText();
scenario.addModule(module);
}
// Save it in the DB
SecurityScenarioDatabase.put(scenarioId, scenario);