private String parseAndSerialize(TopologyBranchRule ruleInfo) throws JsonProcessingException { Rule rule = new Rule(); rule.setId(ruleInfo.getId()); rule.setName(ruleInfo.getName()); rule.setDescription(ruleInfo.getDescription()); rule.setActions(ruleInfo.getActions()); String sql = getSqlString(Collections.singletonList(ruleInfo.getStream()), null, ruleInfo.getCondition(), null); updateRuleWithSql(rule, sql, ruleInfo.getTopologyId(), ruleInfo.getVersionId()); ObjectMapper mapper = new ObjectMapper(); return mapper.writeValueAsString(rule); }
public TopologyBranchRule(TopologyBranchRule other) { if (other != null) { setId(other.getId()); setTopologyId(other.getTopologyId()); setVersionId(other.getVersionId()); setName(other.getName()); setDescription(other.getDescription()); setStream(other.getStream()); setCondition(other.getCondition()); setParsedRuleStr(other.getParsedRuleStr()); if (other.getActions() != null) { setActions(other.getActions().stream().map(Action::copy).collect(Collectors.toList())); } if (other.getOutputStreams() != null) { setOutputStreams(new ArrayList<>(other.getOutputStreams())); } setVersionTimestamp(other.getVersionTimestamp()); } }