/** * This method is used for setting the configuration of the {@link ModuleImpl}. * * @param configuration new configuration values. */ public void setConfiguration(Configuration configuration) { this.configuration = new Configuration(configuration); } }
/** * Default constructor in package scope only. Will allow to instantiate this * class by reflection. Not intended to be used for normal instantiation. */ ItemChannelLink() { super(); this.channelUID = null; this.configuration = new Configuration(); }
/** * This method is used to specify the {@link Rule}'s {@link Configuration}. * * @param ruleConfiguration the new configuration values. */ public void setConfiguration(@Nullable Configuration ruleConfiguration) { this.configuration = ruleConfiguration == null ? new Configuration() : ruleConfiguration; }
/** * This method is used to specify the {@link RuleImpl}'s {@link Configuration}. * * @param ruleConfiguration the new configuration values. */ public void setConfiguration(@Nullable Configuration ruleConfiguration) { this.configuration = ruleConfiguration == null ? new Configuration() : ruleConfiguration; }
public RuleBuilder withConfiguration(@Nullable Configuration ruleConfiguration) { this.configuration = new Configuration(ruleConfiguration); return this; }
/** * Package protected default constructor to allow reflective instantiation. */ Channel() { this.kind = ChannelKind.STATE; this.configuration = new Configuration(); this.properties = Collections.unmodifiableMap(new HashMap<String, String>(0)); }
/** * @deprecated - use {@link ChannelBuilder} instead */ @Deprecated public Channel(ChannelUID uid, String acceptedItemType) { this.uid = uid; this.acceptedItemType = acceptedItemType; this.kind = ChannelKind.STATE; this.configuration = new Configuration(); this.properties = Collections.unmodifiableMap(new HashMap<String, String>(0)); }
public B withConfiguration(Configuration configuration) { this.configuration = new Configuration(configuration); return myself(); }
/** * Returns a copy of the configuration, that can be modified. The method * {@link BaseThingHandler#updateConfiguration(Configuration)} must be called to persist the configuration. * * @return copy of the thing configuration (not null) */ protected Configuration editConfiguration() { Map<String, Object> properties = this.thing.getConfiguration().getProperties(); return new Configuration(new HashMap<>(properties)); }
@Modified public void modified(Map<String, Object> properties) { MagicServiceConfig config = new Configuration(properties).as(MagicServiceConfig.class); logger.debug("Magic Service has been modified: {}", config); } }
protected RuleBuilder(Rule rule) { this.triggers = new LinkedList<>(rule.getTriggers()); this.conditions = new LinkedList<>(rule.getConditions()); this.actions = new LinkedList<>(rule.getActions()); this.configuration = new Configuration(rule.getConfiguration()); this.configDescriptions = new LinkedList<>(rule.getConfigurationDescriptions()); this.templateUID = rule.getTemplateUID(); this.uid = rule.getUID(); this.name = rule.getName(); this.tags = new HashSet<>(rule.getTags()); this.visibility = rule.getVisibility(); this.description = rule.getDescription(); }
private List<Condition> copyConditions(List<Condition> conditions) { List<Condition> res = new ArrayList<Condition>(11); if (conditions != null) { for (Condition c : conditions) { Configuration conf = new Configuration(); conf.setProperties(c.getConfiguration().getProperties()); Condition condition = new Condition(c.getId(), c.getTypeUID(), conf, new HashMap<String, String>(c.getInputs())); condition.setLabel(c.getLabel()); condition.setDescription(c.getDescription()); res.add(condition); } } return res; }
protected ModuleBuilder(T module) { this.id = module.getId(); this.typeUID = module.getTypeUID(); this.configuration = new Configuration(module.getConfiguration()); this.label = module.getLabel(); this.description = module.getDescription(); }
private static List<Trigger> copyTriggers(List<Trigger> triggers) { List<Trigger> res = new ArrayList<Trigger>(11); if (triggers != null) { for (Trigger t : triggers) { Configuration c = new Configuration(); c.setProperties(t.getConfiguration().getProperties()); Trigger trigger = new Trigger(t.getId(), t.getTypeUID(), c); trigger.setLabel(trigger.getLabel()); trigger.setDescription(trigger.getDescription()); res.add(trigger); } } return res; }
private static List<Action> copyActions(List<Action> actions) { List<Action> res = new ArrayList<Action>(); if (actions != null) { for (Action a : actions) { Configuration c = new Configuration(); c.setProperties(a.getConfiguration().getProperties()); Action action = new Action(a.getId(), a.getTypeUID(), c, a.getInputs()); action.setLabel(a.getLabel()); action.setDescription(a.getDescription()); res.add(action); } } return res; }
private List<Action> copyActions(List<Action> actions) { List<Action> res = new ArrayList<Action>(); if (actions != null) { for (Action a : actions) { Configuration c = new Configuration(); c.setProperties(a.getConfiguration().getProperties()); Action action = new Action(a.getId(), a.getTypeUID(), c, a.getInputs()); action.setLabel(a.getLabel()); action.setDescription(a.getDescription()); res.add(action); } } return res; }
public static Trigger mapDto(final TriggerDTO triggerDto) { return ModuleBuilder.createTrigger().withId(triggerDto.id).withTypeUID(triggerDto.type) .withConfiguration(new Configuration(triggerDto.configuration)).withLabel(triggerDto.label) .withDescription(triggerDto.description).build(); }
public static Condition mapDto(final ConditionDTO conditionDto) { return ModuleBuilder.createCondition().withId(conditionDto.id).withTypeUID(conditionDto.type) .withConfiguration(new Configuration(conditionDto.configuration)).withInputs(conditionDto.inputs) .withLabel(conditionDto.label).withDescription(conditionDto.description).build(); }
public static Action mapDto(final ActionDTO actionDto) { return ModuleBuilder.createAction().withId(actionDto.id).withTypeUID(actionDto.type) .withConfiguration(new Configuration(actionDto.configuration)).withInputs(actionDto.inputs) .withLabel(actionDto.label).withDescription(actionDto.description).build(); }
public static Rule map(final RuleDTO ruleDto) { return RuleBuilder.create(ruleDto.uid).withActions(ActionDTOMapper.mapDto(ruleDto.actions)) .withConditions(ConditionDTOMapper.mapDto(ruleDto.conditions)) .withTriggers(TriggerDTOMapper.mapDto(ruleDto.triggers)) .withConfiguration(new Configuration(ruleDto.configuration)) .withConfigurationDescriptions(ConfigDescriptionDTOMapper.map(ruleDto.configDescriptions)) .withTemplateUID(ruleDto.templateUID).withVisibility(ruleDto.visibility).withTags(ruleDto.tags) .withName(ruleDto.name).withDescription(ruleDto.description).build(); }