Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-29921

Make CSVImportStatus operation result serializable as CSVImportStatus by the Java client

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: CSV Importer, Java Client

      Description

      Expected with org.nuxeo.client.NuxeoClient:

      String workId = client.operation(CSVImportOperation.ID)
                                  .param(...)
                                  .input(...)
                                  .execute();
      CSVImportStatus workStatus = client.operation(CSVImportStatusOperation.ID).input(workId).execute();
      

      But the command returns null.

      Current solution is to implement the deserialization following https://doc.nuxeo.com/client-java/3.2/advanced-usage/:

      public static class CSVImportStatusJSONObject extends Entity {
      
          public static final String ENTITY_TYPE = "org.nuxeo.ecm.csv.core.CSVImportStatus";
      
          public CSVImportStatusJSONObject() {
              super(ENTITY_TYPE);
          }
      
          public CSVImportStatusWithConstructor getValue() {
              return value;
          }
      
          public void setValue(CSVImportStatusWithConstructor value) {
              this.value = value;
          }
      
          CSVImportStatusWithConstructor value;
      }
      
      public static class CSVImportStatusWithConstructor extends CSVImportStatus {
      
          @JsonCreator
          public CSVImportStatusWithConstructor(@JsonProperty("state") State state) {
              super(state);
          }
      }
      
      NuxeoClient client = new NuxeoClient.Builder().registerEntity(CSVImportStatusJSONObject.ENTITY_TYPE, CSVImportStatusJSONObject.class).connect();
      String workId = client.operation(CSVImportOperation.ID) .param(...) .input(...) .execute();
      CSVImportStatus workStatus = client.operation(CSVImportStatusOperation.ID)
                                             .input(workId).<CSVImportStatusJSONObject>execute().value;

      A CSV writer is needed.

      Worth to improve in the mean time:

      • it would be useful if the operation also returned back the work ID
      • a pretty toString() method
      • org.nuxeo.ecm.csv.core.CSVImportStatus.State#ERROR is missing a getter compared to isComplete(), isRunning(), isScheduled()
      • same with the other CSV operations: CSVImportResult, ... and primitive types: String, ...

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                jcarsique Julien Carsique
                Participants:
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: