Map<String, String> metaData = globalDeclaration.toMetadata();
List<GlobalConfiguration> queryResult;
try {
queryResult = globalPersistence.load(metaData);
} catch (PersistenceException e) {
throw new RuleBaseException(e);
}
if (!queryResult.isEmpty()) {
throw new RuleBaseException(String.format("Global with name \"%s\" already exists", name));
}
globalDeclaration.setClassName(className);
GlobalConfiguration cnf = new GlobalConfiguration(metaData, globalDeclaration);
try {
globalPersistence.persist(cnf);
} catch (PersistenceException e) {
throw new RuleBaseException(e);
}
try {
builder.reloadRulebase();
} catch (RuleBaseException e) {
globalPersistence.remove(cnf.getMetaData());