iscs v2
This commit is contained in:
parent
a3deb1b327
commit
71e2b20935
@ -3,11 +3,13 @@ package club.joylink.rtss.iscs.convert;
|
|||||||
import club.joylink.iscs.model.data.DataModelMapProto;
|
import club.joylink.iscs.model.data.DataModelMapProto;
|
||||||
import club.joylink.iscs.model.data.PageDataModelProto;
|
import club.joylink.iscs.model.data.PageDataModelProto;
|
||||||
import club.joylink.rtss.iscs.entity.IscsModelData;
|
import club.joylink.rtss.iscs.entity.IscsModelData;
|
||||||
|
import club.joylink.rtss.iscs.memory.model.ModelMemory;
|
||||||
|
import club.joylink.rtss.iscs.memory.model.ModelMemoryId;
|
||||||
import com.google.protobuf.InvalidProtocolBufferException;
|
import com.google.protobuf.InvalidProtocolBufferException;
|
||||||
|
|
||||||
public class PageDataModelConvertor {
|
public class PageDataModelConvertor {
|
||||||
|
|
||||||
public static PageDataModelProto.PageDataModel.Builder convertFrom(IscsModelData from){
|
public static PageDataModelProto.PageDataModel.Builder convertFrom(IscsModelData from) {
|
||||||
final PageDataModelProto.PageDataModel.Builder rt = PageDataModelProto.PageDataModel.newBuilder();
|
final PageDataModelProto.PageDataModel.Builder rt = PageDataModelProto.PageDataModel.newBuilder();
|
||||||
rt.setId(from.getId());
|
rt.setId(from.getId());
|
||||||
rt.setSystem(from.getSystem());
|
rt.setSystem(from.getSystem());
|
||||||
@ -20,4 +22,15 @@ public class PageDataModelConvertor {
|
|||||||
}
|
}
|
||||||
return rt;
|
return rt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static PageDataModelProto.PageDataModel.Builder convertFrom(ModelMemory from) {
|
||||||
|
final PageDataModelProto.PageDataModel.Builder rt = PageDataModelProto.PageDataModel.newBuilder();
|
||||||
|
final ModelMemoryId mmId = from.mmId();
|
||||||
|
rt.setId(mmId.getId());
|
||||||
|
rt.setSystem(mmId.getSystem());
|
||||||
|
rt.setView(mmId.getView());
|
||||||
|
rt.setPlace(mmId.getPlace());
|
||||||
|
rt.setContent(from.allDataModels());
|
||||||
|
return rt;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package club.joylink.rtss.iscs.memory;
|
|||||||
|
|
||||||
import club.joylink.iscs.model.data.PageDataModelProto.PageDataModel;
|
import club.joylink.iscs.model.data.PageDataModelProto.PageDataModel;
|
||||||
import club.joylink.iscs.model.status.soe.SoeProto;
|
import club.joylink.iscs.model.status.soe.SoeProto;
|
||||||
|
import club.joylink.rtss.iscs.convert.PageDataModelConvertor;
|
||||||
import club.joylink.rtss.iscs.entity.IscsModelData;
|
import club.joylink.rtss.iscs.entity.IscsModelData;
|
||||||
import club.joylink.rtss.iscs.memory.model.ModelMemory;
|
import club.joylink.rtss.iscs.memory.model.ModelMemory;
|
||||||
import club.joylink.rtss.iscs.memory.model.ModelMemoryId;
|
import club.joylink.rtss.iscs.memory.model.ModelMemoryId;
|
||||||
@ -28,6 +29,7 @@ public class MemoryManager {
|
|||||||
private LinkedList<SoeProto.AlarmEvent.Builder> alarmEvents = new LinkedList<>();
|
private LinkedList<SoeProto.AlarmEvent.Builder> alarmEvents = new LinkedList<>();
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加从数据库加载的页面模型数据
|
* 添加从数据库加载的页面模型数据
|
||||||
*/
|
*/
|
||||||
@ -42,14 +44,7 @@ public class MemoryManager {
|
|||||||
public PageDataModel.Builder getModelData(String system, String view, String place) {
|
public PageDataModel.Builder getModelData(String system, String view, String place) {
|
||||||
final ModelMemory modelMemory = modelMemories.get(new ModelMemoryId(system, view, place));
|
final ModelMemory modelMemory = modelMemories.get(new ModelMemoryId(system, view, place));
|
||||||
if (null != modelMemory) {
|
if (null != modelMemory) {
|
||||||
final PageDataModel.Builder rt = PageDataModel.newBuilder();
|
return PageDataModelConvertor.convertFrom(modelMemory);
|
||||||
final ModelMemoryId mmId = modelMemory.mmId();
|
|
||||||
rt.setId(mmId.getId());
|
|
||||||
rt.setSystem(mmId.getSystem());
|
|
||||||
rt.setView(mmId.getView());
|
|
||||||
rt.setPlace(mmId.getPlace());
|
|
||||||
rt.setContent(modelMemory.allDataModels());
|
|
||||||
return rt;
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user