use of org.eclipse.smarthome.automation.dto.RuleDTO in project smarthome by eclipse.
the class RuleDTOMapper method map.
public static RuleDTO map(final Rule rule) {
final RuleDTO ruleDto = new RuleDTO();
fillProperties(rule, ruleDto);
return ruleDto;
}
use of org.eclipse.smarthome.automation.dto.RuleDTO in project smarthome by eclipse.
the class RuleEventFactory method createRuleUpdatedEvent.
/**
* Creates a rule updated event
*
* @param rule the new rule
* @param oldRule the rule that has been updated
* @param source the source of the event
* @return {@link RuleUpdatedEvent} instance
*/
public static RuleUpdatedEvent createRuleUpdatedEvent(Rule rule, Rule oldRule, String source) {
String topic = buildTopic(RULE_UPDATED_EVENT_TOPIC, rule);
final RuleDTO ruleDto = RuleDTOMapper.map(rule);
final RuleDTO oldRuleDto = RuleDTOMapper.map(oldRule);
List<RuleDTO> rules = new LinkedList<RuleDTO>();
rules.add(ruleDto);
rules.add(oldRuleDto);
String payload = serializePayload(rules);
return new RuleUpdatedEvent(topic, payload, source, ruleDto, oldRuleDto);
}
use of org.eclipse.smarthome.automation.dto.RuleDTO in project smarthome by eclipse.
the class RuleEventFactory method createRuleUpdatedEvent.
/**
* Creates a rule updated event.
*
* @param rule the new rule.
* @param oldRule the rule that has been updated.
* @param source the source of the event.
* @return {@link RuleUpdatedEvent} instance.
*/
public static RuleUpdatedEvent createRuleUpdatedEvent(Rule rule, Rule oldRule, String source) {
String topic = buildTopic(RULE_UPDATED_EVENT_TOPIC, rule);
final RuleDTO ruleDto = RuleDTOMapper.map(rule);
final RuleDTO oldRuleDto = RuleDTOMapper.map(oldRule);
List<RuleDTO> rules = new LinkedList<>();
rules.add(ruleDto);
rules.add(oldRuleDto);
String payload = serializePayload(rules);
return new RuleUpdatedEvent(topic, payload, source, ruleDto, oldRuleDto);
}
Aggregations