Skip to content

Commit

Permalink
Merge branch 'master' of github.com:jetlinks/jetlinks-community
Browse files Browse the repository at this point in the history
  • Loading branch information
zhou-hao committed May 21, 2024
2 parents 3d7d3ef + dcc43cb commit 39eb4eb
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,18 @@ default String get(String key,
}

default Map<String, Object> renderMap(Map<String, Object> context) {
return Maps.transformValues(context, value -> value == null ? null: VariableSource.of(value).resolveStatic(context));
return Maps.transformEntries(context, (key, value) ->
Optional.ofNullable(value)
.map(val -> VariableSource.of(val).resolveStatic(context))
.map(val -> {
Optional<VariableDefinition> variableDefOpt = getVariable(key);
if (variableDefOpt.isPresent()) {
return variableDefOpt.get().convertValue(val);
}
return val;
})
.orElse(null)
);
}

default String convert(String key, Object value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public class DeviceMessageConnector implements DecodedClientMessageHandler {
//将设备注册中心的配置追加到消息header中,下游订阅者可直接使用.
private final static String[] allConfigHeader = {
PropertyConstants.productId.getKey(),
PropertyConstants.productName.getKey(),
PropertyConstants.deviceName.getKey(),
PropertyConstants.orgId.getKey()
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ private List<TermColumn> createTermColumn(String prefix, PropertyMetadata proper
TermColumn term = createTermColumn(_prefix, prop, false, valueTypes).get(0);
column.setColumn(term.getColumn());
column.setName(term.getName());
column.setOptions(term.getOptions());
column.withOthers(term.getOthers());
} else {
column.setChildren(createTermColumn(_prefix, prop, last, valueTypes));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ public class TermColumn {
@Schema(description = "可选内容")
private List<PropertyMetric> options;

@Schema(description = "其它配置")
private Map<String, Object> others;

@Schema(description = "子列,在类型为object时有值")
private List<TermColumn> children;

Expand Down Expand Up @@ -235,4 +238,15 @@ public void refactorFullName(String parentName) {
}
}

public TermColumn withOthers(Map<String, Object> options) {
if (options != null) {
safeOptions().putAll(options);
}
return this;
}

public synchronized Map<String, Object> safeOptions() {
return others == null ? others = new HashMap<>() : others;
}

}
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -301,23 +301,23 @@
<version>${log4j.version}</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk15on -->
<!-- https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk18on -->
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.70</version>
<artifactId>bcprov-jdk18on</artifactId>
<version>1.78.1</version>
</dependency>

<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk18on</artifactId>
<version>1.76</version>
<version>1.78.1</version>
</dependency>

<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk18on</artifactId>
<version>1.76</version>
<version>1.78.1</version>
</dependency>

<dependency>
Expand Down

0 comments on commit 39eb4eb

Please sign in to comment.