| /** |
| * Copyright (c) 2011, 2018 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) |
| * |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation |
| */ |
| package org.eclipse.osbp.xtext.datamartdsl.util; |
| |
| import org.eclipse.emf.common.util.EList; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartHierarchy; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartHierarchyLevel; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartHierarchyLevelMultiple; |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartHierarchyLevelSingle; |
| |
| @SuppressWarnings("all") |
| public class DatamartHierarchyUtil { |
| public boolean existLevelDefinition(final DatamartHierarchy hierarchy) { |
| if (((hierarchy.getLevel() instanceof DatamartHierarchyLevelSingle) && (((DatamartHierarchyLevelSingle) hierarchy.getLevel()).getLevelRef() != null))) { |
| return true; |
| } else { |
| DatamartHierarchyLevel _level = hierarchy.getLevel(); |
| if ((_level instanceof DatamartHierarchyLevelMultiple)) { |
| boolean result = false; |
| DatamartHierarchyLevel _level_1 = hierarchy.getLevel(); |
| EList<DatamartHierarchyLevelSingle> _levels = ((DatamartHierarchyLevelMultiple) _level_1).getLevels(); |
| for (final DatamartHierarchyLevelSingle hierarchyLevelSingle : _levels) { |
| result = (result || (hierarchyLevelSingle.getLevelRef() != null)); |
| } |
| return result; |
| } |
| } |
| return false; |
| } |
| } |