mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Operations Refractor
This commit is contained in:
parent
d0b553d26a
commit
4f4240f176
@ -70,7 +70,8 @@ public class OperationManagerImpl implements OperationManager {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("operation:[" + operation.toString() + "]");
|
||||
for (DeviceIdentifier deviceIdentifier : devices) {
|
||||
log.debug("device identifier id:["+deviceIdentifier.getId()+"] type:["+deviceIdentifier.getType()+"]");
|
||||
log.debug("device identifier id:[" + deviceIdentifier.getId() + "] type:[" + deviceIdentifier.getType()
|
||||
+ "]");
|
||||
}
|
||||
}
|
||||
try {
|
||||
@ -249,38 +250,42 @@ public class OperationManagerImpl implements OperationManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Operation getOperationByDeviceAndOperationId(DeviceIdentifier deviceId, int operationId)
|
||||
public Operation getOperationByDeviceAndOperationId(DeviceIdentifier deviceIdentifier, int operationId)
|
||||
throws OperationManagementException {
|
||||
|
||||
Device device;
|
||||
Operation operation;
|
||||
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Device Type:"+deviceId.getType()+" Id:"+deviceId.getId());
|
||||
log.debug("Device Type:" + deviceIdentifier.getType() + " Id:" + deviceIdentifier.getId());
|
||||
}
|
||||
|
||||
try {
|
||||
device = deviceDAO.getDevice(deviceId);
|
||||
device = deviceDAO.getDevice(deviceIdentifier);
|
||||
if (device == null) {
|
||||
throw new OperationManagementException("Device not found for given device identifier:"+deviceId.getId
|
||||
()+" type:"+device.getDeviceType());
|
||||
throw new OperationManagementException(
|
||||
"Device not found for given device identifier:" + deviceIdentifier.getId
|
||||
() + " type:" + deviceIdentifier.getType());
|
||||
}
|
||||
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation dtoOperation = operationDAO
|
||||
.getOperationByDeviceAndId(device.getId(), operationId);
|
||||
|
||||
if (dtoOperation == null) {
|
||||
throw new OperationManagementException("Operation not found for operation Id:"+ operationId +" device" +
|
||||
throw new OperationManagementException(
|
||||
"Operation not found for operation Id:" + operationId + " device" +
|
||||
" Id:" + device.getId());
|
||||
}
|
||||
operation = OperationDAOUtil.convertOperation(dtoOperation);
|
||||
} catch (DeviceManagementDAOException deviceDAOException) {
|
||||
String errorMsg = "Error occurred while retrieving the device " +
|
||||
"for device Identifier type -'" + deviceId.getType() + "' and device Id '" + deviceId.getId();
|
||||
"for device Identifier type -'" + deviceIdentifier.getType() + "' and device Id '"
|
||||
+ deviceIdentifier.getId();
|
||||
log.error(errorMsg, deviceDAOException);
|
||||
throw new OperationManagementException(errorMsg, deviceDAOException);
|
||||
} catch (OperationManagementDAOException e) {
|
||||
throw new OperationManagementException("Error occurred while retrieving the list of " +
|
||||
"operations assigned for '" + deviceId.getType() + "' device '" + deviceId.getId() + "'", e);
|
||||
"operations assigned for '" + deviceIdentifier.getType() + "' device '" + deviceIdentifier.getId()
|
||||
+ "'", e);
|
||||
}
|
||||
return operation;
|
||||
}
|
||||
@ -345,7 +350,8 @@ public class OperationManagerImpl implements OperationManager {
|
||||
try {
|
||||
List<Operation> operations = new ArrayList<Operation>();
|
||||
List<? extends org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation> dtoOperationList =
|
||||
operationDAO.getOperationsForStatus(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Status
|
||||
operationDAO
|
||||
.getOperationsForStatus(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Status
|
||||
.valueOf(status.toString()));
|
||||
Operation operation;
|
||||
for (org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation dtoOperation : dtoOperationList) {
|
||||
|
||||
@ -324,7 +324,7 @@ public class OperationDAOImpl implements OperationDAO {
|
||||
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
Operation operation = null;
|
||||
Operation operation;
|
||||
|
||||
ByteArrayInputStream bais;
|
||||
ObjectInputStream ois;
|
||||
|
||||
@ -119,8 +119,10 @@
|
||||
</importFeatureDef>
|
||||
<importFeatureDef>org.wso2.carbon.apimgt.core:${carbon.api.mgt.version}
|
||||
</importFeatureDef>
|
||||
<!--
|
||||
<importFeatureDef>org.wso2.carbon.transaction.manager:${carbon.commons.version}
|
||||
</importFeatureDef>
|
||||
-->
|
||||
</importFeatures>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user