@ -242,7 +242,7 @@ public class OperationManagerImpl implements OperationManager {
//Add the invalid DeviceIds
for ( String id : deviceIdValidationResult . getErrorDeviceIdList ( ) ) {
activityStatus = new ActivityStatus ( ) ;
activityStatus . setDeviceIdentifier ( new DeviceIdentifier ( id , deviceType ) ) ;
activityStatus . setDeviceIdentifier ( new DeviceIdentifier ( id , deviceType ) ) ;
activityStatus . setStatus ( ActivityStatus . Status . INVALID ) ;
activityStatuses . add ( activityStatus ) ;
}
@ -351,7 +351,7 @@ public class OperationManagerImpl implements OperationManager {
if ( ! isActionAuthorized ( deviceId ) ) {
throw new OperationManagementException ( "User '" + getUser ( ) + "' is not authorized to access the '" +
deviceId . getType ( ) + "' device, which carries the identifier '" +
deviceId . getId ( ) + "' of owner '" + owner + "'" ) ;
deviceId . getId ( ) + "' of owner '" + owner + "'" ) ;
}
EnrolmentInfo enrolmentInfo = this . getEnrolmentInfo ( deviceId , owner ) ;
@ -601,32 +601,33 @@ public class OperationManagerImpl implements OperationManager {
try {
OperationManagementDAOFactory . openConnection ( ) ;
org . wso2 . carbon . device . mgt . core . dto . operation . mgt . Operation d to Operation = operationDAO .
org . wso2 . carbon . device . mgt . core . dto . operation . mgt . Operation d eviceSpecific Operation = operationDAO .
getOperationByDeviceAndId ( enrolmentInfo . getId ( ) ,
operationId ) ;
if ( dtoOperation . getType ( ) .
org . wso2 . carbon . device . mgt . core . dto . operation . mgt . Operation dtoOperation = deviceSpecificOperation ;
if ( deviceSpecificOperation . getType ( ) .
equals ( org . wso2 . carbon . device . mgt . core . dto . operation . mgt . Operation . Type . COMMAND ) ) {
org . wso2 . carbon . device . mgt . core . dto . operation . mgt . CommandOperation commandOperation ;
commandOperation =
( org . wso2 . carbon . device . mgt . core . dto . operation . mgt . CommandOperation ) commandOperationDAO .
getOperation ( d to Operation. getId ( ) ) ;
getOperation ( d eviceSpecific Operation. getId ( ) ) ;
dtoOperation . setEnabled ( commandOperation . isEnabled ( ) ) ;
} else if ( d to Operation. getType ( ) .
} else if ( d eviceSpecific Operation. getType ( ) .
equals ( org . wso2 . carbon . device . mgt . core . dto . operation . mgt . Operation . Type . CONFIG ) ) {
dtoOperation = configOperationDAO . getOperation ( d to Operation. getId ( ) ) ;
} else if ( d to Operation. getType ( ) . equals (
dtoOperation = configOperationDAO . getOperation ( d eviceSpecific Operation. getId ( ) ) ;
} else if ( d eviceSpecific Operation. getType ( ) . equals (
org . wso2 . carbon . device . mgt . core . dto . operation . mgt . Operation . Type . PROFILE ) ) {
dtoOperation = profileOperationDAO . getOperation ( d to Operation. getId ( ) ) ;
} else if ( d to Operation. getType ( ) . equals (
dtoOperation = profileOperationDAO . getOperation ( d eviceSpecific Operation. getId ( ) ) ;
} else if ( d eviceSpecific Operation. getType ( ) . equals (
org . wso2 . carbon . device . mgt . core . dto . operation . mgt . Operation . Type . POLICY ) ) {
dtoOperation = policyOperationDAO . getOperation ( d to Operation. getId ( ) ) ;
dtoOperation = policyOperationDAO . getOperation ( d eviceSpecific Operation. getId ( ) ) ;
}
if ( dtoOperation = = null ) {
throw new OperationManagementException ( "Operation not found for operation Id:" + operationId +
" device id:" + deviceId . getId ( ) ) ;
}
operation = OperationDAOUtil . convertOperation ( dtoOperation ) ;
dtoOperation . setStatus ( deviceSpecificOperation . getStatus ( ) ) ;
operation = OperationDAOUtil . convertOperation ( deviceSpecificOperation ) ;
} catch ( OperationManagementDAOException e ) {
throw new OperationManagementException ( "Error occurred while retrieving the list of " +
"operations assigned for '" + deviceId . getType ( ) +
@ -904,12 +905,18 @@ public class OperationManagerImpl implements OperationManager {
private OperationDAO lookupOperationDAO ( org . wso2 . carbon . device . mgt . core . dto . operation . mgt . Operation operation ) {
if ( operation instanceof org . wso2 . carbon . device . mgt . core . dto . operation . mgt . CommandOperation ) {
if ( operation instanceof org . wso2 . carbon . device . mgt . core . dto . operation . mgt . CommandOperation | |
operation . getType ( ) . equals ( org . wso2 . carbon . device . mgt . core . dto . operation . mgt . Operation . Type . COMMAND ) ) {
return commandOperationDAO ;
} else if ( operation instanceof org . wso2 . carbon . device . mgt . core . dto . operation . mgt . ProfileOperation ) {
} else if ( operation instanceof org . wso2 . carbon . device . mgt . core . dto . operation . mgt . ProfileOperation | |
operation . getType ( ) . equals ( org . wso2 . carbon . device . mgt . core . dto . operation . mgt . Operation . Type . PROFILE ) ) {
return profileOperationDAO ;
} else if ( operation instanceof org . wso2 . carbon . device . mgt . core . dto . operation . mgt . ConfigOperation ) {
} else if ( operation instanceof org . wso2 . carbon . device . mgt . core . dto . operation . mgt . ConfigOperation | |
operation . getType ( ) . equals ( org . wso2 . carbon . device . mgt . core . dto . operation . mgt . Operation . Type . CONFIG ) ) {
return configOperationDAO ;
} else if ( operation instanceof org . wso2 . carbon . device . mgt . core . dto . operation . mgt . PolicyOperation | |
operation . getType ( ) . equals ( org . wso2 . carbon . device . mgt . core . dto . operation . mgt . Operation . Type . POLICY ) ) {
return policyOperationDAO ;
} else {
return operationDAO ;
}
@ -1055,7 +1062,7 @@ public class OperationManagerImpl implements OperationManager {
List < MonitoringOperation > monitoringOperations = deviceManagementProviderService . getMonitoringOperationList ( deviceType ) ; //Get task list from each device type
for ( MonitoringOperation op : monitoringOperations ) {
for ( MonitoringOperation op : monitoringOperations ) {
if ( operation . getCode ( ) . equals ( op . getTaskName ( ) ) ) {
return true ;
}