Source:
public ComplianceStatus getStatus(Consumer c, Date date, boolean calculateCompliantUntil, boolean updateConsumer) { boolean currentCompliance = false; if (date == null) { date = new Date(); currentCompliance = true; } if (currentCompliance) { for (Entitlement ent : c.getEntitlements()) { if (!ent.isUpdatedOnStart() && ent.isValid()) { ent.setUpdatedOnStart(true); entCurator.merge(ent); } } } if (c.getType().isManifest()) { return new ComplianceStatus(new Date()); } JsonJsContext args = new JsonJsContext(mapper); args.put("consumer", c); args.put("entitlements", c.getEntitlements()); args.put("ondate", date); args.put("calculateCompliantUntil", calculateCompliantUntil); args.put("log", log, false); String json = jsRules.runJsFunction(String.class, "get_status", args); try { ComplianceStatus result = mapper.toObject(json, ComplianceStatus.class); for (ComplianceReason reason : result.getReasons()) { generator.setMessage(c, reason, result.getDate()); } if (currentCompliance) { String newHash = getComplianceStatusHash(result, c); boolean complianceChanged = !newHash.equals(c.getComplianceStatusHash()); if (complianceChanged) { log.debug("Compliance has changed, sending Compliance event."); c.setComplianceStatusHash(newHash); eventSink.emitCompliance(c, c.getEntitlements(), result); } boolean entStatusChanged = !result.getStatus().equals(c.getEntitlementStatus()); if (entStatusChanged) { c.setEntitlementStatus(result.getStatus()); } if (updateConsumer && (complianceChanged || entStatusChanged)) { consumerCurator.updateNoFlush(c); } } return result; } catch (Exception e) { throw new RuleExecutionException(e); } }

Target:
public ComplianceStatus getStatus(Consumer c, Date date, boolean calculateCompliantUntil, boolean updateConsumer) { boolean currentCompliance = false; if (date == null) { date = new Date(); currentCompliance = true; } if (currentCompliance) { for (Entitlement ent : c.getEntitlements()) { if (!ent.isUpdatedOnStart() && ent.isValid()) { ent.setUpdatedOnStart(true); entCurator.merge(ent); } } } if (c.getType().isManifest()) { return new ComplianceStatus(new Date()); } JsonJsContext args = new JsonJsContext(mapper); args.put("consumer", c); args.put("entitlements", c.getEntitlements()); args.put("ondate", date); args.put("calculateCompliantUntil", calculateCompliantUntil); args.put("log", log, false); String json = jsRules.runJsFunction(String.class, "get_status", args); try { ComplianceStatus result = mapper.toObject(json, ComplianceStatus.class); for (ComplianceReason reason : result.getReasons()) { generator.setMessage(c, reason, result.getDate()); } if (currentCompliance) { String newHash = getComplianceStatusHash(result, c); boolean complianceChanged = !newHash.equals(c.getComplianceStatusHash()); if (complianceChanged) { log.debug("Compliance has changed, sending Compliance event."); c.setComplianceStatusHash(newHash); eventSink.emitCompliance(c, c.getEntitlements(), result); } boolean entStatusChanged = !result.getStatus().equals(c.getEntitlementStatus()); if (entStatusChanged) { c.setEntitlementStatus(result.getStatus()); } if (updateConsumer && (complianceChanged || entStatusChanged)) { consumerCurator.updateWithOptionalFlush(c, false); } } return result; } catch (Exception e) { throw new RuleExecutionException(e); } }