From f259f7fc5dd6fdda875e9fed1f25dbc7eb22cbbb Mon Sep 17 00:00:00 2001 From: pahnjy Date: Wed, 30 Nov 2016 15:14:40 +0900 Subject: [PATCH] =?UTF-8?q?Mongo=20DB=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20=EB=B0=8F=20=EC=86=8C=EC=8A=A4=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20#281?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../generalobject/GeneralObjectCreator.java | 3 +-- .../virtualobject/VirtualObjectCreator.java | 2 +- .../pineone/icbms/so/device/entity/Device.java | 16 ++++++++-------- .../so/device/entity/DeviceTransFormObject.java | 16 ++++++++-------- .../so/device/logic/DeviceManagerLogic.java | 2 +- .../icbms/so/device/pr/DevicePresentation.java | 10 +++++----- .../so/device/store/memory/DeviceMemory.java | 4 ++-- .../so/device/store/mongo/DeviceDataObject.java | 12 ++++++------ .../so/device/store/mongo/DeviceMongoStore.java | 6 +++--- .../so/device/store/mongo/DeviceRepository.java | 2 -- .../so/device/pr/DevicePresentationTest.java | 4 ++-- .../so/device/proxy/DeviceSDAProxyTest.java | 4 ++-- .../icbms/so/service/logic/ServiceLogicImpl.java | 4 ++-- .../logic/ServiceModelLogicImpl.java | 5 +++++ .../so/virtualobject/entity/VirtualObject.java | 16 ++++++++-------- .../entity/VirtualObjectTransFormObject.java | 16 ++++++++-------- .../logic/VirtualObjectManagerLogic.java | 4 ++-- .../pr/VirtualObjectPresentation.java | 12 ++++++------ .../store/memory/VirtualObjectMemory.java | 4 ++-- .../store/mongo/VirtualObjectDataObject.java | 16 ++++++++-------- .../store/mongo/VirtualObjectMongoStore.java | 6 +++--- .../store/mongo/VirtualObjectRepostory.java | 1 - .../pr/VirtualObjectPresentationTest.java | 4 ++-- 23 files changed, 85 insertions(+), 84 deletions(-) diff --git a/so-creator/src/main/java/com/pineone/icbms/so/creator/generalobject/GeneralObjectCreator.java b/so-creator/src/main/java/com/pineone/icbms/so/creator/generalobject/GeneralObjectCreator.java index 36491d07..4391f5bd 100644 --- a/so-creator/src/main/java/com/pineone/icbms/so/creator/generalobject/GeneralObjectCreator.java +++ b/so-creator/src/main/java/com/pineone/icbms/so/creator/generalobject/GeneralObjectCreator.java @@ -2,7 +2,6 @@ import com.pineone.icbms.so.compositevo.entity.CompositeVirtualObject; import com.pineone.icbms.so.compositevo.pr.CompositeVirtualObjectPresentation; -import com.pineone.icbms.so.service.entity.Service; import com.pineone.icbms.so.virtualobject.entity.VirtualObject; import com.pineone.icbms.so.virtualobject.pr.VirtualObjectPresentation; import org.springframework.beans.factory.annotation.Autowired; @@ -36,7 +35,7 @@ public List retrieveGeneralObjectIdList() { List compositeVirtualObjectList = compositeVirtualObjectPresentation.findCompositeVirtualObjectList(); for (VirtualObject virtualObject : virtualObjectList) { - generalObjectIdList.add(virtualObject.getVoId()); + generalObjectIdList.add(virtualObject.getId()); } for (CompositeVirtualObject compositeVirtualObject : compositeVirtualObjectList) { generalObjectIdList.add(compositeVirtualObject.getId()); diff --git a/so-creator/src/main/java/com/pineone/icbms/so/creator/virtualobject/VirtualObjectCreator.java b/so-creator/src/main/java/com/pineone/icbms/so/creator/virtualobject/VirtualObjectCreator.java index e0c3bfd2..6ee5b391 100644 --- a/so-creator/src/main/java/com/pineone/icbms/so/creator/virtualobject/VirtualObjectCreator.java +++ b/so-creator/src/main/java/com/pineone/icbms/so/creator/virtualobject/VirtualObjectCreator.java @@ -32,7 +32,7 @@ public List retrieveVirtualObjectIdList(){ List voIdList = new ArrayList<>(); List virtualObjectList = virtualObjectPresentation.searchVirtualObjectList(); for(VirtualObject virtualObject : virtualObjectList){ - voIdList.add(virtualObject.getVoId()); + voIdList.add(virtualObject.getId()); } return voIdList; } diff --git a/so-device/src/main/java/com/pineone/icbms/so/device/entity/Device.java b/so-device/src/main/java/com/pineone/icbms/so/device/entity/Device.java index 1501ca38..853b8d62 100644 --- a/so-device/src/main/java/com/pineone/icbms/so/device/entity/Device.java +++ b/so-device/src/main/java/com/pineone/icbms/so/device/entity/Device.java @@ -11,7 +11,7 @@ public class Device { * format : CSE relative uri * ex) /herit-in/herit-cse/ONDB_BeamProjector01_001 */ - private String deviceId; + private String id; /** * Device의 이름 @@ -72,8 +72,8 @@ public class Device { public Device() { } - public Device(String deviceId, String deviceName, String deviceLocation, String deviceUri, List deviceCommand, List deviceServices, long deviceCreateTime, long deviceExfiredTime, String deviceStatus) { - this.deviceId = deviceId; + public Device(String id, String deviceName, String deviceLocation, String deviceUri, List deviceCommand, List deviceServices, long deviceCreateTime, long deviceExfiredTime, String deviceStatus) { + this.id = id; this.deviceName = deviceName; this.deviceLocation = deviceLocation; this.deviceUri = deviceUri; @@ -84,12 +84,12 @@ public Device(String deviceId, String deviceName, String deviceLocation, String this.deviceStatus = deviceStatus; } - public String getDeviceId() { - return deviceId; + public String getId() { + return id; } - public void setDeviceId(String deviceId) { - this.deviceId = deviceId; + public void setId(String id) { + this.id = id; } public String getDeviceName() { @@ -163,7 +163,7 @@ public boolean checkStatus(String status){ @Override public String toString() { return "Device{" + - "deviceId='" + deviceId + '\'' + + "id='" + id + '\'' + ", deviceName='" + deviceName + '\'' + ", deviceLocation='" + deviceLocation + '\'' + ", deviceUri='" + deviceUri + '\'' + diff --git a/so-device/src/main/java/com/pineone/icbms/so/device/entity/DeviceTransFormObject.java b/so-device/src/main/java/com/pineone/icbms/so/device/entity/DeviceTransFormObject.java index 06191d42..e2bb3e19 100644 --- a/so-device/src/main/java/com/pineone/icbms/so/device/entity/DeviceTransFormObject.java +++ b/so-device/src/main/java/com/pineone/icbms/so/device/entity/DeviceTransFormObject.java @@ -2,7 +2,7 @@ public class DeviceTransFormObject { - private String deviceId; + private String id; private String deviceName; private String deviceLocation; private String deviceUri; @@ -14,8 +14,8 @@ public class DeviceTransFormObject { public DeviceTransFormObject() { } - public DeviceTransFormObject(String deviceId, String deviceName, String deviceLocation, String deviceUri, String deviceCommand, String deviceServices, String deviceStatus, String sessionId) { - this.deviceId = deviceId; + public DeviceTransFormObject(String id, String deviceName, String deviceLocation, String deviceUri, String deviceCommand, String deviceServices, String deviceStatus, String sessionId) { + this.id = id; this.deviceName = deviceName; this.deviceLocation = deviceLocation; this.deviceUri = deviceUri; @@ -25,12 +25,12 @@ public DeviceTransFormObject(String deviceId, String deviceName, String deviceLo this.sessionId = sessionId; } - public String getDeviceId() { - return deviceId; + public String getId() { + return id; } - public void setDeviceId(String deviceId) { - this.deviceId = deviceId; + public void setId(String id) { + this.id = id; } public String getDeviceName() { @@ -92,7 +92,7 @@ public void setSessionId(String sessionId) { @Override public String toString() { return "DeviceTransFormObject{" + - "deviceId='" + deviceId + '\'' + + "id='" + id + '\'' + ", deviceName='" + deviceName + '\'' + ", deviceLocation='" + deviceLocation + '\'' + ", deviceUri='" + deviceUri + '\'' + diff --git a/so-device/src/main/java/com/pineone/icbms/so/device/logic/DeviceManagerLogic.java b/so-device/src/main/java/com/pineone/icbms/so/device/logic/DeviceManagerLogic.java index 30200334..e2e3e14b 100644 --- a/so-device/src/main/java/com/pineone/icbms/so/device/logic/DeviceManagerLogic.java +++ b/so-device/src/main/java/com/pineone/icbms/so/device/logic/DeviceManagerLogic.java @@ -297,7 +297,7 @@ private void deviceCreate(Device device){ long currentTime = System.currentTimeMillis(); long modifiedTime = currentTime + 30240000000L; - device.setDeviceId(DEVICE_PRE + UUID.randomUUID().toString()); + device.setId(DEVICE_PRE + UUID.randomUUID().toString()); device.setDeviceCreateTime(currentTime); device.setDeviceExfiredTime(modifiedTime); // TODO : Device Command는 언제 요청으로 얻어 올까?? diff --git a/so-device/src/main/java/com/pineone/icbms/so/device/pr/DevicePresentation.java b/so-device/src/main/java/com/pineone/icbms/so/device/pr/DevicePresentation.java index 3d1800d9..abb3e252 100644 --- a/so-device/src/main/java/com/pineone/icbms/so/device/pr/DevicePresentation.java +++ b/so-device/src/main/java/com/pineone/icbms/so/device/pr/DevicePresentation.java @@ -43,9 +43,9 @@ public String deviceControl(@RequestBody DeviceTransFormObject deviceTransFormOb // NOTE : Device Control logger.info("<================ Device Control Start ================>"); - logger.debug(LogPrint.LogMethodNamePrint() + " | Device ID = " + deviceTransFormObject.getDeviceId() + " , DeviceCommand = " + deviceTransFormObject.getDeviceCommand() + " , Session ID = " + deviceTransFormObject.getSessionId()); + logger.debug(LogPrint.LogMethodNamePrint() + " | Device ID = " + deviceTransFormObject.getId() + " , DeviceCommand = " + deviceTransFormObject.getDeviceCommand() + " , Session ID = " + deviceTransFormObject.getSessionId()); - String result = deviceManager.deviceExecute(deviceTransFormObject.getDeviceId(), deviceTransFormObject.getDeviceCommand(), deviceTransFormObject.getSessionId()); + String result = deviceManager.deviceExecute(deviceTransFormObject.getId(), deviceTransFormObject.getDeviceCommand(), deviceTransFormObject.getSessionId()); logger.debug(LogPrint.LogMethodNamePrint() + " | Result = " + result); logger.info("<================ Device Control End ================>"); return result; @@ -151,9 +151,9 @@ public String asynchronousControlResult(@RequestBody ResultMessage message){ @RequestMapping(value ="/operation",method = RequestMethod.POST) @ResponseStatus(value = HttpStatus.OK) public String findDeviceOperation(@RequestBody DeviceTransFormObject deviceTransFormObject){ - logger.info(LogPrint.inputInfoLogPrint() + "Device ID = " + deviceTransFormObject.getDeviceId()); + logger.info(LogPrint.inputInfoLogPrint() + "Device ID = " + deviceTransFormObject.getId()); logger.debug("Device = " + deviceTransFormObject.toString()); - return deviceManager.searchOperation(deviceTransFormObject.getDeviceId(), deviceTransFormObject.getDeviceServices()); + return deviceManager.searchOperation(deviceTransFormObject.getId(), deviceTransFormObject.getDeviceServices()); } /** @@ -170,7 +170,7 @@ public void updateDeviceStatus(@RequestBody DeviceStatusData deviceStatusData){ public DeviceTransFormObject settingDeviceRequestData(String deviceid, String command, String sessionId){ DeviceTransFormObject object = new DeviceTransFormObject(); - object.setDeviceId(deviceid); + object.setId(deviceid); object.setDeviceCommand(command); object.setSessionId(sessionId); return object; diff --git a/so-device/src/main/java/com/pineone/icbms/so/device/store/memory/DeviceMemory.java b/so-device/src/main/java/com/pineone/icbms/so/device/store/memory/DeviceMemory.java index 41fac9f3..25767eb5 100644 --- a/so-device/src/main/java/com/pineone/icbms/so/device/store/memory/DeviceMemory.java +++ b/so-device/src/main/java/com/pineone/icbms/so/device/store/memory/DeviceMemory.java @@ -25,7 +25,7 @@ public static DeviceMemory getInstance(){ public void create(Device device) { // - deviceRepository.put(device.getDeviceId(),device); + deviceRepository.put(device.getId(),device); } public Device retrieveByID(String id) { @@ -49,7 +49,7 @@ public List retrieveDeviceService(String location) { public void update(Device device) { // - deviceRepository.put(device.getDeviceId(),device); + deviceRepository.put(device.getId(),device); } public void delete(String id) { diff --git a/so-device/src/main/java/com/pineone/icbms/so/device/store/mongo/DeviceDataObject.java b/so-device/src/main/java/com/pineone/icbms/so/device/store/mongo/DeviceDataObject.java index 0d931b66..25e20f11 100644 --- a/so-device/src/main/java/com/pineone/icbms/so/device/store/mongo/DeviceDataObject.java +++ b/so-device/src/main/java/com/pineone/icbms/so/device/store/mongo/DeviceDataObject.java @@ -7,7 +7,7 @@ @Document(collection = "Device") public class DeviceDataObject { - private String deviceId; + private String id; private String deviceName; private String deviceLocation; private String deviceUri; @@ -20,8 +20,8 @@ public class DeviceDataObject { public DeviceDataObject() { } - public DeviceDataObject(String deviceId, String deviceName, String deviceLocation, String deviceUri, List deviceCommand, List deviceServices, long deviceCreateTime, long deviceExfiredTime, String deviceStatus) { - this.deviceId = deviceId; + public DeviceDataObject(String id, String deviceName, String deviceLocation, String deviceUri, List deviceCommand, List deviceServices, long deviceCreateTime, long deviceExfiredTime, String deviceStatus) { + this.id = id; this.deviceName = deviceName; this.deviceLocation = deviceLocation; this.deviceUri = deviceUri; @@ -32,8 +32,8 @@ public DeviceDataObject(String deviceId, String deviceName, String deviceLocatio this.deviceStatus = deviceStatus; } - public String getDeviceId() { - return deviceId; + public String getId() { + return id; } public String getDeviceName() { @@ -71,7 +71,7 @@ public String getDeviceStatus() { @Override public String toString() { return "DeviceDataObject{" + - "deviceId='" + deviceId + '\'' + + "id='" + id + '\'' + ", deviceName='" + deviceName + '\'' + ", deviceLocation='" + deviceLocation + '\'' + ", deviceUri='" + deviceUri + '\'' + diff --git a/so-device/src/main/java/com/pineone/icbms/so/device/store/mongo/DeviceMongoStore.java b/so-device/src/main/java/com/pineone/icbms/so/device/store/mongo/DeviceMongoStore.java index 022813a4..ea454709 100644 --- a/so-device/src/main/java/com/pineone/icbms/so/device/store/mongo/DeviceMongoStore.java +++ b/so-device/src/main/java/com/pineone/icbms/so/device/store/mongo/DeviceMongoStore.java @@ -41,7 +41,7 @@ public void create(Device device) { @Override public Device retrieveByID(String id) { logger.debug("Device ID = " + id); - DeviceDataObject d = deviceRepository.findBydeviceId(id); + DeviceDataObject d = deviceRepository.findOne(id); Device device = DeviceObjectToDevice(d); logger.debug("Device = " + device.toString()); return device; @@ -100,12 +100,12 @@ public void delete(String id) { private DeviceDataObject deviceToDataObject(Device device){ if(device == null) return null; - return new DeviceDataObject(device.getDeviceId(),device.getDeviceName(),device.getDeviceLocation(),device.getDeviceUri(),device.getDeviceCommand(),device.getDeviceServices(),device.getDeviceCreateTime(),device.getDeviceExfiredTime(),device.getDeviceStatus()); + return new DeviceDataObject(device.getId(),device.getDeviceName(),device.getDeviceLocation(),device.getDeviceUri(),device.getDeviceCommand(),device.getDeviceServices(),device.getDeviceCreateTime(),device.getDeviceExfiredTime(),device.getDeviceStatus()); } private Device DeviceObjectToDevice(DeviceDataObject deviceDataObject) { if(deviceDataObject == null) return null; - return new Device(deviceDataObject.getDeviceId(),deviceDataObject.getDeviceName(),deviceDataObject.getDeviceLocation(),deviceDataObject.getDeviceUri(),deviceDataObject.getDeviceCommand(),deviceDataObject.getDeviceServices(),deviceDataObject.getDeviceCreateTime(),deviceDataObject.getDeviceExfiredTime(),deviceDataObject.getDeviceStatus()); + return new Device(deviceDataObject.getId(),deviceDataObject.getDeviceName(),deviceDataObject.getDeviceLocation(),deviceDataObject.getDeviceUri(),deviceDataObject.getDeviceCommand(),deviceDataObject.getDeviceServices(),deviceDataObject.getDeviceCreateTime(),deviceDataObject.getDeviceExfiredTime(),deviceDataObject.getDeviceStatus()); } } diff --git a/so-device/src/main/java/com/pineone/icbms/so/device/store/mongo/DeviceRepository.java b/so-device/src/main/java/com/pineone/icbms/so/device/store/mongo/DeviceRepository.java index 2df103b7..49acc23d 100644 --- a/so-device/src/main/java/com/pineone/icbms/so/device/store/mongo/DeviceRepository.java +++ b/so-device/src/main/java/com/pineone/icbms/so/device/store/mongo/DeviceRepository.java @@ -7,6 +7,4 @@ public interface DeviceRepository extends MongoRepository { List findBydeviceLocation(String deviceLocation); - DeviceDataObject findBydeviceId(String deviceId); - } diff --git a/so-device/src/test/java/com/pineone/icbms/so/device/pr/DevicePresentationTest.java b/so-device/src/test/java/com/pineone/icbms/so/device/pr/DevicePresentationTest.java index 880b9025..2818e759 100644 --- a/so-device/src/test/java/com/pineone/icbms/so/device/pr/DevicePresentationTest.java +++ b/so-device/src/test/java/com/pineone/icbms/so/device/pr/DevicePresentationTest.java @@ -74,11 +74,11 @@ public void asynchronousControlResultTest(){ public void deviceDisableNotificationTest(){ // deviceReleaseMessage deviceReleaseMessage = new deviceReleaseMessage(); - deviceReleaseMessage.setDeviceId("JuintTestDeviceDisable001"); + deviceReleaseMessage.setId("JuintTestDeviceDisable001"); deviceReleaseMessage.setRegisterTime("20160808T153028"); devicePresentation.deviceDisableNotification(deviceReleaseMessage); - Device device = deviceStore.retrieveByID(deviceReleaseMessage.getDeviceId()); + Device device = deviceStore.retrieveByID(deviceReleaseMessage.getId()); Assert.assertNull(device); diff --git a/so-device/src/test/java/com/pineone/icbms/so/device/proxy/DeviceSDAProxyTest.java b/so-device/src/test/java/com/pineone/icbms/so/device/proxy/DeviceSDAProxyTest.java index 31bfad73..d93cc78e 100644 --- a/so-device/src/test/java/com/pineone/icbms/so/device/proxy/DeviceSDAProxyTest.java +++ b/so-device/src/test/java/com/pineone/icbms/so/device/proxy/DeviceSDAProxyTest.java @@ -40,7 +40,7 @@ public void findDeviceByIDTest(){ Device device = new Device(); Device deviceTest = new Device(); deviceTest.setDeviceName("JunitTestDevice"); - deviceTest.setDeviceId("deviceT001"); + deviceTest.setId("deviceT001"); when(deviceSDAProxy.findDeviceByID(ClientProfile.SDA_DATAREQUEST_URI + "device/deviceT001")).thenReturn(deviceTest); device = deviceSDAProxy.findDeviceByID(ClientProfile.SDA_DATAREQUEST_URI + "device/deviceT001"); @@ -53,7 +53,7 @@ public void findDeviceByDomainTest(){ List deviceTestList = new ArrayList<>(); Device deviceTemp = new Device(); deviceTemp.setDeviceName("JunitTestDevice"); - deviceTemp.setDeviceId("deviceT001"); + deviceTemp.setId("deviceT001"); deviceTestList.add(deviceTemp); when(deviceSDAProxy.findDeviceByDomain(ClientProfile.SDA_DATAREQUEST_URI + "device/")).thenReturn(deviceTestList); diff --git a/so-service/src/main/java/com/pineone/icbms/so/service/logic/ServiceLogicImpl.java b/so-service/src/main/java/com/pineone/icbms/so/service/logic/ServiceLogicImpl.java index df208853..f850d1fd 100644 --- a/so-service/src/main/java/com/pineone/icbms/so/service/logic/ServiceLogicImpl.java +++ b/so-service/src/main/java/com/pineone/icbms/so/service/logic/ServiceLogicImpl.java @@ -186,7 +186,7 @@ public void executeService(String serviceId, String sessionId) { VirtualObject virtualObject = serviceProxy.findVirtualObject(virtualObjectId); - if(virtualObject != null && "vo-lack-equipment".equals(virtualObject.getVoId())){ + if(virtualObject != null && "vo-lack-equipment".equals(virtualObject.getId())){ // admin-noti에 따른 추가 적인 로직 적용. // PC 부족 알림 // 마우스 부족 알림 @@ -209,7 +209,7 @@ public void executeService(String serviceId, String sessionId) { } } else { VirtualObject virtualObject = serviceProxy.findVirtualObject(virtualObjectId); - if(virtualObject != null && "vo-lack-equipment".equals(virtualObject.getVoId())){ + if(virtualObject != null && "vo-lack-equipment".equals(virtualObject.getId())){ String operation = ""; try { operation = serviceSDAProxy.getPCCountUri(session); diff --git a/so-servicemodel/src/main/java/com/pineone/icbms/so/servicemodel/logic/ServiceModelLogicImpl.java b/so-servicemodel/src/main/java/com/pineone/icbms/so/servicemodel/logic/ServiceModelLogicImpl.java index 40089f6c..b674bbe9 100644 --- a/so-servicemodel/src/main/java/com/pineone/icbms/so/servicemodel/logic/ServiceModelLogicImpl.java +++ b/so-servicemodel/src/main/java/com/pineone/icbms/so/servicemodel/logic/ServiceModelLogicImpl.java @@ -179,6 +179,11 @@ private boolean locationCompare(Session session, String serviceModelLocation){ List contextLocation = null; if(session.isExistSessionData(DefaultSession.LOCATION_ID)){ contextLocation = DataConversion.stringDataToList(session.findSessionData(DefaultSession.LOCATION_ID)); + } else { + /** + * 외부 요청으로 인한 Session의 Location이 null일 경우 ServiceModel의 Location 비교는 무시한다. + */ + return true; } if(contextLocation == null){ diff --git a/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/entity/VirtualObject.java b/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/entity/VirtualObject.java index fe0eb140..b9912412 100644 --- a/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/entity/VirtualObject.java +++ b/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/entity/VirtualObject.java @@ -17,7 +17,7 @@ public class VirtualObject { * format : vo-(devicename)-(service) * ex) vo-smartlight01-001-power-control */ - private String voId; + private String id; /** * VirtualObject 이름 @@ -86,8 +86,8 @@ public class VirtualObject { public VirtualObject() { } - public VirtualObject(String voId, String voName, String functionality, String voDescription, String voCreateTime, String voExpiredTime, String deviceService, String deviceId, String voCommand, String voLocation) { - this.voId = voId; + public VirtualObject(String id, String voName, String functionality, String voDescription, String voCreateTime, String voExpiredTime, String deviceService, String deviceId, String voCommand, String voLocation) { + this.id = id; this.voName = voName; this.functionality = functionality; this.voDescription = voDescription; @@ -99,12 +99,12 @@ public VirtualObject(String voId, String voName, String functionality, String vo this.voLocation = voLocation; } - public String getVoId() { - return voId; + public String getId() { + return id; } - public void setVoId(String voId) { - this.voId = voId; + public void setId(String id) { + this.id = id; } public String getVoName() { @@ -182,7 +182,7 @@ public void setVoLocation(String voLocation) { @Override public String toString() { return "VirtualObject{" + - "voId='" + voId + '\'' + + "id='" + id + '\'' + ", voName='" + voName + '\'' + ", functionality='" + functionality + '\'' + ", voDescription='" + voDescription + '\'' + diff --git a/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/entity/VirtualObjectTransFormObject.java b/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/entity/VirtualObjectTransFormObject.java index 0f125842..decae514 100644 --- a/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/entity/VirtualObjectTransFormObject.java +++ b/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/entity/VirtualObjectTransFormObject.java @@ -2,7 +2,7 @@ public class VirtualObjectTransFormObject { - private String voId; + private String id; private String voName; private String functionality; private String voDescription; @@ -18,8 +18,8 @@ public class VirtualObjectTransFormObject { public VirtualObjectTransFormObject() { } - public VirtualObjectTransFormObject(String voId, String voName, String functionality, String voDescription, String voCreateTime, String voExpiredTime, String deviceService, String deviceId, String voCommand, String voLocation, String sessionId) { - this.voId = voId; + public VirtualObjectTransFormObject(String id, String voName, String functionality, String voDescription, String voCreateTime, String voExpiredTime, String deviceService, String deviceId, String voCommand, String voLocation, String sessionId) { + this.id = id; this.voName = voName; this.functionality = functionality; this.voDescription = voDescription; @@ -32,12 +32,12 @@ public VirtualObjectTransFormObject(String voId, String voName, String functiona this.sessionId = sessionId; } - public String getVoId() { - return voId; + public String getId() { + return id; } - public void setVoId(String voId) { - this.voId = voId; + public void setId(String id) { + this.id = id; } public String getVoName() { @@ -123,7 +123,7 @@ public void setSessionId(String sessionId) { @Override public String toString() { return "VirtualObjectTransFormObject{" + - "voId='" + voId + '\'' + + "id='" + id + '\'' + ", voName='" + voName + '\'' + ", functionality='" + functionality + '\'' + ", voDescription='" + voDescription + '\'' + diff --git a/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/logic/VirtualObjectManagerLogic.java b/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/logic/VirtualObjectManagerLogic.java index e6e429fe..00610802 100644 --- a/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/logic/VirtualObjectManagerLogic.java +++ b/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/logic/VirtualObjectManagerLogic.java @@ -155,8 +155,8 @@ public String controlDevice(List serviceControls) { List virtualObjects = virtualObjectStore.retrieveByLocationAndService(control.getDomain(),control.getFunctionality()); // DB에서 조회된 VO 실행. for(VirtualObject vo : virtualObjects){ - logger.debug("VirtualObject ID = " + vo.getVoId() + " Device ID = " + vo.getDeviceId() + " Operation = " + vo.getVoCommand()); - deviceManager.deviceExecute(vo.getDeviceId(),control.getOperation()); + logger.debug("VirtualObject ID = " + vo.getId() + " Device ID = " + vo.getId() + " Operation = " + vo.getVoCommand()); + deviceManager.deviceExecute(vo.getId(),control.getOperation()); } } diff --git a/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/pr/VirtualObjectPresentation.java b/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/pr/VirtualObjectPresentation.java index 485317e0..23e3781e 100644 --- a/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/pr/VirtualObjectPresentation.java +++ b/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/pr/VirtualObjectPresentation.java @@ -44,7 +44,7 @@ public void createVirtualObject(@RequestBody VirtualObjectTransFormObject virtul public String requestControlVirtualObject(@RequestBody VirtualObjectTransFormObject virtualObjectTransFormObject){ logger.info(LogPrint.inputInfoLogPrint()); // - return virtualObjectManager.requestControlDevice(virtualObjectTransFormObject.getVoId(), virtualObjectTransFormObject.getVoCommand(), virtualObjectTransFormObject.getSessionId()); + return virtualObjectManager.requestControlDevice(virtualObjectTransFormObject.getId(), virtualObjectTransFormObject.getVoCommand(), virtualObjectTransFormObject.getSessionId()); } /* @@ -89,17 +89,17 @@ public void deleteVirtualObject(@PathVariable String id){ private VirtualObject virtualObjectMapping(VirtualObjectTransFormObject virtualObjectDataObject) { if(virtualObjectDataObject == null)return null; - VirtualObject virtualObject = new VirtualObject(virtualObjectDataObject.getVoId(),virtualObjectDataObject.getVoName(),virtualObjectDataObject.getFunctionality(),virtualObjectDataObject.getVoDescription(),virtualObjectDataObject.getVoCreateTime(),virtualObjectDataObject.getVoExpiredTime(),virtualObjectDataObject.getDeviceService(),virtualObjectDataObject.getDeviceId(),virtualObjectDataObject.getVoCommand(),virtualObjectDataObject.getVoLocation()); - if(!virtualObject.getVoId().startsWith(VirtualObjectProfile.VIRTUALOBJECT_ID)){ - String voId = virtualObject.getVoId(); - virtualObject.setVoId(VirtualObjectProfile.VIRTUALOBJECT_ID + voId); + VirtualObject virtualObject = new VirtualObject(virtualObjectDataObject.getId(),virtualObjectDataObject.getVoName(),virtualObjectDataObject.getFunctionality(),virtualObjectDataObject.getVoDescription(),virtualObjectDataObject.getVoCreateTime(),virtualObjectDataObject.getVoExpiredTime(),virtualObjectDataObject.getDeviceService(),virtualObjectDataObject.getDeviceId(),virtualObjectDataObject.getVoCommand(),virtualObjectDataObject.getVoLocation()); + if(!virtualObject.getId().startsWith(VirtualObjectProfile.VIRTUALOBJECT_ID)){ + String voId = virtualObject.getId(); + virtualObject.setId(VirtualObjectProfile.VIRTUALOBJECT_ID + voId); } return virtualObject; } public VirtualObjectTransFormObject settingVirtualObjectData(String id, String operation,String sessionId){ VirtualObjectTransFormObject object = new VirtualObjectTransFormObject(); - object.setVoId(id); + object.setId(id); object.setVoCommand(operation); object.setSessionId(sessionId); return object; diff --git a/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/store/memory/VirtualObjectMemory.java b/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/store/memory/VirtualObjectMemory.java index 31cde299..ab06419c 100644 --- a/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/store/memory/VirtualObjectMemory.java +++ b/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/store/memory/VirtualObjectMemory.java @@ -26,7 +26,7 @@ public static VirtualObjectMemory getInstance(){ } public void create(VirtualObject virtualObject) { - virtualObjectRepository.put(virtualObject.getVoId(),virtualObject); + virtualObjectRepository.put(virtualObject.getId(),virtualObject); } public VirtualObject retrieveByID(String id) { @@ -41,7 +41,7 @@ public List retrievceByLocation(String location) { } public void update(VirtualObject virtualObject) { - virtualObjectRepository.put(virtualObject.getVoId(),virtualObject); + virtualObjectRepository.put(virtualObject.getId(),virtualObject); } public void delete(String id) { diff --git a/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/store/mongo/VirtualObjectDataObject.java b/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/store/mongo/VirtualObjectDataObject.java index 127d299d..573154ea 100644 --- a/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/store/mongo/VirtualObjectDataObject.java +++ b/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/store/mongo/VirtualObjectDataObject.java @@ -5,7 +5,7 @@ @Document(collection = "VirtualObject") public class VirtualObjectDataObject { // - private String voId; + private String id; private String voName; private String functionality; private String voDescription; @@ -20,8 +20,8 @@ public class VirtualObjectDataObject { public VirtualObjectDataObject() { } - public VirtualObjectDataObject(String voId, String voName, String functionality, String voDescription, String voCreateTime, String voExpiredTime, String deviceService, String deviceId, String voCommand, String voLocation) { - this.voId = voId; + public VirtualObjectDataObject(String id, String voName, String functionality, String voDescription, String voCreateTime, String voExpiredTime, String deviceService, String deviceId, String voCommand, String voLocation) { + this.id = id; this.voName = voName; this.functionality = functionality; this.voDescription = voDescription; @@ -33,12 +33,12 @@ public VirtualObjectDataObject(String voId, String voName, String functionality, this.voLocation = voLocation; } - public String getVoId() { - return voId; + public String getId() { + return id; } - public void setVoId(String voId) { - this.voId = voId; + public void setId(String id) { + this.id = id; } public String getVoName() { @@ -116,7 +116,7 @@ public void setVoLocation(String voLocation) { @Override public String toString() { return "VirtualObjectDataObject{" + - "voId='" + voId + '\'' + + "id='" + id + '\'' + ", voName='" + voName + '\'' + ", functionality='" + functionality + '\'' + ", voDescription='" + voDescription + '\'' + diff --git a/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/store/mongo/VirtualObjectMongoStore.java b/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/store/mongo/VirtualObjectMongoStore.java index 36e6895e..e3b01657 100644 --- a/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/store/mongo/VirtualObjectMongoStore.java +++ b/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/store/mongo/VirtualObjectMongoStore.java @@ -28,7 +28,7 @@ public void create(VirtualObject virtualObject) { @Override public VirtualObject retrieveByID(String id) { logger.debug("VirtualObject ID = " + id); - VirtualObjectDataObject v = virtualObjectRepostory.findByvoId(id); + VirtualObjectDataObject v = virtualObjectRepostory.findOne(id); return DataObjectToVirtualObject(v); } @@ -96,7 +96,7 @@ public void delete(String id) { private VirtualObjectDataObject virtualObjectToDataObject(VirtualObject virtualObject) { if(virtualObject == null) return null; - return new VirtualObjectDataObject(virtualObject.getVoId(), virtualObject.getVoName(), virtualObject.getFunctionality(), virtualObject.getVoDescription(), virtualObject.getVoCreateTime(), virtualObject.getVoExpiredTime(), virtualObject.getDeviceService(), virtualObject.getDeviceId(), virtualObject.getVoCommand(), virtualObject.getVoLocation()); + return new VirtualObjectDataObject(virtualObject.getId(), virtualObject.getVoName(), virtualObject.getFunctionality(), virtualObject.getVoDescription(), virtualObject.getVoCreateTime(), virtualObject.getVoExpiredTime(), virtualObject.getDeviceService(), virtualObject.getDeviceId(), virtualObject.getVoCommand(), virtualObject.getVoLocation()); } private VirtualObject DataObjectToVirtualObject(VirtualObjectDataObject virtualObjectDataObject) { @@ -104,6 +104,6 @@ private VirtualObject DataObjectToVirtualObject(VirtualObjectDataObject virtualO { return null; } - return new VirtualObject(virtualObjectDataObject.getVoId(), virtualObjectDataObject.getVoName(), virtualObjectDataObject.getFunctionality(), virtualObjectDataObject.getVoDescription(), virtualObjectDataObject.getVoCreateTime(), virtualObjectDataObject.getVoExpiredTime(), virtualObjectDataObject.getDeviceService(), virtualObjectDataObject.getDeviceId(), virtualObjectDataObject.getVoCommand(), virtualObjectDataObject.getVoLocation()); + return new VirtualObject(virtualObjectDataObject.getId(), virtualObjectDataObject.getVoName(), virtualObjectDataObject.getFunctionality(), virtualObjectDataObject.getVoDescription(), virtualObjectDataObject.getVoCreateTime(), virtualObjectDataObject.getVoExpiredTime(), virtualObjectDataObject.getDeviceService(), virtualObjectDataObject.getDeviceId(), virtualObjectDataObject.getVoCommand(), virtualObjectDataObject.getVoLocation()); } } diff --git a/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/store/mongo/VirtualObjectRepostory.java b/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/store/mongo/VirtualObjectRepostory.java index 08046d83..01000c1c 100644 --- a/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/store/mongo/VirtualObjectRepostory.java +++ b/so-virtualobject/src/main/java/com/pineone/icbms/so/virtualobject/store/mongo/VirtualObjectRepostory.java @@ -5,7 +5,6 @@ import java.util.List; public interface VirtualObjectRepostory extends MongoRepository { - VirtualObjectDataObject findByvoId(String voId); List findByvoLocation(String deviceLocation); List findByvoLocationAndFunctionality(String location, String functionality); } diff --git a/so-virtualobject/src/test/java/com/pineone/icbms/so/virtualobject/pr/VirtualObjectPresentationTest.java b/so-virtualobject/src/test/java/com/pineone/icbms/so/virtualobject/pr/VirtualObjectPresentationTest.java index 4dafbc3d..76270759 100644 --- a/so-virtualobject/src/test/java/com/pineone/icbms/so/virtualobject/pr/VirtualObjectPresentationTest.java +++ b/so-virtualobject/src/test/java/com/pineone/icbms/so/virtualobject/pr/VirtualObjectPresentationTest.java @@ -28,14 +28,14 @@ // // // VirtualObject virtualObject = new VirtualObject(); // -// virtualObject.setVoId("CR0001AirCleaner0001"); +// virtualObject.setId("CR0001AirCleaner0001"); // virtualObject.setVoName("공기청정기 VO"); // virtualObject.setFunctionality("switch-control"); // virtualObject.setVoDescription("강의실 공기청정기 제어 서비스"); // virtualObject.setVoCreateTime("201608250930"); // virtualObject.setVoExpiredTime("201708250930"); // virtualObject.setDeviceService("aircleaner-power-switch-control-service"); -// virtualObject.setDeviceId("/herit-in/herit-cse/Device_AirCleaner_001"); +// virtualObject.setId("/herit-in/herit-cse/Device_AirCleaner_001"); // virtualObject.setVoCommand("ON"); // virtualObject.setVoLocation("CLASSROOM001"); //