diff --git a/saiku-core/saiku-service/src/main/java/mondrian/olap4j/Checker.java b/saiku-core/saiku-service/src/main/java/mondrian/olap4j/Checker.java new file mode 100644 index 0000000000..974e190284 --- /dev/null +++ b/saiku-core/saiku-service/src/main/java/mondrian/olap4j/Checker.java @@ -0,0 +1,28 @@ +/* + * Copyright 2014 OSBI Ltd + * + * Licensed 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 + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 mondrian.olap4j; + +import org.olap4j.metadata.Level; + +/** + * Created by bugg on 18/02/15. + */ +public class Checker { + public boolean checker(Level level){ + return level instanceof MondrianOlap4jLevel; + } +} diff --git a/saiku-core/saiku-service/src/main/java/org/saiku/olap/util/ObjectUtil.java b/saiku-core/saiku-service/src/main/java/org/saiku/olap/util/ObjectUtil.java index 3f485c3b03..ba5b134222 100644 --- a/saiku-core/saiku-service/src/main/java/org/saiku/olap/util/ObjectUtil.java +++ b/saiku-core/saiku-service/src/main/java/org/saiku/olap/util/ObjectUtil.java @@ -39,8 +39,8 @@ import java.util.*; import mondrian.olap.Annotation; +import mondrian.olap4j.Checker; import mondrian.olap4j.LevelInterface; -import mondrian.olap4j.MondrianOlap4jLevel; /** @@ -140,13 +140,14 @@ public static List convertLevels(@NotNull List levels) { @NotNull private static SaikuLevel convert(@NotNull Level level) { + Checker c= new Checker(); try { try { Class.forName("mondrian.olap4j.MondrianOlap4jLevelExtend"); //Class.forName("bi.meteorite.CheckClass"); Class _tempClass = (Class) Class.forName("mondrian.olap4j.MondrianOlap4jLevelExtend"); - if(level instanceof MondrianOlap4jLevel) { + if(c.checker(level)){ Constructor ctor = _tempClass.getDeclaredConstructor(org.olap4j.metadata.Level.class); LevelInterface test = ctor.newInstance(level); HashMap m = null;