Browse Source
- Introduce HasAppliedToEntity interface used by CreatedAlarmRuleInfo and CreatedCalculatedFieldInfo to share the entity page-link logic and cover DEVICE / ASSET in addition to the profile types. - Add static from(EntityId, name, CalculatedField) factories to both records; SolutionInstallContext now uses them and detects ALARM calculated fields via type instead of the previous TODO/hardcoded false. - AlarmSeverity and CalculatedFieldType expose display names used when formatting created-alarm-rule severities and CF type column. - DefaultSolutionService switches the CF arguments check from BaseCalculatedFieldConfiguration to ArgumentsBasedCalculatedFieldConfiguration and throws ThingsboardRuntimeException for missing references.pull/15548/head
7 changed files with 103 additions and 41 deletions
@ -0,0 +1,43 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2026 The Thingsboard Authors |
||||
|
* |
||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
|
* you may not use this file except in compliance with the License. |
||||
|
* You may obtain a copy of the License at |
||||
|
* |
||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
* |
||||
|
* Unless required by applicable law or agreed to in writing, software |
||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
|
* See the License for the specific language governing permissions and |
||||
|
* limitations under the License. |
||||
|
*/ |
||||
|
package org.thingsboard.server.service.solutions.data; |
||||
|
|
||||
|
import org.thingsboard.server.common.data.id.EntityId; |
||||
|
|
||||
|
import java.util.UUID; |
||||
|
|
||||
|
public interface HasAppliedToEntity { |
||||
|
|
||||
|
EntityId entityId(); |
||||
|
|
||||
|
String getCfPageLink(UUID cfId); |
||||
|
|
||||
|
default String getEntityPageLink() { |
||||
|
EntityId id = entityId(); |
||||
|
if (id == null) { |
||||
|
return null; |
||||
|
} |
||||
|
String idStr = id.getId().toString(); |
||||
|
return switch (id.getEntityType()) { |
||||
|
case DEVICE_PROFILE -> "/profiles/deviceProfiles/" + idStr; |
||||
|
case ASSET_PROFILE -> "/profiles/assetProfiles/" + idStr; |
||||
|
case DEVICE -> "/entities/devices/" + idStr; |
||||
|
case ASSET -> "/entities/assets/" + idStr; |
||||
|
default -> null; |
||||
|
}; |
||||
|
} |
||||
|
|
||||
|
} |
||||
Loading…
Reference in new issue