iscs v2
This commit is contained in:
parent
a3deb1b327
commit
71e2b20935
@ -3,6 +3,8 @@ package club.joylink.rtss.iscs.convert;
|
||||
import club.joylink.iscs.model.data.DataModelMapProto;
|
||||
import club.joylink.iscs.model.data.PageDataModelProto;
|
||||
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;
|
||||
|
||||
public class PageDataModelConvertor {
|
||||
@ -20,4 +22,15 @@ public class PageDataModelConvertor {
|
||||
}
|
||||
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.status.soe.SoeProto;
|
||||
import club.joylink.rtss.iscs.convert.PageDataModelConvertor;
|
||||
import club.joylink.rtss.iscs.entity.IscsModelData;
|
||||
import club.joylink.rtss.iscs.memory.model.ModelMemory;
|
||||
import club.joylink.rtss.iscs.memory.model.ModelMemoryId;
|
||||
@ -28,6 +29,7 @@ public class MemoryManager {
|
||||
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) {
|
||||
final ModelMemory modelMemory = modelMemories.get(new ModelMemoryId(system, view, place));
|
||||
if (null != modelMemory) {
|
||||
final PageDataModel.Builder rt = PageDataModel.newBuilder();
|
||||
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 PageDataModelConvertor.convertFrom(modelMemory);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user