Mercurial > dive4elements > river
view artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/util/CalculationUtils.java @ 9602:6b2496d71936
Reimplemented baseline for tkh. Extended area-dataset to be able to draw baseline.
author | gernotbelger |
---|---|
date | Tue, 12 Feb 2019 14:08:16 +0100 |
parents | 7c7f73e5e01e |
children |
line wrap: on
line source
/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde * Software engineering by * Björnsen Beratende Ingenieure GmbH * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt * * This file is Free Software under the GNU AGPL (>=v3) * and comes with ABSOLUTELY NO WARRANTY! Check out the * documentation coming with Dive4Elements River for details. */ package org.dive4elements.river.artifacts.sinfo.util; import org.dive4elements.artifacts.Artifact; import org.dive4elements.artifacts.ArtifactDatabase; import org.dive4elements.artifacts.CallContext; /** * @author Gernot Belger */ public final class CalculationUtils { private CalculationUtils() { throw new UnsupportedOperationException("Helper class"); } /** * Find the the user of the given artifact, sadly this is not part of the calling context, so instead we determine the * owner oft the artifact * * @param artifact * @param context */ public static String findArtifactUser(final CallContext context, final Artifact artifact) { // REMARK: can't do that, because sometimes the user inside the collection is a fake user // if (context instanceof CollectionCallContext) { // /* avoid db access if we already know the user */ // final CollectionCallContext ccc = (CollectionCallContext) context; // final ArtifactCollection collection = ccc.getCollection(); // final User user = collection.getUser(); // if (user != null) // return user.getName(); // } final ArtifactDatabase database = context.getDatabase(); return database.findArtifactUser(artifact.identifier()); } }