Mercurial > dive4elements > river
diff artifacts/src/main/java/org/dive4elements/river/utils/RiverUtils.java @ 5867:59ff03ff48f1
River artifacts: Renamed FLYSArtifact(Collection) to D4EArtifact(Collection).
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Sun, 28 Apr 2013 15:23:01 +0200 |
parents | 9a6741ccf6d4 |
children | af13ceeba52a |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/utils/RiverUtils.java Sun Apr 28 15:14:30 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/utils/RiverUtils.java Sun Apr 28 15:23:01 2013 +0200 @@ -13,7 +13,7 @@ import org.dive4elements.artifacts.CallContext; import org.dive4elements.artifacts.common.utils.Config; import org.dive4elements.artifacts.common.utils.XMLUtils; -import org.dive4elements.river.artifacts.FLYSArtifact; +import org.dive4elements.river.artifacts.D4EArtifact; import org.dive4elements.river.artifacts.StaticWKmsArtifact; import org.dive4elements.river.artifacts.WINFOArtifact; import org.dive4elements.river.artifacts.access.RangeAccess; @@ -50,7 +50,7 @@ /** - * Static helper methods to e.g. access FLYSArtifacts data. + * Static helper methods to e.g. access D4EArtifacts data. * * @deprecated Don't use RiverUtils to get data from an {@link Artifact} anymore. * Instead use and/or create a {@link Access} class hierarchy. @@ -111,9 +111,9 @@ /** * Pulls Artifact with given UUID fromm database. - * @return FLYSArtifact with given UUID or null (in case of errors). + * @return D4EArtifact with given UUID or null (in case of errors). */ - public static FLYSArtifact getArtifact(String uuid, CallContext context) { + public static D4EArtifact getArtifact(String uuid, CallContext context) { try { Artifact artifact = context.getDatabase().getRawArtifact(uuid); @@ -122,16 +122,16 @@ return null; } - if (!(artifact instanceof FLYSArtifact)) { - logger.error("Artifact '" +uuid+ "' is no valid FLYSArtifact."); + if (!(artifact instanceof D4EArtifact)) { + logger.error("Artifact '" +uuid+ "' is no valid D4EArtifact."); return null; } - return (FLYSArtifact) artifact; + return (D4EArtifact) artifact; } // TODO: catch more selective catch (Exception e) { - logger.error("Cannot get FLYSArtifact " + uuid + logger.error("Cannot get D4EArtifact " + uuid + " from database (" + e.getMessage() + ")."); return null; } @@ -182,11 +182,11 @@ * stored in <i>flys</i> Artifact. If there is no <i>wq_isq</i> parameter * existing, WQ_MODE.NONE is returned. * - * @param flys The FLYSArtifact that stores wq mode relevant parameters. + * @param flys The D4EArtifact that stores wq mode relevant parameters. * * @return an enum WQ_MODE. */ - public static WQ_MODE getWQMode(FLYSArtifact flys) { + public static WQ_MODE getWQMode(D4EArtifact flys) { if (flys == null) { return WQ_MODE.NONE; } @@ -212,7 +212,7 @@ } - public static WQ_INPUT getWQInputMode(FLYSArtifact flys) { + public static WQ_INPUT getWQInputMode(D4EArtifact flys) { if (flys == null) { return WQ_INPUT.NONE; } @@ -238,7 +238,7 @@ * @param flysArtifact artifact which has a "river" data. * @return double array. min is at[0], max at[1]. null if given artifact is null */ - public static double[] getRiverMinMax(FLYSArtifact flysArtifact) { + public static double[] getRiverMinMax(D4EArtifact flysArtifact) { if (flysArtifact == null) { return null; } @@ -259,7 +259,7 @@ } - public static double[] getKmFromTo(FLYSArtifact flys) { + public static double[] getKmFromTo(D4EArtifact flys) { String strFrom = flys.getDataAsString("ld_from"); String strTo = flys.getDataAsString("ld_to"); @@ -291,7 +291,7 @@ * (from ld_locations data), null if not parameterized this way. */ // TODO moved to RangeAccess. Resolve remaining calls. - private static double[] getLocations(FLYSArtifact flys) { + private static double[] getLocations(D4EArtifact flys) { String locationStr = flys.getDataAsString("ld_locations"); if (locationStr == null || locationStr.length() == 0) { @@ -327,14 +327,14 @@ /** - * Returns the Qs for a given FLYSArtifact. This method currently accepts + * Returns the Qs for a given D4EArtifact. This method currently accepts * only instances of WINFOArtifact. * - * @param flys A FLYSArtifact. + * @param flys A D4EArtifact. * * @return the Qs. */ - public static double[] getQs(FLYSArtifact flys) { + public static double[] getQs(D4EArtifact flys) { // XXX this is not nice! if (flys instanceof WINFOArtifact) { return ((WINFOArtifact) flys).getQs(); @@ -347,14 +347,14 @@ /** - * Returns the Ws for a given FLYSArtifact. This method currently accepts + * Returns the Ws for a given D4EArtifact. This method currently accepts * only instances of WINFOArtifact. * - * @param flys A FLYSArtifact. + * @param flys A D4EArtifact. * * @return the Ws. */ - public static double[] getWs(FLYSArtifact flys) { + public static double[] getWs(D4EArtifact flys) { // XXX this is not nice! if (flys instanceof WINFOArtifact) { return ((WINFOArtifact) flys).getWs(); @@ -372,7 +372,7 @@ * * @return the selected River or null if no river has been chosen yet. */ - public static River getRiver(FLYSArtifact flys) { + public static River getRiver(D4EArtifact flys) { String sRiver = getRivername(flys); return (sRiver != null) @@ -385,11 +385,11 @@ * Returns the name of the river specified in the given <i>flys</i> * Artifact. * - * @param flys The FLYSArtifact that stores a river relevant information. + * @param flys The D4EArtifact that stores a river relevant information. * * @return the name of the specified river or null. */ - public static String getRivername(FLYSArtifact flys) { + public static String getRivername(D4EArtifact flys) { return flys != null ? flys.getDataAsString("river") : null; } @@ -398,11 +398,11 @@ * Extracts the SRID defined in the global configuration for the river * specified in <i>artifact</i>. * - * @param artifact The FLYSArtifact that stores the name of the river. + * @param artifact The D4EArtifact that stores the name of the river. * * @return the SRID as string (e.g. "31466"). */ - public static String getRiverSrid(FLYSArtifact artifact) { + public static String getRiverSrid(D4EArtifact artifact) { String river = artifact.getDataAsString("river"); if (river == null || river.length() == 0) { @@ -451,7 +451,7 @@ * @param flys the artifact in question. * @return (First) gauge of locations of river of artifact. */ - public static Gauge getGauge(FLYSArtifact flys) { + public static Gauge getGauge(D4EArtifact flys) { River river = getRiver(flys); if (river == null) { @@ -482,14 +482,14 @@ } - public static String getGaugename(FLYSArtifact flys) { + public static String getGaugename(D4EArtifact flys) { Gauge gauge = getGauge(flys); return gauge != null ? gauge.getName() : null; } - public static Gauge getReferenceGauge(FLYSArtifact flys) { + public static Gauge getReferenceGauge(D4EArtifact flys) { Long officialNumber = flys.getDataAsLong("reference_gauge"); return officialNumber != null @@ -498,7 +498,7 @@ } - public static String getReferenceGaugeName(FLYSArtifact flys) { + public static String getReferenceGaugeName(D4EArtifact flys) { Gauge refGauge = getReferenceGauge(flys); return refGauge != null @@ -698,15 +698,15 @@ /** * This method returns the description for a given <i>km</i> for a specific - * river. The river is provided by the FLYSArtifact <i>flys</i>. + * river. The river is provided by the D4EArtifact <i>flys</i>. * - * @param flys The FLYSArtifact that provides a river. + * @param flys The D4EArtifact that provides a river. * @param km The kilometer. * * @return the description for <i>km</i> or an empty string if no * description was found. */ - public static String getLocationDescription(FLYSArtifact flys, double km) { + public static String getLocationDescription(D4EArtifact flys, double km) { String river = getRivername(flys); if (river == null) { @@ -907,7 +907,7 @@ * @return the gauges based on the selected kilometer range (null if * none/no range set). */ - public static List<Gauge> getGauges(FLYSArtifact flys) { + public static List<Gauge> getGauges(D4EArtifact flys) { River river = getRiver(flys); if (river == null) {