You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lens.apache.org by su...@apache.org on 2015/12/17 13:52:46 UTC

lens git commit: LENS-903 : No candidate dim available exception should contain only brief error - added missing file

Repository: lens
Updated Branches:
  refs/heads/master b84cb2cd3 -> d6aeecc73


LENS-903 : No candidate dim available exception should contain only brief error - added missing file


Project: http://git-wip-us.apache.org/repos/asf/lens/repo
Commit: http://git-wip-us.apache.org/repos/asf/lens/commit/d6aeecc7
Tree: http://git-wip-us.apache.org/repos/asf/lens/tree/d6aeecc7
Diff: http://git-wip-us.apache.org/repos/asf/lens/diff/d6aeecc7

Branch: refs/heads/master
Commit: d6aeecc7306d9cd37dacd53caa0dfd842ca48bdc
Parents: b84cb2c
Author: Sushil Mohanty <su...@apache.org>
Authored: Thu Dec 17 18:22:26 2015 +0530
Committer: Sushil Mohanty <su...@apache.org>
Committed: Thu Dec 17 18:22:26 2015 +0530

----------------------------------------------------------------------
 .../error/NoCandidateDimAvailableException.java | 47 ++++++++++++++++++++
 1 file changed, 47 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lens/blob/d6aeecc7/lens-cube/src/main/java/org/apache/lens/cube/error/NoCandidateDimAvailableException.java
----------------------------------------------------------------------
diff --git a/lens-cube/src/main/java/org/apache/lens/cube/error/NoCandidateDimAvailableException.java b/lens-cube/src/main/java/org/apache/lens/cube/error/NoCandidateDimAvailableException.java
new file mode 100644
index 0000000..ef76dc6
--- /dev/null
+++ b/lens-cube/src/main/java/org/apache/lens/cube/error/NoCandidateDimAvailableException.java
@@ -0,0 +1,47 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.lens.cube.error;
+
+import org.apache.lens.cube.metadata.CubeDimensionTable;
+import org.apache.lens.cube.parse.PruneCauses;
+import org.apache.lens.server.api.error.LensException;
+
+public class NoCandidateDimAvailableException extends LensException {
+
+  private final PruneCauses<CubeDimensionTable> briefAndDetailedError;
+
+  public NoCandidateDimAvailableException(PruneCauses<CubeDimensionTable> briefAndDetailedError) {
+    super(LensCubeErrorCode.NO_CANDIDATE_DIM_AVAILABLE.getLensErrorInfo(), briefAndDetailedError.getBriefCause());
+    this.briefAndDetailedError = briefAndDetailedError;
+  }
+
+  public PruneCauses.BriefAndDetailedError getJsonMessage() {
+    return briefAndDetailedError.toJsonObject();
+  }
+
+  @Override
+  public int compareTo(LensException e) {
+    //Compare the max CandidateTablePruneCode coming from different instances.
+    if (e instanceof NoCandidateDimAvailableException) {
+      return briefAndDetailedError.getMaxCause().compareTo(
+              ((NoCandidateDimAvailableException) e).briefAndDetailedError.getMaxCause());
+    }
+    return super.compareTo(e);
+  }
+}