Uploaded image for project: 'Spring Batch Admin'
  1. Spring Batch Admin
  2. BATCHADM-223

Keeping elements order in /jobs/executions.json

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.0.0
    • Fix Version/s: 1.3.2
    • Component/s: Manager
    • Labels:
      None

      Description

      The JSON API of the /jobs/executions endpoint returns a map of items. Map key is the ID of the item (ie. JobExecution)
      In the JSON stream, Items are sorted from the most recent to the older.
      Some JSON parser do not keep the items order because of the nature of the map structure which may be not sorted. In some situation, items are re-order with alphabetical order.
      To keep job execution order, a solution is to convert the map to an array.

      Original :

      {"jobExecutions" : {
      		"1" : {
      			"status" : "FAILED",
      			"startDate" : "2015-05-27",
      			"startTime" : "08:22:32",
      			"duration" : "00:00:00",
      			"resource" : "http://localhost:8080/spring-batch-admin-sample/jobs/executions/1.json",
      			"jobParameters" : {
      			}
      		},
      		"0" : {
      			"status" : "FAILED",
      			"startDate" : "2015-05-27",
      			"startTime" : "08:22:29",
      			"duration" : "00:00:00",
      			"resource" : "http://localhost:8080/spring-batch-admin-sample/jobs/executions/0.json",
      			"jobParameters" : {
      			}
      		}
      	}
      }
      

      Fix:

      {"jobExecutions" : [
      		{      "id" : "1",
      			"status" : "FAILED",
      			"startDate" : "2015-05-27",
      			"startTime" : "08:22:32",
      			"duration" : "00:00:00",
      			"resource" : "http://localhost:8080/spring-batch-admin-sample/jobs/executions/1.json",
      			"jobParameters" : {
      			}
      		},
      		{      "id" : "0",
      			"status" : "FAILED",
      			"startDate" : "2015-05-27",
      			"startTime" : "08:22:29",
      			"duration" : "00:00:00",
      			"resource" : "http://localhost:8080/spring-batch-admin-sample/jobs/executions/0.json",
      			"jobParameters" : {
      			}
      		}
      	]
      }
      

        Attachments

          Activity

            People

            • Assignee:
              mminella Michael Minella
              Reporter:
              elryk Elryk
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: