001package org.hl7.fhir.r5.elementmodel; 002 003import java.util.ArrayList; 004import java.util.List; 005 006import lombok.Getter; 007import lombok.Setter; 008import org.hl7.fhir.utilities.validation.ValidationMessage; 009 010public class ValidatedFragment { 011 012 @Getter 013 private String name; 014 015 @Getter @Setter 016 private String elementPath; 017 018 @Getter 019 private String extension; 020 021 @Getter @Setter 022 private Element element; 023 024 @Getter @Setter 025 private byte[] content; 026 027 @Getter 028 private final boolean isDerivedContent; 029 public final static String FOCUS_NAME = "focus"; 030 public final static String ITEM_NAME = "item"; 031 032 @Getter 033 private List<ValidationMessage> errors = new ArrayList<>(); 034 035 036 public ValidatedFragment(String name, String extension, Element element, byte[] content, boolean isDerivedContent) { 037 super(); 038 this.name = name; 039 this.element = element; 040 this.content = content; 041 this.extension = extension; 042 this.isDerivedContent = isDerivedContent; 043 } 044 045 public ValidatedFragment(String name, String extension, byte[] content, boolean isDerivedContent) { 046 super(); 047 this.name = name; 048 this.content = content; 049 this.extension = extension; 050 this.isDerivedContent = isDerivedContent; 051 } 052 public String getFilename() { 053 return name+"."+extension; 054 } 055 056 public String path() { 057 return elementPath == null ? name : elementPath; 058 } 059}