| | |
| | | package com.hbbohua.water.domain; |
| | | |
| | | import com.hbbohua.water.domain.literal.AttributeNames; |
| | | import com.ooxsoft.ecsi.domain.Unit; |
| | | import com.hbbohua.water.domain.literal.ValueIds; |
| | | import com.hbbohua.water.domain.literal.ValueIdsHex; |
| | | import com.ooxsoft.ecsi.domain.ProductionUnit; |
| | | import com.ooxsoft.objekt.domain.Value; |
| | | import com.ooxsoft.platform.domain.UnitOfMeasure; |
| | | import com.ooxsoft.platform.domain.literal.UnitOfMeasureIdsHex; |
| | | import org.jetbrains.annotations.Nullable; |
| | | |
| | | /** |
| | | * 泵站 |
| | | */ |
| | | public class PumpStation extends Unit { |
| | | public final class PumpStation extends ProductionUnit { |
| | | /** |
| | | * 获取地图标记的类型 |
| | | * 指定地图标记的类型(点、线、圆、矩形、多边形等) |
| | | * |
| | | * @return 地图标记的类型 |
| | | */ |
| | | @Override |
| | | public Value locationType() { |
| | | return Value.forId(ValueIds.LocationType_marker); |
| | | } |
| | | |
| | | /** |
| | | * 获取液位 |
| | | * |
| | | * @return 液位 |
| | | */ |
| | | @Nullable |
| | | public Double getLiquidLevel() { |
| | | return getAttributeValue(AttributeNames.liquidLevel); |
| | | } |
| | | |
| | | /** |
| | | * 设置液位 |
| | | * |
| | | * @param liquidLevel 液位 |
| | | */ |
| | | public void setLiquidLevel(Double liquidLevel) { |
| | | setAttributeValue(AttributeNames.liquidLevel, liquidLevel); |
| | | } |
| | | |
| | | /** |
| | | * 获取警戒液位计量单位 |
| | | * |
| | | * @return 警戒液位计量单位 |
| | | */ |
| | | @Nullable |
| | | public UnitOfMeasure getWarningLevelUnitOfMeasure() { |
| | | return getAttributeValue(AttributeNames.warningLevelUnitOfMeasure); |
| | | } |
| | | |
| | | /** |
| | | * 设置警戒液位计量单位 |
| | | * |
| | | * @param warningLevelUnitOfMeasure 警戒液位计量单位 |
| | | */ |
| | | public void setWarningLevelUnitOfMeasure(UnitOfMeasure warningLevelUnitOfMeasure) { |
| | | setAttributeValue(AttributeNames.warningLevelUnitOfMeasure, warningLevelUnitOfMeasure); |
| | | } |
| | | |
| | | /** |
| | | * 获取液位计量单位 |
| | | * |
| | | * @return 液位计量单位 |
| | | */ |
| | | @Nullable |
| | | public UnitOfMeasure getLiquidLevelUnitOfMeasure() { |
| | | return getAttributeValue(AttributeNames.liquidLevelUnitOfMeasure); |
| | | } |
| | | |
| | | /** |
| | | * 设置液位计量单位 |
| | | * |
| | | * @param liquidLevelUnitOfMeasure 液位计量单位 |
| | | */ |
| | | public void setLiquidLevelUnitOfMeasure(UnitOfMeasure liquidLevelUnitOfMeasure) { |
| | | setAttributeValue(AttributeNames.liquidLevelUnitOfMeasure, liquidLevelUnitOfMeasure); |
| | | } |
| | | |
| | | /** |
| | | * 获取警戒液位 |
| | | * |
| | | * @return 警戒液位 |
| | | */ |
| | | @Nullable |
| | | public Double getWarningLevel() { |
| | | return getAttributeValue(AttributeNames.warningLevel); |
| | | } |
| | | |
| | | /** |
| | | * 设置警戒液位 |
| | | * |
| | | * @param warningLevel 警戒液位 |
| | | */ |
| | | public void setWarningLevel(Double warningLevel) { |
| | | setAttributeValue(AttributeNames.warningLevel, warningLevel); |
| | | } |
| | | /** |
| | | * 对象持久化前处理。该方法由对象持久化框架回调。在将对象从非持久化状态"TRANSIENT"转换为已持久化状态"MANAGED"之前触发。 |
| | | * 子类重写该方法时,要考虑是否调用super.xxx(),以及调用先后时机,以免造成无意的父类代码逻辑被覆盖(丢失) |
| | | */ |
| | | @Override |
| | | protected void prePersist() { |
| | | super.prePersist(); |
| | | //默认液位 米 |
| | | if (getLiquidLevelUnitOfMeasure() == null) { |
| | | setLiquidLevelUnitOfMeasure(UnitOfMeasure.forId(UnitOfMeasureIdsHex.M)); |
| | | } |
| | | //默认液位 米 |
| | | if (getWarningLevelUnitOfMeasure() == null) { |
| | | setWarningLevelUnitOfMeasure(UnitOfMeasure.forId(UnitOfMeasureIdsHex.M)); |
| | | } |
| | | //增加动态属性名,填充实时库标签用 |
| | | if(!containsDynamicAttribute(AttributeNames.liquidLevel)){ |
| | | setDynamicAttribute(AttributeNames.liquidLevel,null,true); |
| | | } |
| | | return Value.forId(ValueIdsHex.LocationType_marker); |
| | | } |
| | | } |