Skip to content

Commit

Permalink
Added expire functionality as core framework feature (openhab#1803)
Browse files Browse the repository at this point in the history
* Added expire functionality as core framework feature

Closes openhab#1620

Signed-off-by: Kai Kreuzer <kai@openhab.org>
  • Loading branch information
kaikreuzer committed Nov 19, 2020
1 parent 70ca765 commit 63ec434
Show file tree
Hide file tree
Showing 4 changed files with 656 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.openhab.core.items.Item;
import org.openhab.core.items.ItemFactory;
import org.openhab.core.items.ItemProvider;
import org.openhab.core.items.ItemUtil;
import org.openhab.core.items.dto.GroupFunctionDTO;
import org.openhab.core.items.dto.ItemDTOMapper;
import org.openhab.core.model.core.EventType;
Expand Down Expand Up @@ -299,7 +300,7 @@ private void dispatchBindingsPerItemType(@Nullable BindingConfigReader reader, S
if (model != null) {
for (ModelItem modelItem : model.getItems()) {
for (String itemType : itemTypes) {
if (itemType.equals(modelItem.getType())) {
if (itemType.equals(ItemUtil.getMainItemType(modelItem.getType()))) {
Item item = createItemFromModelItem(modelItem);
if (item != null) {
internalDispatchBindings(reader, modelName, item, modelItem.getBindings());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,50 @@ public String getPayload() {
public @Nullable String getSource() {
return source;
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((payload == null) ? 0 : payload.hashCode());
result = prime * result + ((source == null) ? 0 : source.hashCode());
result = prime * result + ((topic == null) ? 0 : topic.hashCode());
return result;
}

@Override
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
AbstractEvent other = (AbstractEvent) obj;
if (payload == null) {
if (other.payload != null) {
return false;
}
} else if (!payload.equals(other.payload)) {
return false;
}
if (source == null) {
if (other.source != null) {
return false;
}
} else if (!source.equals(other.source)) {
return false;
}
if (topic == null) {
if (other.topic != null) {
return false;
}
} else if (!topic.equals(other.topic)) {
return false;
}
return true;
}
}
Loading

0 comments on commit 63ec434

Please sign in to comment.