Merge branch 'event-modify-branch-1' into 'master'

Code format of event task operation

See merge request entgra/carbon-device-mgt!728
revert-70ac1926
Dharmakeerthi Lasantha 4 years ago
commit ce80f4efe0

@ -38,9 +38,6 @@ import org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroup;
import org.wso2.carbon.device.mgt.common.group.mgt.GroupManagementException; import org.wso2.carbon.device.mgt.common.group.mgt.GroupManagementException;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException; import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory;
import org.wso2.carbon.device.mgt.core.dao.EventConfigDAO;
import org.wso2.carbon.device.mgt.core.dao.GeofenceDAO;
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder; import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder;
import org.wso2.carbon.device.mgt.core.operation.mgt.OperationMgtConstants; import org.wso2.carbon.device.mgt.core.operation.mgt.OperationMgtConstants;
import org.wso2.carbon.device.mgt.core.operation.mgt.ProfileOperation; import org.wso2.carbon.device.mgt.core.operation.mgt.ProfileOperation;
@ -61,8 +58,6 @@ public class EventOperationExecutor implements Runnable {
private static final Log log = LogFactory.getLog(EventOperationExecutor.class); private static final Log log = LogFactory.getLog(EventOperationExecutor.class);
private final GroupManagementProviderService groupManagementService; private final GroupManagementProviderService groupManagementService;
private final EventConfigDAO eventConfigDAO;
private final GeofenceDAO geofenceDAO;
private final List<Integer> groupIds; private final List<Integer> groupIds;
private final String eventSource; private final String eventSource;
private final EventMetaData eventMetaData; private final EventMetaData eventMetaData;
@ -72,8 +67,6 @@ public class EventOperationExecutor implements Runnable {
public EventOperationExecutor(EventMetaData eventMetaData, List<Integer> groupIds, int tenantId, public EventOperationExecutor(EventMetaData eventMetaData, List<Integer> groupIds, int tenantId,
String eventSource, String operationCode) { String eventSource, String operationCode) {
this.groupManagementService = DeviceManagementDataHolder.getInstance().getGroupManagementProviderService(); this.groupManagementService = DeviceManagementDataHolder.getInstance().getGroupManagementProviderService();
this.eventConfigDAO = DeviceManagementDAOFactory.getEventConfigDAO();
this.geofenceDAO = DeviceManagementDAOFactory.getGeofenceDAO();
this.eventMetaData = eventMetaData; this.eventMetaData = eventMetaData;
this.groupIds = groupIds; this.groupIds = groupIds;
this.tenantId = tenantId; this.tenantId = tenantId;
@ -223,11 +216,9 @@ public class EventOperationExecutor implements Runnable {
//TODO introduce a proper mechanism //TODO introduce a proper mechanism
} catch (OperationManagementException e) { } catch (OperationManagementException e) {
log.error("Creating event operation failed with error ", e); log.error("Creating event operation failed with error ", e);
return;
} catch (InvalidDeviceException e) { } catch (InvalidDeviceException e) {
log.error("Creating event operation failed.\n" + log.error("Creating event operation failed.\n" +
"Could not found device/devices for the defined device identifiers.", e); "Could not found device/devices for the defined device identifiers.", e);
return;
} }
} }
} }

@ -86,15 +86,13 @@ public class GroupAssignmentEventOperationExecutor implements Runnable {
try { try {
this.eventSources = eventConfigurationService.getEventsSourcesOfGroup(groupId, tenantId); this.eventSources = eventConfigurationService.getEventsSourcesOfGroup(groupId, tenantId);
if (this.eventSources == null || this.eventSources.isEmpty()) { if (this.eventSources == null || this.eventSources.isEmpty()) {
String msg = "No events applied for queried group with ID " + groupId;
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug(msg); log.debug("No configured events for the queried group with ID " + groupId);
} }
return; return;
} }
} catch (EventConfigurationException e) { } catch (EventConfigurationException e) {
String msg = "Failed while retrieving event records of group " + groupId + "of the tenant " + tenantId; log.error("Failed while retrieving event records of group " + groupId + "of the tenant " + tenantId, e);
log.error(msg, e);
return; return;
} }

Loading…
Cancel
Save