private void doWriteTime(TemporalProposition proposition) throws IOException {
   StringUtil.escapeAndWriteDelimitedColumn(
       proposition.getStartFormattedShort(), COLUMN_DELIMITER, this.writer);
   this.writer.write(COLUMN_DELIMITER);
   String finish = proposition.getFinishFormattedShort();
   if (!finish.isEmpty()) {
     StringUtil.escapeAndWriteDelimitedColumn(finish, COLUMN_DELIMITER, this.writer);
   }
 }
Example #2
0
 /**
  * Writes a column, inserting a delimiter as needed.
  *
  * @param column the column contents.
  * @throws IOException if an error occurs writing to the {@link Writer}.
  */
 public void write(String column) throws IOException {
   if (!this.firstColumn) {
     this.writer.write(this.delimiter);
   }
   StringUtil.escapeAndWriteDelimitedColumn(column, this.delimiter, this.writer);
   this.firstColumn = false;
 }
 private static SourceConfigParams toParams(SourceConfig config) {
   SourceConfigParams params = new SourceConfigParams();
   params.setId(config.getId());
   String displayName = config.getDisplayName();
   if (StringUtil.getEmptyOrNull(displayName)) {
     displayName = config.getId();
   }
   params.setName(displayName);
   List<Upload> uploads = new ArrayList<>();
   for (Section section : config.getDataSourceBackends()) {
     Upload upload = null;
     String sourceId = null;
     String sampleUrl = null;
     for (SourceConfigOption option : section.getOptions()) {
       if (option instanceof FileSourceConfigOption) {
         upload = new Upload();
         upload.setName(section.getDisplayName());
         upload.setAcceptedMimetypes(((FileSourceConfigOption) option).getAcceptedMimetypes());
         if (sourceId != null) {
           upload.setSourceId(sourceId);
         }
         if (sampleUrl != null) {
           upload.setSampleUrl(sampleUrl);
         }
         upload.setRequired(option.isRequired());
       } else if (option.getName().equals("dataFileDirectoryName")) {
         Object val = option.getValue();
         if (val != null) {
           sourceId = val.toString();
           if (upload != null) {
             upload.setSourceId(sourceId);
           }
         }
       } else if (option.getName().equals("sampleUrl")) {
         Object val = option.getValue();
         if (val != null) {
           sampleUrl = val.toString();
           if (upload != null) {
             upload.setSampleUrl(sampleUrl);
           }
         }
       }
     }
     if (upload != null) {
       uploads.add(upload);
     }
   }
   params.setUploads(uploads.toArray(new Upload[uploads.size()]));
   return params;
 }
 private void doWriteValue(Parameter parameter) throws IOException {
   StringUtil.escapeAndWriteDelimitedColumn(
       parameter.getValueFormatted(), COLUMN_DELIMITER, this.writer);
   this.writer.write(COLUMN_DELIMITER);
 }
 private void doWritePropId(Proposition proposition) throws IOException {
   StringUtil.escapeAndWriteDelimitedColumn(proposition.getId(), COLUMN_DELIMITER, this.writer);
   this.writer.write(COLUMN_DELIMITER);
 }
 private void doWriteKeyId() throws IOException {
   StringUtil.escapeAndWriteDelimitedColumn(this.keyId, COLUMN_DELIMITER, this.writer);
   this.writer.write(COLUMN_DELIMITER);
 }