From 04a74fe82c78687aa9a0a1eedaec422daed2ad45 Mon Sep 17 00:00:00 2001 From: Melvin Date: Fri, 10 Feb 2017 18:11:45 +0900 Subject: [PATCH] =?UTF-8?q?ContextModel=20=EC=A1=B0=ED=9A=8C=EC=8B=9C=20?= =?UTF-8?q?=EC=A0=95=EB=A0=AC=EB=B0=A9=EC=8B=9D=20=EC=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../icbms/so/contextmodel/entity/ContextModel.java | 14 +++++++------- .../contextmodel/logic/ContextModelLogicImpl.java | 5 +++++ .../store/mongo/ContextModelStoreMongoImpl.java | 3 ++- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/so-contextmodel/src/main/java/com/pineone/icbms/so/contextmodel/entity/ContextModel.java b/so-contextmodel/src/main/java/com/pineone/icbms/so/contextmodel/entity/ContextModel.java index 6238a584..a6f78966 100644 --- a/so-contextmodel/src/main/java/com/pineone/icbms/so/contextmodel/entity/ContextModel.java +++ b/so-contextmodel/src/main/java/com/pineone/icbms/so/contextmodel/entity/ContextModel.java @@ -13,8 +13,8 @@ public class ContextModel { private List domainIdList; private List contextInformationIdList; private String contextType; - private String createTime; - private String modifiedTime; + private long createTime; + private long modifiedTime; private String occTime; public ContextModel() { @@ -35,7 +35,7 @@ public ContextModel(String id, String name, List domainIdList, List domainIdList, List contextInformationIdList, String contextType, String createTime, String modifiedTime) { + public ContextModel(String id, String name, List domainIdList, List contextInformationIdList, String contextType, long createTime, long modifiedTime) { this.id = id; this.name = name; this.domainIdList = domainIdList; @@ -85,19 +85,19 @@ public void setContextType(String contextType) { this.contextType = contextType; } - public String getCreateTime() { + public long getCreateTime() { return createTime; } - public void setCreateTime(String createTime) { + public void setCreateTime(long createTime) { this.createTime = createTime; } - public String getModifiedTime() { + public long getModifiedTime() { return modifiedTime; } - public void setModifiedTime(String modifiedTime) { + public void setModifiedTime(long modifiedTime) { this.modifiedTime = modifiedTime; } diff --git a/so-contextmodel/src/main/java/com/pineone/icbms/so/contextmodel/logic/ContextModelLogicImpl.java b/so-contextmodel/src/main/java/com/pineone/icbms/so/contextmodel/logic/ContextModelLogicImpl.java index 4000559e..acbefc74 100644 --- a/so-contextmodel/src/main/java/com/pineone/icbms/so/contextmodel/logic/ContextModelLogicImpl.java +++ b/so-contextmodel/src/main/java/com/pineone/icbms/so/contextmodel/logic/ContextModelLogicImpl.java @@ -68,6 +68,11 @@ public String registerContextModel(ContextModel contextModel){ // ContextModelStore contextModelStore = ContextModelMapStore.getInstance(); //ContextModelExProxy contextModelExProxy = ContextModelSDAProxy.newContextModelProxy(); + + long time = System.currentTimeMillis(); + contextModel.setCreateTime(time); + contextModel.setModifiedTime(time); + contextModelStore.createContextModel(contextModel); //contextModelExProxy.registerContextModel(contextModel); String contextModelResultMessage = responseMessage.contextModelResultMessage(contextModel); diff --git a/so-contextmodel/src/main/java/com/pineone/icbms/so/contextmodel/store/mongo/ContextModelStoreMongoImpl.java b/so-contextmodel/src/main/java/com/pineone/icbms/so/contextmodel/store/mongo/ContextModelStoreMongoImpl.java index e1c8d315..15dbb827 100644 --- a/so-contextmodel/src/main/java/com/pineone/icbms/so/contextmodel/store/mongo/ContextModelStoreMongoImpl.java +++ b/so-contextmodel/src/main/java/com/pineone/icbms/so/contextmodel/store/mongo/ContextModelStoreMongoImpl.java @@ -5,6 +5,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Sort; import org.springframework.stereotype.Repository; import java.util.ArrayList; @@ -34,7 +35,7 @@ public void createContextModel(ContextModel contextModel) { //NOTE: CM 리스트 조회 @Override public List retrieveContextModelList() { - List contextModelDataObjectList = contextModelRepository.findAll(); + List contextModelDataObjectList = contextModelRepository.findAll(new Sort(Sort.Direction.DESC,"createTime")); List contextModelList = new ArrayList<>(); for(ContextModelDataObject contextModelDataObject : contextModelDataObjectList){ logger.debug("ContextModel = " + dataObjectToContextModel(contextModelDataObject));