}
private int flatten(PatternDescr descr) {
AnalyticsData data = AnalyticsDataFactory.getAnalyticsData();
AnalyticsClass clazz = data.getClassByPackageAndName(descr.getObjectType());
if (clazz == null) {
clazz = new AnalyticsClass();
clazz.setName(descr.getObjectType());
data.save(clazz);
}
currentClass = clazz;
Pattern pattern = new Pattern();
pattern.setRuleId(currentRule.getId());
pattern.setRuleName(currentRule.getRuleName());
pattern.setClassId(clazz.getId());
pattern.setPatternNot(solvers.getRuleSolver().isChildNot());
pattern.setPatternExists(solvers.getRuleSolver().isExists());
pattern.setPatternForall(solvers.getRuleSolver().isForall());
data.save(pattern);
currentPattern = pattern;
if (descr.getIdentifier() != null) {
Variable variable = new Variable();
variable.setRuleId(currentRule.getId());
variable.setName(descr.getIdentifier());
variable.setObjectType(AnalyticsComponentType.CLASS);
variable.setObjectId(clazz.getId());
variable.setObjectName(descr.getObjectType());
data.save(variable);
}