test_class.declarator: THING_UID_ONLINE = new ThingUID("test::mock-online")
test_class.modifier: private static final
test_class.original_string: private static final ThingUID THING_UID_ONLINE = new ThingUID("test::mock-online");
test_class.type: ThingUID
test_class.var_name: THING_UID_ONLINE
test_class.declarator: THING_UID_OFFLINE = new ThingUID("test::mock-offline")
test_class.modifier: private static final
test_class.original_string: private static final ThingUID THING_UID_OFFLINE = new ThingUID("test::mock-offline");
test_class.type: ThingUID
test_class.var_name: THING_UID_OFFLINE
test_class.declarator: THING_UID_HANDLER_MISSING = new ThingUID("test::handlerMissing")
test_class.modifier: private static final
test_class.original_string: private static final ThingUID THING_UID_HANDLER_MISSING = new ThingUID("test::handlerMissing");
test_class.type: ThingUID
test_class.var_name: THING_UID_HANDLER_MISSING
test_class.declarator: CHANNEL_UID_ONLINE_1 = new ChannelUID(THING_UID_ONLINE, "channel1")
test_class.modifier: private static final
test_class.original_string: private static final ChannelUID CHANNEL_UID_ONLINE_1 = new ChannelUID(THING_UID_ONLINE, "channel1");
test_class.type: ChannelUID
test_class.var_name: CHANNEL_UID_ONLINE_1
test_class.declarator: CHANNEL_UID_ONLINE_2 = new ChannelUID(THING_UID_ONLINE, "channel2")
test_class.modifier: private static final
test_class.original_string: private static final ChannelUID CHANNEL_UID_ONLINE_2 = new ChannelUID(THING_UID_ONLINE, "channel2");
test_class.type: ChannelUID
test_class.var_name: CHANNEL_UID_ONLINE_2
test_class.declarator: CHANNEL_UID_OFFLINE_1 = new ChannelUID(THING_UID_OFFLINE, "channel1")
test_class.modifier: private static final
test_class.original_string: private static final ChannelUID CHANNEL_UID_OFFLINE_1 = new ChannelUID(THING_UID_OFFLINE, "channel1");
test_class.type: ChannelUID
test_class.var_name: CHANNEL_UID_OFFLINE_1
test_class.declarator: CHANNEL_UID_ONLINE_GONE = new ChannelUID(THING_UID_ONLINE, "gone")
test_class.modifier: private static final
test_class.original_string: private static final ChannelUID CHANNEL_UID_ONLINE_GONE = new ChannelUID(THING_UID_ONLINE, "gone");
test_class.type: ChannelUID
test_class.var_name: CHANNEL_UID_ONLINE_GONE
test_class.declarator: CHANNEL_UID_HANDLER_MISSING = new ChannelUID(THING_UID_HANDLER_MISSING, "channel1")
test_class.modifier: private static final
test_class.original_string: private static final ChannelUID CHANNEL_UID_HANDLER_MISSING = new ChannelUID(THING_UID_HANDLER_MISSING, "channel1");
test_class.type: ChannelUID
test_class.var_name: CHANNEL_UID_HANDLER_MISSING
test_class.declarator: event
test_class.modifier: private
test_class.original_string: private ItemCommandEvent event;
test_class.type: ItemCommandEvent
test_class.var_name: event
test_class.declarator: item
test_class.modifier: private
test_class.original_string: private GenericItem item;
test_class.type: GenericItem
test_class.var_name: item
test_class.declarator: channelTypeRegistryMock
test_class.modifier: private @Mock
test_class.original_string: private @Mock ChannelTypeRegistry channelTypeRegistryMock;
test_class.type: ChannelTypeRegistry
test_class.var_name: channelTypeRegistryMock
test_class.declarator: eventPublisherMock
test_class.modifier: private @Mock
test_class.original_string: private @Mock EventPublisher eventPublisherMock;
test_class.type: EventPublisher
test_class.var_name: eventPublisherMock
test_class.declarator: iclRegistryMock
test_class.modifier: private @Mock
test_class.original_string: private @Mock ItemChannelLinkRegistry iclRegistryMock;
test_class.type: ItemChannelLinkRegistry
test_class.var_name: iclRegistryMock
test_class.declarator: thingRegistryMock
test_class.modifier: private @Mock
test_class.original_string: private @Mock ThingRegistry thingRegistryMock;
test_class.type: ThingRegistry
test_class.var_name: thingRegistryMock
test_class.declarator: onlineThingMock
test_class.modifier: private @Mock
test_class.original_string: private @Mock Thing onlineThingMock;
test_class.type: Thing
test_class.var_name: onlineThingMock
test_class.declarator: offlineThingMock
test_class.modifier: private @Mock
test_class.original_string: private @Mock Thing offlineThingMock;
test_class.type: Thing
test_class.var_name: offlineThingMock
test_class.declarator: thingMissingHandlerMock
test_class.modifier: private @Mock
test_class.original_string: private @Mock Thing thingMissingHandlerMock;
test_class.type: Thing
test_class.var_name: thingMissingHandlerMock
test_class.declarator: handlerMock
test_class.modifier: private @Mock
test_class.original_string: private @Mock ThingHandler handlerMock;
test_class.type: ThingHandler
test_class.var_name: handlerMock
test_class.declarator: metadataRegistryMock
test_class.modifier: private @Mock
test_class.original_string: private @Mock MetadataRegistry metadataRegistryMock;
test_class.type: MetadataRegistry
test_class.var_name: metadataRegistryMock
test_class.declarator: links = new LinkedList<>()
test_class.modifier: private final
test_class.original_string: private final List<ItemChannelLink> links = new LinkedList<>();
test_class.type: List<ItemChannelLink>
test_class.var_name: links
test_class.declarator: aum
test_class.modifier: private
test_class.original_string: private AutoUpdateManager aum;
test_class.type: AutoUpdateManager
test_class.var_name: aum
test_class.declarator: policies = new HashMap<>()
test_class.modifier: private final
test_class.original_string: private final Map<ChannelUID, AutoUpdatePolicy> policies = new HashMap<>();
test_class.type: Map<ChannelUID, AutoUpdatePolicy>
test_class.var_name: policies
test_class.file: bundles/org.openhab.core.thing/src/test/java/org/openhab/core/thing/internal/AutoUpdateManagerTest.java
test_class.identifier: AutoUpdateManagerTest
test_case.body: @Test
      public void testAutoUpdatePolicyVETObeatsDEFAULT() {
          links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_1));
          links.add(new ItemChannelLink("test", CHANNEL_UID_ONLINE_2));
          setAutoUpdatePolicy(CHANNEL_UID_ONLINE_1, AutoUpdatePolicy.VETO);
          setAutoUpdatePolicy(CHANNEL_UID_ONLINE_2, AutoUpdatePolicy.DEFAULT);
  
          aum.receiveCommand(event, item);
  
          assertNothingHappened();
      }
test_case.class_method_signature: AutoUpdateManagerTest.testAutoUpdatePolicyVETObeatsDEFAULT()
test_case.full_signature: @Test public void testAutoUpdatePolicyVETObeatsDEFAULT()
test_case.identifier: testAutoUpdatePolicyVETObeatsDEFAULT
test_case.invocations: add add setAutoUpdatePolicy setAutoUpdatePolicy receiveCommand assertNothingHappened
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testAutoUpdatePolicyVETObeatsDEFAULT()
focal_class.declarator: AUTOUPDATE_KEY = "autoupdate"
focal_class.modifier: private static final
focal_class.original_string: private static final String AUTOUPDATE_KEY = "autoupdate";
focal_class.type: String
focal_class.var_name: AUTOUPDATE_KEY
focal_class.declarator: EVENT_SOURCE = "org.openhab.core.autoupdate"
focal_class.modifier: protected static final
focal_class.original_string: protected static final String EVENT_SOURCE = "org.openhab.core.autoupdate";
focal_class.type: String
focal_class.var_name: EVENT_SOURCE
focal_class.declarator: EVENT_SOURCE_OPTIMISTIC = "org.openhab.core.autoupdate.optimistic"
focal_class.modifier: protected static final
focal_class.original_string: protected static final String EVENT_SOURCE_OPTIMISTIC = "org.openhab.core.autoupdate.optimistic";
focal_class.type: String
focal_class.var_name: EVENT_SOURCE_OPTIMISTIC
focal_class.declarator: PROPERTY_ENABLED = "enabled"
focal_class.modifier: protected static final
focal_class.original_string: protected static final String PROPERTY_ENABLED = "enabled";
focal_class.type: String
focal_class.var_name: PROPERTY_ENABLED
focal_class.declarator: PROPERTY_SEND_OPTIMISTIC_UPDATES = "sendOptimisticUpdates"
focal_class.modifier: protected static final
focal_class.original_string: protected static final String PROPERTY_SEND_OPTIMISTIC_UPDATES = "sendOptimisticUpdates";
focal_class.type: String
focal_class.var_name: PROPERTY_SEND_OPTIMISTIC_UPDATES
focal_class.declarator: logger = LoggerFactory.getLogger(AutoUpdateManager.class)
focal_class.modifier: private final
focal_class.original_string: private final Logger logger = LoggerFactory.getLogger(AutoUpdateManager.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: channelTypeRegistry
focal_class.modifier: private final
focal_class.original_string: private final ChannelTypeRegistry channelTypeRegistry;
focal_class.type: ChannelTypeRegistry
focal_class.var_name: channelTypeRegistry
focal_class.declarator: eventPublisher
focal_class.modifier: private final
focal_class.original_string: private final EventPublisher eventPublisher;
focal_class.type: EventPublisher
focal_class.var_name: eventPublisher
focal_class.declarator: itemChannelLinkRegistry
focal_class.modifier: private final
focal_class.original_string: private final ItemChannelLinkRegistry itemChannelLinkRegistry;
focal_class.type: ItemChannelLinkRegistry
focal_class.var_name: itemChannelLinkRegistry
focal_class.declarator: metadataRegistry
focal_class.modifier: private final
focal_class.original_string: private final MetadataRegistry metadataRegistry;
focal_class.type: MetadataRegistry
focal_class.var_name: metadataRegistry
focal_class.declarator: thingRegistry
focal_class.modifier: private final
focal_class.original_string: private final ThingRegistry thingRegistry;
focal_class.type: ThingRegistry
focal_class.var_name: thingRegistry
focal_class.declarator: enabled = true
focal_class.modifier: private
focal_class.original_string: private boolean enabled = true;
focal_class.type: boolean
focal_class.var_name: enabled
focal_class.declarator: sendOptimisticUpdates = false
focal_class.modifier: private
focal_class.original_string: private boolean sendOptimisticUpdates = false;
focal_class.type: boolean
focal_class.var_name: sendOptimisticUpdates
focal_class.file: bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/AutoUpdateManager.java
focal_class.identifier: AutoUpdateManager
focal_class.class_method_signature: AutoUpdateManager.AutoUpdateManager(Map<String, @Nullable Object> configuration,
              final @Reference ChannelTypeRegistry channelTypeRegistry, //
              final @Reference EventPublisher eventPublisher,
              final @Reference ItemChannelLinkRegistry itemChannelLinkRegistry,
              final @Reference MetadataRegistry metadataRegistry, //
              final @Reference ThingRegistry thingRegistry)
focal_class.full_signature: @Activate public  AutoUpdateManager(Map<String, @Nullable Object> configuration,
              final @Reference ChannelTypeRegistry channelTypeRegistry, //
              final @Reference EventPublisher eventPublisher,
              final @Reference ItemChannelLinkRegistry itemChannelLinkRegistry,
              final @Reference MetadataRegistry metadataRegistry, //
              final @Reference ThingRegistry thingRegistry)
focal_class.identifier: AutoUpdateManager
focal_class.modifiers: @Activate public
focal_class.parameters: (Map<String, @Nullable Object> configuration,
              final @Reference ChannelTypeRegistry channelTypeRegistry, //
              final @Reference EventPublisher eventPublisher,
              final @Reference ItemChannelLinkRegistry itemChannelLinkRegistry,
              final @Reference MetadataRegistry metadataRegistry, //
              final @Reference ThingRegistry thingRegistry)
focal_class.signature:  AutoUpdateManager(Map<String, @Nullable Object> configuration,
              final @Reference ChannelTypeRegistry channelTypeRegistry, //
              final @Reference EventPublisher eventPublisher,
              final @Reference ItemChannelLinkRegistry itemChannelLinkRegistry,
              final @Reference MetadataRegistry metadataRegistry, //
              final @Reference ThingRegistry thingRegistry)
focal_class.class_method_signature: AutoUpdateManager.modified(Map<String, @Nullable Object> configuration)
focal_class.full_signature: @Modified protected void modified(Map<String, @Nullable Object> configuration)
focal_class.identifier: modified
focal_class.modifiers: @Modified protected
focal_class.parameters: (Map<String, @Nullable Object> configuration)
focal_class.return: void
focal_class.signature: void modified(Map<String, @Nullable Object> configuration)
focal_class.class_method_signature: AutoUpdateManager.receiveCommand(ItemCommandEvent commandEvent, Item item)
focal_class.full_signature: public void receiveCommand(ItemCommandEvent commandEvent, Item item)
focal_class.identifier: receiveCommand
focal_class.modifiers: public
focal_class.parameters: (ItemCommandEvent commandEvent, Item item)
focal_class.return: void
focal_class.signature: void receiveCommand(ItemCommandEvent commandEvent, Item item)
focal_class.class_method_signature: AutoUpdateManager.shouldAutoUpdate(String itemName)
focal_class.full_signature: private Recommendation shouldAutoUpdate(String itemName)
focal_class.identifier: shouldAutoUpdate
focal_class.modifiers: private
focal_class.parameters: (String itemName)
focal_class.return: Recommendation
focal_class.signature: Recommendation shouldAutoUpdate(String itemName)
focal_class.class_method_signature: AutoUpdateManager.postUpdate(Item item, State newState, String origin)
focal_class.full_signature: private void postUpdate(Item item, State newState, String origin)
focal_class.identifier: postUpdate
focal_class.modifiers: private
focal_class.parameters: (Item item, State newState, String origin)
focal_class.return: void
focal_class.signature: void postUpdate(Item item, State newState, String origin)
focal_class.class_method_signature: AutoUpdateManager.postPrediction(Item item, State predictedState, boolean isConfirmation)
focal_class.full_signature: private void postPrediction(Item item, State predictedState, boolean isConfirmation)
focal_class.identifier: postPrediction
focal_class.modifiers: private
focal_class.parameters: (Item item, State predictedState, boolean isConfirmation)
focal_class.return: void
focal_class.signature: void postPrediction(Item item, State predictedState, boolean isConfirmation)
focal_class.class_method_signature: AutoUpdateManager.isAcceptedState(State newState, Item item)
focal_class.full_signature: private boolean isAcceptedState(State newState, Item item)
focal_class.identifier: isAcceptedState
focal_class.modifiers: private
focal_class.parameters: (State newState, Item item)
focal_class.return: boolean
focal_class.signature: boolean isAcceptedState(State newState, Item item)
focal_method.body: public void receiveCommand(ItemCommandEvent commandEvent, Item item) {
          if (!enabled) {
              return;
          }
          final String itemName = commandEvent.getItemName();
          final Command command = commandEvent.getItemCommand();
          if (command instanceof State) {
              final State state = (State) command;
  
              Recommendation autoUpdate = shouldAutoUpdate(itemName);
  
              // consider user-override via item meta-data
              MetadataKey key = new MetadataKey(AUTOUPDATE_KEY, itemName);
              Metadata metadata = metadataRegistry.get(key);
              if (metadata != null && !metadata.getValue().trim().isEmpty()) {
                  boolean override = Boolean.parseBoolean(metadata.getValue());
                  if (override) {
                      logger.trace("Auto update strategy {} overriden by item metadata to REQUIRED", autoUpdate);
                      autoUpdate = Recommendation.REQUIRED;
                  } else {
                      logger.trace("Auto update strategy {} overriden by item metadata to DONT", autoUpdate);
                      autoUpdate = Recommendation.DONT;
                  }
              }
  
              switch (autoUpdate) {
                  case REQUIRED:
                      logger.trace("Automatically updating item '{}' because no channel is linked", itemName);
                      postUpdate(item, state, EVENT_SOURCE);
                      break;
                  case RECOMMENDED:
                      logger.trace("Automatically updating item '{}' because no channel does it", itemName);
                      postUpdate(item, state, EVENT_SOURCE);
                      break;
                  case OPTIMISTIC:
                      logger.trace("Optimistically updating item '{}'", itemName);
                      postPrediction(item, state, false);
                      if (sendOptimisticUpdates) {
                          postUpdate(item, state, EVENT_SOURCE_OPTIMISTIC);
                      }
                      break;
                  case DONT:
                      logger.trace("Won't update item '{}' as it was vetoed.", itemName);
                      break;
                  case REVERT:
                      logger.trace("Sending current item state to revert controls '{}'", itemName);
                      postPrediction(item, item.getState(), true);
                      break;
              }
          }
      }
focal_method.class_method_signature: AutoUpdateManager.receiveCommand(ItemCommandEvent commandEvent, Item item)
focal_method.full_signature: public void receiveCommand(ItemCommandEvent commandEvent, Item item)
focal_method.identifier: receiveCommand
focal_method.invocations: getItemName getItemCommand shouldAutoUpdate get isEmpty trim getValue parseBoolean getValue trace trace trace postUpdate trace postUpdate trace postPrediction postUpdate trace trace postPrediction getState
focal_method.modifiers: public
focal_method.parameters: (ItemCommandEvent commandEvent, Item item)
focal_method.return: void
focal_method.signature: void receiveCommand(ItemCommandEvent commandEvent, Item item)