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));