|
|
@ -17,6 +17,8 @@
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
package io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.impl;
|
|
|
|
package io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.impl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.common.MDMAppConstants;
|
|
|
|
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.ProfileOperation;
|
|
|
|
import org.apache.commons.logging.Log;
|
|
|
|
import org.apache.commons.logging.Log;
|
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
|
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
|
|
|
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
|
|
@ -41,6 +43,8 @@ import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.util.Operatio
|
|
|
|
import java.io.ByteArrayOutputStream;
|
|
|
|
import java.io.ByteArrayOutputStream;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.ObjectOutputStream;
|
|
|
|
import java.io.ObjectOutputStream;
|
|
|
|
|
|
|
|
import java.io.ObjectInputStream;
|
|
|
|
|
|
|
|
import java.io.ByteArrayInputStream;
|
|
|
|
import java.sql.Connection;
|
|
|
|
import java.sql.Connection;
|
|
|
|
import java.sql.PreparedStatement;
|
|
|
|
import java.sql.PreparedStatement;
|
|
|
|
import java.sql.ResultSet;
|
|
|
|
import java.sql.ResultSet;
|
|
|
@ -1353,6 +1357,9 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
List<Operation> operations = new ArrayList<>();
|
|
|
|
List<Operation> operations = new ArrayList<>();
|
|
|
|
String createdTo = null;
|
|
|
|
String createdTo = null;
|
|
|
|
String createdFrom = null;
|
|
|
|
String createdFrom = null;
|
|
|
|
|
|
|
|
ByteArrayInputStream bais;
|
|
|
|
|
|
|
|
ObjectInputStream ois;
|
|
|
|
|
|
|
|
ProfileOperation profileOperation = null;
|
|
|
|
DateFormat simple = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
|
|
|
DateFormat simple = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
|
|
|
boolean isCreatedDayProvided = false;
|
|
|
|
boolean isCreatedDayProvided = false;
|
|
|
|
boolean isUpdatedDayProvided = false; //updated day = received day
|
|
|
|
boolean isUpdatedDayProvided = false; //updated day = received day
|
|
|
@ -1375,6 +1382,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
"o.RECEIVED_TIMESTAMP, " +
|
|
|
|
"o.RECEIVED_TIMESTAMP, " +
|
|
|
|
"o.OPERATION_CODE, " +
|
|
|
|
"o.OPERATION_CODE, " +
|
|
|
|
"o.INITIATED_BY, " +
|
|
|
|
"o.INITIATED_BY, " +
|
|
|
|
|
|
|
|
"o.OPERATION_DETAILS, " +
|
|
|
|
"om.STATUS, " +
|
|
|
|
"om.STATUS, " +
|
|
|
|
"om.ID AS OM_MAPPING_ID, " +
|
|
|
|
"om.ID AS OM_MAPPING_ID, " +
|
|
|
|
"om.UPDATED_TIMESTAMP " +
|
|
|
|
"om.UPDATED_TIMESTAMP " +
|
|
|
@ -1473,10 +1481,21 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
operation.setInitiatedBy(rs.getString("INITIATED_BY"));
|
|
|
|
operation.setInitiatedBy(rs.getString("INITIATED_BY"));
|
|
|
|
|
|
|
|
if (MDMAppConstants.AndroidConstants.UNMANAGED_APP_UNINSTALL.equals(operation.getCode())) {
|
|
|
|
|
|
|
|
byte[] operationDetails = rs.getBytes("OPERATION_DETAILS");
|
|
|
|
|
|
|
|
bais = new ByteArrayInputStream(operationDetails);
|
|
|
|
|
|
|
|
ois = new ObjectInputStream(bais);
|
|
|
|
|
|
|
|
profileOperation = (ProfileOperation) ois.readObject();
|
|
|
|
|
|
|
|
operation.setPayLoad(profileOperation.getPayLoad());
|
|
|
|
|
|
|
|
}
|
|
|
|
operation.setStatus(Operation.Status.valueOf(rs.getString("STATUS")));
|
|
|
|
operation.setStatus(Operation.Status.valueOf(rs.getString("STATUS")));
|
|
|
|
OperationDAOUtil.setActivityId(operation, rs.getInt("ID"));
|
|
|
|
OperationDAOUtil.setActivityId(operation, rs.getInt("ID"));
|
|
|
|
operations.add(operation);
|
|
|
|
operations.add(operation);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
|
|
|
throw new OperationManagementDAOException("IO Error occurred while retrieving app data of operation ", e);
|
|
|
|
|
|
|
|
} catch (ClassNotFoundException e) {
|
|
|
|
|
|
|
|
throw new OperationManagementDAOException("Class not found error occurred while retrieving app data of operation ", e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (SQLException e) {
|
|
|
|
} catch (SQLException e) {
|
|
|
@ -1493,6 +1512,9 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
List<Operation> operations = new ArrayList<>();
|
|
|
|
List<Operation> operations = new ArrayList<>();
|
|
|
|
String createdTo = null;
|
|
|
|
String createdTo = null;
|
|
|
|
String createdFrom = null;
|
|
|
|
String createdFrom = null;
|
|
|
|
|
|
|
|
ByteArrayInputStream bais;
|
|
|
|
|
|
|
|
ObjectInputStream ois;
|
|
|
|
|
|
|
|
ProfileOperation profileOperation = null;
|
|
|
|
DateFormat simple = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
|
|
|
DateFormat simple = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
|
|
|
boolean isCreatedDayProvided = false;
|
|
|
|
boolean isCreatedDayProvided = false;
|
|
|
|
boolean isUpdatedDayProvided = false; //updated day = received day
|
|
|
|
boolean isUpdatedDayProvided = false; //updated day = received day
|
|
|
@ -1515,6 +1537,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
"o.RECEIVED_TIMESTAMP, " +
|
|
|
|
"o.RECEIVED_TIMESTAMP, " +
|
|
|
|
"o.OPERATION_CODE, " +
|
|
|
|
"o.OPERATION_CODE, " +
|
|
|
|
"o.INITIATED_BY, " +
|
|
|
|
"o.INITIATED_BY, " +
|
|
|
|
|
|
|
|
"o.OPERATION_DETAILS, " +
|
|
|
|
"om.STATUS, " +
|
|
|
|
"om.STATUS, " +
|
|
|
|
"om.ID AS OM_MAPPING_ID, " +
|
|
|
|
"om.ID AS OM_MAPPING_ID, " +
|
|
|
|
"om.UPDATED_TIMESTAMP " +
|
|
|
|
"om.UPDATED_TIMESTAMP " +
|
|
|
@ -1613,10 +1636,21 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
|
|
|
operation.setInitiatedBy(rs.getString("INITIATED_BY"));
|
|
|
|
operation.setInitiatedBy(rs.getString("INITIATED_BY"));
|
|
|
|
|
|
|
|
if (MDMAppConstants.AndroidConstants.UNMANAGED_APP_UNINSTALL.equals(operation.getCode())) {
|
|
|
|
|
|
|
|
byte[] operationDetails = rs.getBytes("OPERATION_DETAILS");
|
|
|
|
|
|
|
|
bais = new ByteArrayInputStream(operationDetails);
|
|
|
|
|
|
|
|
ois = new ObjectInputStream(bais);
|
|
|
|
|
|
|
|
profileOperation = (ProfileOperation) ois.readObject();
|
|
|
|
|
|
|
|
operation.setPayLoad(profileOperation.getPayLoad());
|
|
|
|
|
|
|
|
}
|
|
|
|
operation.setStatus(Operation.Status.valueOf(rs.getString("STATUS")));
|
|
|
|
operation.setStatus(Operation.Status.valueOf(rs.getString("STATUS")));
|
|
|
|
OperationDAOUtil.setActivityId(operation, rs.getInt("ID"));
|
|
|
|
OperationDAOUtil.setActivityId(operation, rs.getInt("ID"));
|
|
|
|
operations.add(operation);
|
|
|
|
operations.add(operation);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
|
|
|
throw new OperationManagementDAOException("IO Error occurred while retrieving app data of operation " , e);
|
|
|
|
|
|
|
|
} catch (ClassNotFoundException e) {
|
|
|
|
|
|
|
|
throw new OperationManagementDAOException("Class not found error occurred while retrieving app data of operation ", e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (SQLException e) {
|
|
|
|
} catch (SQLException e) {
|
|
|
|