Search in sources :

Example 6 with DataSetInfo

use of org.openlca.ilcd.sources.DataSetInfo in project olca-modules by GreenDelta.

the class SourceExport method makeDateSetInfo.

private DataSetInfo makeDateSetInfo() {
    log.trace("Create data set information.");
    DataSetInfo info = new DataSetInfo();
    info.uuid = source.refId;
    LangString.set(info.name, source.name, config.lang);
    if (source.description != null) {
        LangString.set(info.description, source.description, config.lang);
    }
    addTextReference(info);
    CategoryConverter converter = new CategoryConverter();
    Classification c = converter.getClassification(source.category);
    if (c != null)
        info.classifications.add(c);
    return info;
}
Also used : Classification(org.openlca.ilcd.commons.Classification) DataSetInfo(org.openlca.ilcd.sources.DataSetInfo)

Example 7 with DataSetInfo

use of org.openlca.ilcd.sources.DataSetInfo in project olca-modules by GreenDelta.

the class SourceExport method run.

public Source run(org.openlca.core.model.Source source) {
    if (config.store.contains(Source.class, source.refId))
        return config.store.get(Source.class, source.refId);
    this.source = source;
    log.trace("Run source export with {}", source);
    Source iSource = new Source();
    iSource.version = "1.1";
    iSource.adminInfo = makeAdminInfo();
    SourceInfo info = new SourceInfo();
    iSource.sourceInfo = info;
    DataSetInfo dataSetInfo = makeDateSetInfo();
    info.dataSetInfo = dataSetInfo;
    File extFile = getExternalFile();
    if (extFile == null)
        config.store.put(iSource);
    else {
        addFileRef(dataSetInfo, extFile);
        config.store.put(iSource, new File[] { extFile });
    }
    return iSource;
}
Also used : SourceInfo(org.openlca.ilcd.sources.SourceInfo) DataSetInfo(org.openlca.ilcd.sources.DataSetInfo) File(java.io.File) Source(org.openlca.ilcd.sources.Source)

Aggregations

DataSetInfo (org.openlca.ilcd.sources.DataSetInfo)7 LangString (org.openlca.ilcd.commons.LangString)3 Source (org.openlca.ilcd.sources.Source)3 SourceInfo (org.openlca.ilcd.sources.SourceInfo)3 Test (org.junit.Test)2 SampleSource (org.openlca.ilcd.SampleSource)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 Random (java.util.Random)1 Classification (org.openlca.ilcd.commons.Classification)1 FileRef (org.openlca.ilcd.sources.FileRef)1