use of spold2.DataGenerator in project olca-modules by GreenDelta.
the class ProcessDoc method mapPublication.
private void mapPublication(DataGenerator generator) {
if (doc.publication == null)
return;
Source source = addSource(doc.publication);
generator.publishedSourceId = source.id;
generator.publishedSourceFirstAuthor = source.firstAuthor;
generator.publishedSourceYear = source.year;
}
use of spold2.DataGenerator in project olca-modules by GreenDelta.
the class DocImportMapper method mapPublicationSource.
private void mapPublicationSource(AdminInfo adminInfo) {
DataGenerator gen = adminInfo.dataGenerator;
if (gen == null || gen.publishedSourceId == null)
return;
SourceDao dao = new SourceDao(database);
Source source = dao.getForRefId(gen.publishedSourceId);
if (source == null) {
source = new Source();
source.refId = gen.publishedSourceId;
StringBuilder title = new StringBuilder();
StringBuilder shortTitle = new StringBuilder();
if (gen.publishedSourceFirstAuthor != null) {
title.append(gen.publishedSourceFirstAuthor);
shortTitle.append(gen.publishedSourceFirstAuthor);
}
if (gen.publishedSourceYear != null) {
title.append(gen.publishedSourceYear);
shortTitle.append(gen.publishedSourceYear);
}
source.textReference = title.toString();
source.name = shortTitle.toString();
source = dao.insert(source);
}
doc.publication = source;
}
use of spold2.DataGenerator in project olca-modules by GreenDelta.
the class DocImportMapper method mapDataGenerator.
private void mapDataGenerator(AdminInfo adminInfo) {
DataGenerator dataGenerator = adminInfo.dataGenerator;
if (dataGenerator == null || dataGenerator.personId == null)
return;
ActorDao dao = new ActorDao(database);
Actor actor = dao.getForRefId(dataGenerator.personId);
if (actor == null) {
actor = new Actor();
actor.refId = dataGenerator.personId;
actor.email = dataGenerator.personEmail;
actor.name = dataGenerator.personName;
actor = dao.insert(actor);
}
doc.dataGenerator = actor;
}
use of spold2.DataGenerator in project olca-modules by GreenDelta.
the class ProcessDoc method mapDataGenerator.
private void mapDataGenerator(AdminInfo adminInfo) {
DataGenerator generator = new DataGenerator();
adminInfo.dataGenerator = generator;
generator.isCopyrightProtected = doc.copyright;
mapPublication(generator);
Actor actor = doc.dataGenerator;
if (actor == null) {
generator.personEmail = "no@email.com";
generator.personId = "788d0176-a69c-4de0-a5d3-259866b6b100";
generator.personName = "[Current User]";
} else {
Person person = addPerson(actor);
generator.personEmail = person.email;
generator.personId = person.id;
generator.personName = person.email;
}
}