Mercurial > dive4elements > river
view artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/util/CalculationUtils.java @ 9311:7c7f73e5e01e
Moved chart metadata line to top of chart. Minor cleanup.
author | gernotbelger |
---|---|
date | Thu, 26 Jul 2018 11:16:06 +0200 |
parents | d9dbf0b74bc2 |
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()); } }