@Override
 public boolean isTaskOperation(String opName) {
   try {
     List<TaskOperation> taskOperations = this.getOperationList();
     for (TaskOperation taop : taskOperations) {
       if (taop.getTaskName().equalsIgnoreCase(opName)) {
         return true;
       }
     }
   } catch (DeviceMgtTaskException e) {
     // ignoring the error, no need to throw, If error occurs, return value will be false.
   }
   return false;
 }
  @Override
  public List<String> getValidOperationNames() throws DeviceMgtTaskException {

    List<TaskOperation> taskOperations = this.getOperationList();
    List<String> opNames = new ArrayList<>();
    Long milliseconds = System.currentTimeMillis();
    int frequency = this.getTaskFrequency();
    HashMap<String, Long> mp = Utils.getTenantedTaskOperationMap(map);

    for (TaskOperation top : taskOperations) {
      if (!mp.containsKey(top.getTaskName())) {
        opNames.add(top.getTaskName());
        mp.put(top.getTaskName(), milliseconds);
      } else {
        Long lastExecutedTime = mp.get(top.getTaskName());
        Long evalTime = lastExecutedTime + (frequency * top.getRecurrentTimes());
        if (evalTime <= milliseconds) {
          opNames.add(top.getTaskName());
          mp.put(top.getTaskName(), milliseconds);
        }
      }
    }

    if (log.isDebugEnabled()) {
      log.debug("Valid operation names are : " + Arrays.toString(opNames.toArray()));
    }
    return opNames;
  }
  @Override
  public List<TaskOperation> getOperationList() throws DeviceMgtTaskException {

    TaskConfiguration taskConfiguration =
        DeviceConfigurationManager.getInstance()
            .getDeviceManagementConfig()
            .getDeviceManagementConfigRepository()
            .getTaskConfiguration();

    List<TaskConfiguration.Operation> ops = taskConfiguration.getOperations();
    List<TaskOperation> taskOperations = new ArrayList<>();

    for (TaskConfiguration.Operation op : ops) {
      TaskOperation taskOperation = new TaskOperation();
      taskOperation.setTaskName(op.getOperationName());
      taskOperation.setRecurrentTimes(op.getRecurrency());
      taskOperations.add(taskOperation);
    }
    return taskOperations;
  }