Skip to content

Commit

Permalink
Merge pull request #282 from pahnjy/develop
Browse files Browse the repository at this point in the history
Mongo DB 데이터 변경 및 소스 변경 #281
  • Loading branch information
pahnjy authored Nov 30, 2016
2 parents 8c4685b + f259f7f commit 427052d
Show file tree
Hide file tree
Showing 23 changed files with 85 additions and 84 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -36,7 +35,7 @@ public List<String> retrieveGeneralObjectIdList() {
List<CompositeVirtualObject> compositeVirtualObjectList = compositeVirtualObjectPresentation.findCompositeVirtualObjectList();

for (VirtualObject virtualObject : virtualObjectList) {
generalObjectIdList.add(virtualObject.getVoId());
generalObjectIdList.add(virtualObject.getId());
}
for (CompositeVirtualObject compositeVirtualObject : compositeVirtualObjectList) {
generalObjectIdList.add(compositeVirtualObject.getId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public List<String> retrieveVirtualObjectIdList(){
List<String> voIdList = new ArrayList<>();
List<VirtualObject> virtualObjectList = virtualObjectPresentation.searchVirtualObjectList();
for(VirtualObject virtualObject : virtualObjectList){
voIdList.add(virtualObject.getVoId());
voIdList.add(virtualObject.getId());
}
return voIdList;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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의 이름
Expand Down Expand Up @@ -72,8 +72,8 @@ public class Device {
public Device() {
}

public Device(String deviceId, String deviceName, String deviceLocation, String deviceUri, List<String> deviceCommand, List<String> deviceServices, long deviceCreateTime, long deviceExfiredTime, String deviceStatus) {
this.deviceId = deviceId;
public Device(String id, String deviceName, String deviceLocation, String deviceUri, List<String> deviceCommand, List<String> deviceServices, long deviceCreateTime, long deviceExfiredTime, String deviceStatus) {
this.id = id;
this.deviceName = deviceName;
this.deviceLocation = deviceLocation;
this.deviceUri = deviceUri;
Expand All @@ -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() {
Expand Down Expand Up @@ -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 + '\'' +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public class DeviceTransFormObject {

private String deviceId;
private String id;
private String deviceName;
private String deviceLocation;
private String deviceUri;
Expand All @@ -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;
Expand All @@ -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() {
Expand Down Expand Up @@ -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 + '\'' +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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는 언제 요청으로 얻어 올까??
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}

/**
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -49,7 +49,7 @@ public List<String> retrieveDeviceService(String location) {

public void update(Device device) {
//
deviceRepository.put(device.getDeviceId(),device);
deviceRepository.put(device.getId(),device);
}

public void delete(String id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -20,8 +20,8 @@ public class DeviceDataObject {
public DeviceDataObject() {
}

public DeviceDataObject(String deviceId, String deviceName, String deviceLocation, String deviceUri, List<String> deviceCommand, List<String> deviceServices, long deviceCreateTime, long deviceExfiredTime, String deviceStatus) {
this.deviceId = deviceId;
public DeviceDataObject(String id, String deviceName, String deviceLocation, String deviceUri, List<String> deviceCommand, List<String> deviceServices, long deviceCreateTime, long deviceExfiredTime, String deviceStatus) {
this.id = id;
this.deviceName = deviceName;
this.deviceLocation = deviceLocation;
this.deviceUri = deviceUri;
Expand All @@ -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() {
Expand Down Expand Up @@ -71,7 +71,7 @@ public String getDeviceStatus() {
@Override
public String toString() {
return "DeviceDataObject{" +
"deviceId='" + deviceId + '\'' +
"id='" + id + '\'' +
", deviceName='" + deviceName + '\'' +
", deviceLocation='" + deviceLocation + '\'' +
", deviceUri='" + deviceUri + '\'' +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@
public interface DeviceRepository extends MongoRepository<DeviceDataObject, String> {

List<DeviceDataObject> findBydeviceLocation(String deviceLocation);
DeviceDataObject findBydeviceId(String deviceId);

}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -53,7 +53,7 @@ public void findDeviceByDomainTest(){
List<Device> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 부족 알림
// 마우스 부족 알림
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@ private boolean locationCompare(Session session, String serviceModelLocation){
List<String> 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){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class VirtualObject {
* format : vo-(devicename)-(service)
* ex) vo-smartlight01-001-power-control
*/
private String voId;
private String id;

/**
* VirtualObject 이름
Expand Down Expand Up @@ -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;
Expand All @@ -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() {
Expand Down Expand Up @@ -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 + '\'' +
Expand Down
Loading

0 comments on commit 427052d

Please sign in to comment.