blob: 7275ac11c5a88000d4f5e4dd07bf1ed9748f5dcb [file] [log] [blame]
/**
* 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.DatamartCube;
import org.eclipse.osbp.xtext.datamartdsl.DatamartDefinition;
import org.eclipse.osbp.xtext.datamartdsl.DatamartRole;
import org.eclipse.osbp.xtext.datamartdsl.DatamartSource;
import org.eclipse.osbp.xtext.datamartdsl.DatamartTask;
import org.eclipse.osbp.xtext.datamartdsl.validation.AbstractDatamartDSLValidator;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.validation.Check;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
/**
* Custom validation rules.
*
* see http://www.eclipse.org/Xtext/documentation.html#validation
*/
@SuppressWarnings("all")
public class DatamartDSLValidator extends AbstractDatamartDSLValidator {
@Check
public void checkCommercialLicensed(final DatamartDefinition datamart) {
DatamartSource _source = datamart.getSource();
if ((_source instanceof DatamartTask)) {
BundleContext _context = Activator.getContext();
Bundle[] _bundles = _context.getBundles();
for (final Bundle b : _bundles) {
String _symbolicName = b.getSymbolicName();
boolean _startsWith = _symbolicName.startsWith("net.osbee.bpm");
if (_startsWith) {
return;
}
}
StringConcatenation _builder = new StringConcatenation();
_builder.append("BPM is needed and not yet licensed. License BPM at www.osbee.net");
this.info(_builder.toString(), datamart,
null);
}
DatamartSource _source_1 = datamart.getSource();
if ((_source_1 instanceof DatamartCube)) {
BundleContext _context_1 = Activator.getContext();
Bundle[] _bundles_1 = _context_1.getBundles();
for (final Bundle b_1 : _bundles_1) {
String _symbolicName_1 = b_1.getSymbolicName();
boolean _startsWith_1 = _symbolicName_1.startsWith("net.osbee.xtext.cubedsl");
if (_startsWith_1) {
return;
}
}
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("Cube is needed and not yet licensed. License Cube at www.osbee.net");
this.info(_builder_1.toString(), datamart,
null);
}
}
@Check
public void checkSecurityLicensed(final DatamartRole role) {
BundleContext _context = Activator.getContext();
Bundle[] _bundles = _context.getBundles();
for (final Bundle b : _bundles) {
String _symbolicName = b.getSymbolicName();
boolean _startsWith = _symbolicName.startsWith("net.osbee.xtext.organization");
if (_startsWith) {
return;
}
}
StringConcatenation _builder = new StringConcatenation();
_builder.append("Authorization is needed and not yet licensed. License Authorization at www.osbee.net");
this.info(_builder.toString(), role,
null);
}
}