Computing > 6 - Schedules Management > Get Scheduled Operations

6.1 Get Scheduled Operations

By using the Aruba WsEndUser method GetScheduledOperations it is possible to read the list of occurrences of active scheduled operations between two dates.

Parameters
dateStart
Type: DateTime
Value of type DateTime which contains the start date of time interval to monitor

dateEnd
Type: DateTime
Value of type DateTime which contains the end date of time interval to monitor

// 6.1 Leggere le operazioni schedulate		
/// IWsEndUser.GetScheduledOperations  Method (c# .NET)
public static string GetScheduledOperations(WsEndUserClient client,
    DateTime dateStart, DateTime dateEnd)
{
    //specify the account login details 
    client.ClientCredentials.UserName.UserName = "ARU-0000";
    client.ClientCredentials.UserName.Password = "0123456789";

    StringBuilder stringBuilder = new StringBuilder();

    try
    {
        // create the object GetScheduledOperationRequest  for the request 
        // with data to process
        GetScheduledOperationRequest request = new GetScheduledOperationRequest();
        request.StartDate = dateStart;
        request.EndDate = dateEnd;

        // call method GetScheduledOperations, 
        // obtaining a WsResultOfArrayOfScheduledOperation item               
        WsResultOfArrayOfScheduledOperation result =
                client.GetScheduledOperations(request);

        //if the call is Success print history values
        if (result.Success)
        {
            // get Value returned from server
            ScheduledOperation[] scheduledOperations = result.Value;

            foreach (ScheduledOperation operation in scheduledOperations)
            {
                stringBuilder.Append(" ---- Scheduled Operation ---- ");
                stringBuilder.Append(" Type: ");
                stringBuilder.Append(operation.OperationType);
                stringBuilder.Append(" ID: ");
                stringBuilder.Append(operation.ScheduledOperationID);
                stringBuilder.Append(" Server Id: ");
                stringBuilder.Append(operation.ServerId);
                stringBuilder.Append(" ServerName: ");
                stringBuilder.Append(operation.ServerName);
                        
                stringBuilder.Append(" Parameters: ");
                if (operation.OperationParameter != null)
                {
                    foreach (OperationParameters item in operation.OperationParameter)
                    {
                        stringBuilder.Append(" Type: ");
                        stringBuilder.Append(item.ParameterType);
                        stringBuilder.Append(" Value: ");
                        stringBuilder.Append(item.ParameterValue);
                    }
                }

                stringBuilder.Append(" Plan Information : ");
                stringBuilder.Append(" First Execution Time : ");
                stringBuilder.Append(operation.ScheduledPlan.FirstExecutionTime);
                stringBuilder.Append(" Last Execution Time : "); 
                stringBuilder.Append(operation.ScheduledPlan.LastExecutionTime);
                stringBuilder.Append(" Schedule Days Of Month : ");
                stringBuilder.Append(operation.ScheduledPlan.ScheduleDaysOfMonth);
                stringBuilder.Append(" Scheduled Montly Recurrence : ");
                stringBuilder.Append(operation.ScheduledPlan.ScheduledMontlyRecurrence);
                stringBuilder.Append(" Scheduled Owner Type : ");
                stringBuilder.Append(operation.ScheduledPlan.ScheduledOwnerType);
                stringBuilder.Append(" Scheduled Plan Id : ");
                stringBuilder.Append(operation.ScheduledPlan.ScheduledPlanId);
                stringBuilder.Append(" Scheduled Plan Status : ");
                stringBuilder.Append(operation.ScheduledPlan.ScheduledPlanStatus);
                stringBuilder.Append(" Schedule EndDate Time : ");
                stringBuilder.Append(operation.ScheduledPlan.ScheduleEndDateTime);
                stringBuilder.Append(" Schedule Frequency : ");
                stringBuilder.Append(operation.ScheduledPlan.ScheduleFrequency);
                stringBuilder.Append(" Schedule Frequency Type  : ");
                stringBuilder.Append(operation.ScheduledPlan.ScheduleFrequencyType);
                stringBuilder.Append(" Schedule Operation Label : ");
                stringBuilder.Append(operation.ScheduledPlan.ScheduleOperationLabel);
                stringBuilder.Append(" Schedule Start DateTime : ");
                stringBuilder.Append(operation.ScheduledPlan.ScheduleStartDateTime);
                stringBuilder.Append(" Schedule Week Days : ");
                stringBuilder.Append(operation.ScheduledPlan.ScheduleWeekDays);

            }
        }
        else
        {
            throw new ApplicationException(result.ResultMessage);
        }
    }
    catch (Exception ex)
    {
        // re-run the error
        throw new ApplicationException(ex.Message);
    }

    return stringBuilder.ToString();
}
// IWsEndUser.GetScheduledOperations  Method (JAVA)
public static String GetScheduledOperations(IWsEndUser client,
    XMLGregorianCalendar dateStart, XMLGregorianCalendar dateEnd)
{
    //specify the account login details 
    ((BindingProvider) client).getRequestContext()
            .put(BindingProvider.USERNAME_PROPERTY, "ARU-0000");
    ((BindingProvider) client).getRequestContext()
            .put(BindingProvider.PASSWORD_PROPERTY, "0123456789");

    StringBuilder stringBuilder = new StringBuilder();

    try
    {
        // create the object GetScheduledOperationRequest  for the request 
        // with data to process
        GetScheduledOperationRequest request = new GetScheduledOperationRequest();
        request.setStartDate(dateStart);
        request.setEndDate(dateEnd);

        // call method GetScheduledOperations, 
        // obtaining a WsResultOfArrayOfScheduledOperation item               
        WsResultOfArrayOfScheduledOperation result =
                client.getScheduledOperations(request);

        //if the call is Success print history values
        if (result.isSuccess())
        {
            // get Value returned from server
            ArrayOfScheduledOperation arrayOfScheduledOperation = result.getValue();
            List<ScheduledOperation> listOfScheduledOperation = 
                arrayOfScheduledOperation.getScheduledOperation();
            for (Iterator<ScheduledOperation> it = 
                listOfScheduledOperation.iterator(); it.hasNext();)
            {
                ScheduledOperation operation = it.next();
                stringBuilder.append(" ---- Scheduled Operation ---- ");
                stringBuilder.append(" Type: ");
                stringBuilder.append(operation.getOperationType());
                stringBuilder.append(" ID: ");
                stringBuilder.append(operation.getScheduledOperationID());
                stringBuilder.append(" Server Id: ");
                stringBuilder.append(operation.getServerId());
                stringBuilder.append(" ServerName: ");
                stringBuilder.append(operation.getServerName());
                        
                stringBuilder.append(" Parameters: ");
                ArrayOfOperationParameters arrayOfOperationParameters = 
                    operation.getOperationParameter();
                List<OperationParameters> listOfOperationParameters = 
                    arrayOfOperationParameters.getOperationParameters();
                
                for (Iterator<OperationParameters> it2 = 
                    listOfOperationParameters.iterator(); it2.hasNext();)
                {
                    OperationParameters item = it2.next();
                    stringBuilder.append(" Type: ");
                    stringBuilder.append(item.getParameterType());
                    stringBuilder.append(" Value: ");
                    stringBuilder.append(item.getParameterValue());
                }
                        
                stringBuilder.append(" Plan Information : ");
                stringBuilder.append(" First Execution Time : ");
                stringBuilder.append(operation.getScheduledPlan().
                    getFirstExecutionTime());
                stringBuilder.append(" Last Execution Time : "); 
                stringBuilder.append(operation.getScheduledPlan().
                    getLastExecutionTime());
                stringBuilder.append(" Schedule Days Of Month : ");
                stringBuilder.append(operation.getScheduledPlan().
                    getScheduleDaysOfMonth());
                stringBuilder.append(" Scheduled Montly Recurrence : ");
                stringBuilder.append(operation.getScheduledPlan().
                    getScheduledMontlyRecurrence());
                stringBuilder.append(" Scheduled Owner Type : ");
                stringBuilder.append(operation.getScheduledPlan().
                    getScheduledOwnerType());
                stringBuilder.append(" Scheduled Plan Id : ");
                stringBuilder.append(operation.getScheduledPlan().
                    getScheduledPlanId());
                stringBuilder.append(" Scheduled Plan Status : ");
                stringBuilder.append(operation.getScheduledPlan().
                    getScheduledPlanStatus());
                stringBuilder.append(" Schedule EndDate Time : ");
                stringBuilder.append(operation.getScheduledPlan().
                    getScheduleEndDateTime());
                stringBuilder.append(" Schedule Frequency : ");
                stringBuilder.append(operation.getScheduledPlan().
                    getScheduleFrequency());
                stringBuilder.append(" Schedule Frequency Type  : ");
                stringBuilder.append(operation.getScheduledPlan().
                    getScheduleFrequencyType());
                stringBuilder.append(" Schedule Operation Label : ");
                stringBuilder.append(operation.getScheduledPlan().
                    getScheduleOperationLabel());
                stringBuilder.append(" Schedule Start DateTime : ");
                stringBuilder.append(operation.getScheduledPlan().
                    getScheduleStartDateTime());
                stringBuilder.append(" Schedule Week Days : ");
                stringBuilder.append(operation.getScheduledPlan().
                    getScheduleWeekDays());

            }
        }
        else
        {
            throw new Exception(result.getResultMessage());
        }
    }
    catch (Exception ex)
    {
        //show result
         System.out.println(ex);
    }

    return stringBuilder.toString();
}
Scheduled operations can be recurrent. In this case By using the Aruba WsEndUser method GetScheduleOccurrences it is possible to read the list of occurrences of active scheduled operations between two dates.

Parameters
dateStart
Type: DateTime
Value of type DateTime which contains the start date of time interval to monitor

dateEnd
Type: DateTime
Value of type DateTime which contains the end date of time interval to monitor

/// IWsEndUser.GetScheduleOccurrences  Method (c# .NET)
public static string GetScheduleOccurrences(WsEndUserClient client,
    DateTime dateStart, DateTime dateEnd)
{
    //specify the account login details 
    client.ClientCredentials.UserName.UserName = "ARU-0000";
    client.ClientCredentials.UserName.Password = "0123456789";

    StringBuilder stringBuilder = new StringBuilder();

    try
    {
        // create the object GetScheduleOccurrencesRequest  for the request 
        // with data to process
        GetScheduleOccurrencesRequest request = new GetScheduleOccurrencesRequest();
        request.ScheduleStartDate = dateStart;
        request.ScheduleEndDate = dateEnd;

        // call method GetScheduleOccurrences, 
        // obtaining a WsResultOfArrayOfScheduledOperationOccurrence item               
        WsResultOfArrayOfScheduledOperationOccurrence result =
                client.GetScheduleOccurrences(request);

        //if the call is Success print history values
        if (result.Success)
        {
            // get Value returned from server
            ScheduledOperationOccurrence[] scheduledOperations = result.Value;

            foreach (ScheduledOperationOccurrence operation in scheduledOperations)
            {
                stringBuilder.Append(" ---- Scheduled Operation ---- ");
                stringBuilder.Append(" Type: ");
                stringBuilder.Append(operation.OperationType);
                stringBuilder.Append(" ID: ");
                stringBuilder.Append(operation.ScheduleOperationID);
                stringBuilder.Append(" Server Date Time: ");
                stringBuilder.Append(operation.ScheduleDateTime);
            }
        }
        else
        {
            throw new ApplicationException(result.ResultMessage);
        }
    }
    catch (Exception ex)
    {
        // re-run the error
        throw new ApplicationException(ex.Message);
    }

    return stringBuilder.ToString();
}
// IWsEndUser.GetScheduleOccurrences  Method (JAVA)
public static String GetScheduleOccurrences(IWsEndUser client,
    XMLGregorianCalendar dateStart, XMLGregorianCalendar dateEnd)
{
    //specify the account login details 
    ((BindingProvider) client).getRequestContext()
            .put(BindingProvider.USERNAME_PROPERTY, "ARU-0000");
    ((BindingProvider) client).getRequestContext()
            .put(BindingProvider.PASSWORD_PROPERTY, "0123456789");

    StringBuilder stringBuilder = new StringBuilder();

    try
    {
        // create the object GetScheduleOccurrencesRequest  for the request 
        // with data to process
        GetScheduleOccurrencesRequest request = new GetScheduleOccurrencesRequest();
        request.setScheduleStartDate(dateStart);
        request.setScheduleEndDate(dateEnd);

        // call method GetScheduleOccurrences, 
        // obtaining a WsResultOfArrayOfScheduledOperationOccurrence item               
        WsResultOfArrayOfScheduledOperationOccurrence result =
                client.getScheduleOccurrences(request);

        //if the call is Success print history values
        if (result.isSuccess())
        {
            // get Value returned from server
            ArrayOfScheduledOperationOccurrence scheduledOperations = result.getValue();
            List<ScheduledOperationOccurrence> listOfScheduledOperationOccurrence = 
                    scheduledOperations.getScheduledOperationOccurrence();

            for (Iterator<ScheduledOperationOccurrence> it = 
                listOfScheduledOperationOccurrence.iterator(); it.hasNext();)
            {
                ScheduledOperationOccurrence operation = it.next();
                stringBuilder.append(" ---- Scheduled Operation ---- ");
                stringBuilder.append(" Type: ");
                stringBuilder.append(operation.getOperationType());
                stringBuilder.append(" ID: ");
                stringBuilder.append(operation.getScheduleOperationID());
                stringBuilder.append(" Server Date Time: ");
                stringBuilder.append(operation.getScheduleDateTime());
            }
        }
        else
        {
            throw new Exception(result.getResultMessage());
        }
    }
    catch (Exception ex)
    {
        //show result
        System.out.println(ex);
    }

    return stringBuilder.toString();
}
Version
API: v2.8 URL:https://api.dc1.computing.cloud.it/WsEndUser/v2.8/WsEndUser.svc?wsdl
See also