Skip to content

Commit

Permalink
add option to add metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
querdenker2k committed Dec 30, 2023
1 parent a07c951 commit 6b2af77
Show file tree
Hide file tree
Showing 64 changed files with 232 additions and 298 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@
package org.openhab.automation.jrule.internal.items;

import java.util.List;
import java.util.Map;

import org.openhab.automation.jrule.items.JRuleCallGroupItem;
import org.openhab.automation.jrule.items.metadata.JRuleItemMetadata;
import org.openhab.automation.jrule.items.metadata.JRuleMetadataRegistry;

/**
* The {@link JRuleInternalCallGroupItem} Items
Expand All @@ -26,7 +25,7 @@
public class JRuleInternalCallGroupItem extends JRuleInternalCallItem implements JRuleCallGroupItem {

public JRuleInternalCallGroupItem(String name, String label, String type, String id,
Map<String, JRuleItemMetadata> metadata, List<String> tags) {
super(name, label, type, id, metadata, tags);
JRuleMetadataRegistry metadataRegistry, List<String> tags) {
super(name, label, type, id, metadataRegistry, tags);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@
package org.openhab.automation.jrule.internal.items;

import java.util.List;
import java.util.Map;

import org.openhab.automation.jrule.items.JRuleCallItem;
import org.openhab.automation.jrule.items.metadata.JRuleItemMetadata;
import org.openhab.automation.jrule.items.metadata.JRuleMetadataRegistry;

/**
* The {@link JRuleInternalCallItem} Items
Expand All @@ -26,7 +25,7 @@
public class JRuleInternalCallItem extends JRuleInternalItem implements JRuleCallItem {

public JRuleInternalCallItem(String name, String label, String type, String id,
Map<String, JRuleItemMetadata> metadata, List<String> tags) {
super(name, label, type, id, metadata, tags);
JRuleMetadataRegistry metadataRegistry, List<String> tags) {
super(name, label, type, id, metadataRegistry, tags);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@
package org.openhab.automation.jrule.internal.items;

import java.util.List;
import java.util.Map;

import org.openhab.automation.jrule.items.JRuleColorGroupItem;
import org.openhab.automation.jrule.items.metadata.JRuleItemMetadata;
import org.openhab.automation.jrule.items.metadata.JRuleMetadataRegistry;

/**
* The {@link JRuleInternalColorGroupItem} Items
Expand All @@ -26,7 +25,7 @@
public class JRuleInternalColorGroupItem extends JRuleInternalColorItem implements JRuleColorGroupItem {

public JRuleInternalColorGroupItem(String name, String label, String type, String id,
Map<String, JRuleItemMetadata> metadata, List<String> tags) {
super(name, label, type, id, metadata, tags);
JRuleMetadataRegistry metadataRegistry, List<String> tags) {
super(name, label, type, id, metadataRegistry, tags);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@
package org.openhab.automation.jrule.internal.items;

import java.util.List;
import java.util.Map;

import org.openhab.automation.jrule.items.JRuleColorItem;
import org.openhab.automation.jrule.items.metadata.JRuleItemMetadata;
import org.openhab.automation.jrule.items.metadata.JRuleMetadataRegistry;

/**
* The {@link JRuleInternalColorItem} Items
Expand All @@ -26,7 +25,7 @@
public class JRuleInternalColorItem extends JRuleInternalDimmerItem implements JRuleColorItem {

public JRuleInternalColorItem(String name, String label, String type, String id,
Map<String, JRuleItemMetadata> metadata, List<String> tags) {
super(name, label, type, id, metadata, tags);
JRuleMetadataRegistry metadataRegistry, List<String> tags) {
super(name, label, type, id, metadataRegistry, tags);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@
package org.openhab.automation.jrule.internal.items;

import java.util.List;
import java.util.Map;

import org.openhab.automation.jrule.items.JRuleContactGroupItem;
import org.openhab.automation.jrule.items.metadata.JRuleItemMetadata;
import org.openhab.automation.jrule.items.metadata.JRuleMetadataRegistry;

/**
* The {@link JRuleInternalContactGroupItem} Items
Expand All @@ -26,7 +25,7 @@
public class JRuleInternalContactGroupItem extends JRuleInternalContactItem implements JRuleContactGroupItem {

public JRuleInternalContactGroupItem(String name, String label, String type, String id,
Map<String, JRuleItemMetadata> metadata, List<String> tags) {
super(name, label, type, id, metadata, tags);
JRuleMetadataRegistry metadataRegistry, List<String> tags) {
super(name, label, type, id, metadataRegistry, tags);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@

import java.time.ZonedDateTime;
import java.util.List;
import java.util.Map;
import java.util.Optional;

import org.openhab.automation.jrule.items.JRuleContactItem;
import org.openhab.automation.jrule.items.metadata.JRuleItemMetadata;
import org.openhab.automation.jrule.items.metadata.JRuleMetadataRegistry;
import org.openhab.core.library.types.DecimalType;

/**
Expand All @@ -29,8 +28,8 @@
public class JRuleInternalContactItem extends JRuleInternalItem implements JRuleContactItem {

public JRuleInternalContactItem(String name, String label, String type, String id,
Map<String, JRuleItemMetadata> metadata, List<String> tags) {
super(name, label, type, id, metadata, tags);
JRuleMetadataRegistry metadataRegistry, List<String> tags) {
super(name, label, type, id, metadataRegistry, tags);
}

public Optional<Double> maximumSince(ZonedDateTime timestamp, String persistenceServiceId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@
package org.openhab.automation.jrule.internal.items;

import java.util.List;
import java.util.Map;

import org.openhab.automation.jrule.items.JRuleDateTimeGroupItem;
import org.openhab.automation.jrule.items.metadata.JRuleItemMetadata;
import org.openhab.automation.jrule.items.metadata.JRuleMetadataRegistry;

/**
* The {@link JRuleInternalDateTimeGroupItem} Items
Expand All @@ -26,7 +25,7 @@
public class JRuleInternalDateTimeGroupItem extends JRuleInternalDateTimeItem implements JRuleDateTimeGroupItem {

public JRuleInternalDateTimeGroupItem(String name, String label, String type, String id,
Map<String, JRuleItemMetadata> metadata, List<String> tags) {
super(name, label, type, id, metadata, tags);
JRuleMetadataRegistry metadataRegistry, List<String> tags) {
super(name, label, type, id, metadataRegistry, tags);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@
package org.openhab.automation.jrule.internal.items;

import java.util.List;
import java.util.Map;

import org.openhab.automation.jrule.items.JRuleDateTimeItem;
import org.openhab.automation.jrule.items.metadata.JRuleItemMetadata;
import org.openhab.automation.jrule.items.metadata.JRuleMetadataRegistry;

/**
* The {@link JRuleInternalDateTimeItem} Items
Expand All @@ -26,7 +25,7 @@
public class JRuleInternalDateTimeItem extends JRuleInternalItem implements JRuleDateTimeItem {

public JRuleInternalDateTimeItem(String name, String label, String type, String id,
Map<String, JRuleItemMetadata> metadata, List<String> tags) {
super(name, label, type, id, metadata, tags);
JRuleMetadataRegistry metadataRegistry, List<String> tags) {
super(name, label, type, id, metadataRegistry, tags);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@
package org.openhab.automation.jrule.internal.items;

import java.util.List;
import java.util.Map;

import org.openhab.automation.jrule.items.JRuleDimmerGroupItem;
import org.openhab.automation.jrule.items.metadata.JRuleItemMetadata;
import org.openhab.automation.jrule.items.metadata.JRuleMetadataRegistry;

/**
* The {@link JRuleInternalDimmerGroupItem} Items
Expand All @@ -25,7 +24,7 @@
*/
public class JRuleInternalDimmerGroupItem extends JRuleInternalDimmerItem implements JRuleDimmerGroupItem {
public JRuleInternalDimmerGroupItem(String name, String label, String type, String id,
Map<String, JRuleItemMetadata> metadata, List<String> tags) {
super(name, label, type, id, metadata, tags);
JRuleMetadataRegistry metadataRegistry, List<String> tags) {
super(name, label, type, id, metadataRegistry, tags);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@
package org.openhab.automation.jrule.internal.items;

import java.util.List;
import java.util.Map;

import org.openhab.automation.jrule.items.JRuleDimmerItem;
import org.openhab.automation.jrule.items.metadata.JRuleItemMetadata;
import org.openhab.automation.jrule.items.metadata.JRuleMetadataRegistry;

/**
* The {@link JRuleInternalDimmerItem} Items
Expand All @@ -25,7 +24,7 @@
*/
public class JRuleInternalDimmerItem extends JRuleInternalSwitchItem implements JRuleDimmerItem {
public JRuleInternalDimmerItem(String name, String label, String type, String id,
Map<String, JRuleItemMetadata> metadata, List<String> tags) {
super(name, label, type, id, metadata, tags);
JRuleMetadataRegistry metadataRegistry, List<String> tags) {
super(name, label, type, id, metadataRegistry, tags);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@
package org.openhab.automation.jrule.internal.items;

import java.util.List;
import java.util.Map;

import org.openhab.automation.jrule.items.JRuleImageGroupItem;
import org.openhab.automation.jrule.items.metadata.JRuleItemMetadata;
import org.openhab.automation.jrule.items.metadata.JRuleMetadataRegistry;

/**
* The {@link JRuleInternalImageGroupItem} Items
Expand All @@ -26,7 +25,7 @@
public class JRuleInternalImageGroupItem extends JRuleInternalImageItem implements JRuleImageGroupItem {

public JRuleInternalImageGroupItem(String name, String label, String type, String id,
Map<String, JRuleItemMetadata> metadata, List<String> tags) {
super(name, label, type, id, metadata, tags);
JRuleMetadataRegistry metadataRegistry, List<String> tags) {
super(name, label, type, id, metadataRegistry, tags);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@
package org.openhab.automation.jrule.internal.items;

import java.util.List;
import java.util.Map;

import org.openhab.automation.jrule.items.JRuleImageItem;
import org.openhab.automation.jrule.items.metadata.JRuleItemMetadata;
import org.openhab.automation.jrule.items.metadata.JRuleMetadataRegistry;

/**
* The {@link JRuleInternalImageItem} Items
Expand All @@ -25,7 +24,7 @@
*/
public class JRuleInternalImageItem extends JRuleInternalItem implements JRuleImageItem {
public JRuleInternalImageItem(String name, String label, String type, String id,
Map<String, JRuleItemMetadata> metadata, List<String> tags) {
super(name, label, type, id, metadata, tags);
JRuleMetadataRegistry metadataRegistry, List<String> tags) {
super(name, label, type, id, metadataRegistry, tags);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.openhab.automation.jrule.internal.handler.JRuleEventHandler;
import org.openhab.automation.jrule.items.JRuleItem;
import org.openhab.automation.jrule.items.metadata.JRuleItemMetadata;
import org.openhab.automation.jrule.items.metadata.JRuleMetadataRegistry;
import org.openhab.automation.jrule.rules.value.JRuleStringValue;
import org.openhab.automation.jrule.rules.value.JRuleValue;
import org.openhab.core.types.State;
Expand All @@ -35,16 +36,16 @@ public abstract class JRuleInternalItem implements JRuleItem {
protected final String label;
protected final String type;
protected final String id;
protected final Map<String, JRuleItemMetadata> metadata;
protected final JRuleMetadataRegistry metadataRegistry;
protected final List<String> tags;

public JRuleInternalItem(String name, String label, String type, String id, Map<String, JRuleItemMetadata> metadata,
public JRuleInternalItem(String name, String label, String type, String id, JRuleMetadataRegistry metadataRegistry,
List<String> tags) {
this.name = name;
this.label = label;
this.type = type;
this.id = id;
this.metadata = metadata;
this.metadataRegistry = metadataRegistry;
this.tags = tags;
}

Expand Down Expand Up @@ -79,7 +80,12 @@ public String getId() {

@Override
public Map<String, JRuleItemMetadata> getMetadata() {
return metadata;
return metadataRegistry.getAllMetadata(name);
}

@Override
public void addMetadata(String namespace, JRuleItemMetadata metadata) {
this.metadataRegistry.addMetadata(namespace, name, metadata);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@
package org.openhab.automation.jrule.internal.items;

import java.util.List;
import java.util.Map;

import org.openhab.automation.jrule.items.JRuleLocationGroupItem;
import org.openhab.automation.jrule.items.metadata.JRuleItemMetadata;
import org.openhab.automation.jrule.items.metadata.JRuleMetadataRegistry;

/**
* The {@link JRuleInternalLocationGroupItem} Items
Expand All @@ -26,7 +25,7 @@
public class JRuleInternalLocationGroupItem extends JRuleInternalLocationItem implements JRuleLocationGroupItem {

public JRuleInternalLocationGroupItem(String name, String label, String type, String id,
Map<String, JRuleItemMetadata> metadata, List<String> tags) {
super(name, label, type, id, metadata, tags);
JRuleMetadataRegistry metadataRegistry, List<String> tags) {
super(name, label, type, id, metadataRegistry, tags);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@
package org.openhab.automation.jrule.internal.items;

import java.util.List;
import java.util.Map;

import org.openhab.automation.jrule.items.JRuleLocationItem;
import org.openhab.automation.jrule.items.metadata.JRuleItemMetadata;
import org.openhab.automation.jrule.items.metadata.JRuleMetadataRegistry;

/**
* The {@link JRuleInternalLocationItem} Items
Expand All @@ -25,7 +24,7 @@
*/
public class JRuleInternalLocationItem extends JRuleInternalItem implements JRuleLocationItem {
public JRuleInternalLocationItem(String name, String label, String type, String id,
Map<String, JRuleItemMetadata> metadata, List<String> tags) {
super(name, label, type, id, metadata, tags);
JRuleMetadataRegistry metadataRegistry, List<String> tags) {
super(name, label, type, id, metadataRegistry, tags);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@
package org.openhab.automation.jrule.internal.items;

import java.util.List;
import java.util.Map;

import org.openhab.automation.jrule.items.JRuleNumberGroupItem;
import org.openhab.automation.jrule.items.metadata.JRuleItemMetadata;
import org.openhab.automation.jrule.items.metadata.JRuleMetadataRegistry;

/**
* The {@link JRuleInternalNumberGroupItem} Items
Expand All @@ -26,7 +25,7 @@
public class JRuleInternalNumberGroupItem extends JRuleInternalNumberItem implements JRuleNumberGroupItem {

public JRuleInternalNumberGroupItem(String name, String label, String type, String id,
Map<String, JRuleItemMetadata> metadata, List<String> tags) {
super(name, label, type, id, metadata, tags);
JRuleMetadataRegistry metadataRegistry, List<String> tags) {
super(name, label, type, id, metadataRegistry, tags);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@

import java.time.ZonedDateTime;
import java.util.List;
import java.util.Map;
import java.util.Optional;

import org.openhab.automation.jrule.items.JRuleNumberItem;
import org.openhab.automation.jrule.items.metadata.JRuleItemMetadata;
import org.openhab.automation.jrule.items.metadata.JRuleMetadataRegistry;
import org.openhab.core.library.types.DecimalType;

/**
Expand All @@ -29,8 +28,8 @@
public class JRuleInternalNumberItem extends JRuleInternalItem implements JRuleNumberItem {

public JRuleInternalNumberItem(String name, String label, String type, String id,
Map<String, JRuleItemMetadata> metadata, List<String> tags) {
super(name, label, type, id, metadata, tags);
JRuleMetadataRegistry metadataRegistry, List<String> tags) {
super(name, label, type, id, metadataRegistry, tags);
}

public Optional<Double> maximumSince(ZonedDateTime timestamp, String persistenceServiceId) {
Expand Down
Loading

0 comments on commit 6b2af77

Please sign in to comment.