| /* |
| * |
| * Copyright (c) 2013, 2016 - 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 v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation |
| * |
| */ |
| |
| package org.eclipse.osbp.xtext.datamartdsl.validation |
| |
| import org.eclipse.osbp.xtext.datamartdsl.Activator |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartDefinition |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartTask |
| import org.eclipse.xtext.validation.Check |
| import org.osgi.framework.Bundle |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartCube |
| import org.eclipse.osbp.xtext.datamartdsl.DatamartRole |
| |
| /** |
| * Custom validation rules. |
| * |
| * see http://www.eclipse.org/Xtext/documentation.html#validation |
| */ |
| class DatamartDSLValidator extends AbstractDatamartDSLValidator { |
| |
| @Check |
| def checkCommercialLicensed(DatamartDefinition datamart) { |
| if ((datamart.source instanceof DatamartTask)) { |
| for (Bundle b : Activator.getContext().getBundles()) { |
| if (b.getSymbolicName().startsWith("net.osbee.bpm")) { |
| return; |
| } |
| } |
| info( |
| '''BPM is needed and not yet licensed. License BPM at www.osbee.net''', |
| datamart, |
| null) |
| } |
| if ((datamart.source instanceof DatamartCube)) { |
| for (Bundle b : Activator.getContext().getBundles()) { |
| if (b.getSymbolicName().startsWith("net.osbee.xtext.cubedsl")) { |
| return; |
| } |
| } |
| info( |
| '''Cube is needed and not yet licensed. License Cube at www.osbee.net''', |
| datamart, |
| null) |
| } |
| } |
| |
| @Check |
| def checkSecurityLicensed(DatamartRole role) { |
| for (Bundle b : Activator.getContext().getBundles()) { |
| if (b.getSymbolicName().startsWith("net.osbee.xtext.organization")) { |
| return; |
| } |
| } |
| info( |
| '''Authorization is needed and not yet licensed. License Authorization at www.osbee.net''', |
| role, |
| null) |
| } |
| } |