private FileDatesDto getDatesFromContent()

in ddm-rrm-business-process-management/src/main/java/com/epam/digital/data/platform/management/service/impl/BusinessProcessServiceImpl.java [212:233]


  private FileDatesDto getDatesFromContent(String processContent) {
    FileDatesDto fileDatesDto = FileDatesDto.builder().build();
    Document doc;
    try {
      doc = documentBuilder.parse(new InputSource(new StringReader(processContent)));
    } catch (SAXException | IOException exception) {
      throw new RuntimeException("Could not parse xml document", exception);
    }
    doc.getDocumentElement().normalize();
    Element element = doc.getDocumentElement();
    if (element.hasAttribute(PROCESS_MODIFIED_PATH)) {
      fileDatesDto.setUpdate(
          LocalDateTime.parse(
              element.getAttribute(PROCESS_MODIFIED_PATH), JacksonConfig.DATE_TIME_FORMATTER));
    }
    if (element.hasAttribute(PROCESS_CREATED_PATH)) {
      fileDatesDto.setCreate(
          LocalDateTime.parse(
              element.getAttribute(PROCESS_CREATED_PATH), JacksonConfig.DATE_TIME_FORMATTER));
    }
    return fileDatesDto;
  }