use of org.openlca.ilcd.sources.FileRef in project olca-modules by GreenDelta.
the class SourceExport method addFileRef.
private void addFileRef(DataSetInfo info, File extFile) {
FileRef fileRef = new FileRef();
fileRef.uri = "../external_docs/" + extFile.getName();
info.files.add(fileRef);
}
use of org.openlca.ilcd.sources.FileRef in project olca-modules by GreenDelta.
the class SourceBag method getExternalFileURIs.
public List<String> getExternalFileURIs() {
DataSetInfo info = getDataSetInformation();
if (info == null)
return Collections.emptyList();
List<FileRef> refs = info.files;
List<String> uris = new ArrayList<>();
for (FileRef ref : refs) {
if (ref.uri != null)
uris.add(ref.uri);
}
return uris;
}
use of org.openlca.ilcd.sources.FileRef in project olca-modules by GreenDelta.
the class SourceWithFileTest method addFileLink.
private void addFileLink(Source source, File file) {
FileRef ref = new FileRef();
ref.uri = "../external_docs/" + file.getName();
source.sourceInfo.dataSetInfo.files.add(ref);
}
use of org.openlca.ilcd.sources.FileRef in project olca-modules by GreenDelta.
the class SourcesFileNameTest method testWebPath.
@Test
public void testWebPath() {
FileRef ref = new FileRef();
ref.uri = "http://mysoda.com/external_docs/mydoc.pdf";
assertEquals("mydoc.pdf", Sources.getFileName(ref));
}
use of org.openlca.ilcd.sources.FileRef in project olca-modules by GreenDelta.
the class SourcesFileNameTest method testRelativePath.
@Test
public void testRelativePath() {
FileRef ref = new FileRef();
ref.uri = "../external_docs/mydoc.pdf";
assertEquals("mydoc.pdf", Sources.getFileName(ref));
ref.uri = "..\\external_docs\\mydoc.pdf";
assertEquals("mydoc.pdf", Sources.getFileName(ref));
}
Aggregations