Ejemplo n.º 1
0
 @Check
 public void checkGenerators(final MobaApplication application) {
   boolean activeFound = false;
   int firstIndex = (-1);
   List<MobaGenerator> _generators = application.getGenerators();
   int _size = _generators.size();
   boolean _greaterThan = (_size > 1);
   if (_greaterThan) {
     List<MobaGenerator> _generators_1 = application.getGenerators();
     for (final MobaGenerator generator : _generators_1) {
       {
         if ((firstIndex == (-1))) {
           EList<MobaApplicationFeature> _features = application.getFeatures();
           int _indexOf = _features.indexOf(generator);
           firstIndex = _indexOf;
         }
         boolean _and = false;
         if (!activeFound) {
           _and = false;
         } else {
           boolean _isActive = generator.isActive();
           _and = _isActive;
         }
         if (_and) {
           EList<MobaApplicationFeature> _features_1 = application.getFeatures();
           final int index = _features_1.indexOf(generator);
           StringConcatenation _builder = new StringConcatenation();
           _builder.append(
               "You are using multiple generators. Please define the active attribute for ONLY one generator.");
           this.error(
               _builder.toString(),
               application,
               MobaPackage.Literals.MOBA_APPLICATION__FEATURES,
               index);
           return;
         }
         if ((!activeFound)) {
           boolean _isActive_1 = generator.isActive();
           activeFound = _isActive_1;
         }
       }
     }
     if ((!activeFound)) {
       StringConcatenation _builder = new StringConcatenation();
       _builder.append(
           "You are using multiple generators. Please define the #active attribute for one generator.");
       this.error(
           _builder.toString(),
           application,
           MobaPackage.Literals.MOBA_APPLICATION__FEATURES,
           firstIndex);
     }
   }
 }
Ejemplo n.º 2
0
 @Check
 public void checkDuplicateFeatureName(final MobaApplication application) {
   final Set<String> tempConstFeatures = CollectionLiterals.<String>newHashSet();
   final Set<String> tempDtFeatures = CollectionLiterals.<String>newHashSet();
   final Set<String> tempDataFeatures = CollectionLiterals.<String>newHashSet();
   final Set<String> tempServiceFeatures = CollectionLiterals.<String>newHashSet();
   final Set<String> tempSettingsFeatures = CollectionLiterals.<String>newHashSet();
   int index = 0;
   EList<MobaApplicationFeature> _features = application.getFeatures();
   for (final MobaApplicationFeature feature : _features) {
     {
       boolean _matched = false;
       if (!_matched) {
         if (feature instanceof MobaConstant) {
           _matched = true;
           String _name = ((MobaConstant) feature).getName();
           boolean _contains = tempConstFeatures.contains(_name);
           if (_contains) {
             this.error(
                 "Name must be unique",
                 application,
                 MobaPackage.Literals.MOBA_APPLICATION__FEATURES,
                 index);
           }
           String _name_1 = ((MobaConstant) feature).getName();
           tempConstFeatures.add(_name_1);
         }
       }
       if (!_matched) {
         if (feature instanceof MobaDataType) {
           _matched = true;
           String _name = ((MobaDataType) feature).getName();
           boolean _contains = tempDtFeatures.contains(_name);
           if (_contains) {
             this.error(
                 "Name must be unique",
                 application,
                 MobaPackage.Literals.MOBA_APPLICATION__FEATURES,
                 index);
           }
           String _name_1 = ((MobaDataType) feature).getName();
           tempDtFeatures.add(_name_1);
         }
       }
       if (!_matched) {
         if (feature instanceof MobaEntity) {
           _matched = true;
           String _name = ((MobaEntity) feature).getName();
           boolean _contains = tempDataFeatures.contains(_name);
           if (_contains) {
             this.error(
                 "Name must be unique",
                 application,
                 MobaPackage.Literals.MOBA_APPLICATION__FEATURES,
                 index);
           }
           String _name_1 = ((MobaEntity) feature).getName();
           tempDataFeatures.add(_name_1);
         }
       }
       if (!_matched) {
         if (feature instanceof MobaDto) {
           _matched = true;
           String _name = ((MobaDto) feature).getName();
           boolean _contains = tempDataFeatures.contains(_name);
           if (_contains) {
             this.error(
                 "Name must be unique",
                 application,
                 MobaPackage.Literals.MOBA_APPLICATION__FEATURES,
                 index);
           }
           String _name_1 = ((MobaDto) feature).getName();
           tempDataFeatures.add(_name_1);
         }
       }
       if (!_matched) {
         if (feature instanceof MobaQueue) {
           _matched = true;
           String _name = ((MobaQueue) feature).getName();
           boolean _contains = tempDataFeatures.contains(_name);
           if (_contains) {
             this.error(
                 "Name must be unique",
                 application,
                 MobaPackage.Literals.MOBA_APPLICATION__FEATURES,
                 index);
           }
           String _name_1 = ((MobaQueue) feature).getName();
           tempDataFeatures.add(_name_1);
         }
       }
       if (!_matched) {
         if (feature instanceof MobaSettings) {
           _matched = true;
           String _name = ((MobaSettings) feature).getName();
           boolean _contains = tempSettingsFeatures.contains(_name);
           if (_contains) {
             this.error(
                 "Feature name must be unique",
                 application,
                 MobaPackage.Literals.MOBA_APPLICATION__FEATURES,
                 index);
           }
           String _name_1 = ((MobaSettings) feature).getName();
           tempSettingsFeatures.add(_name_1);
         }
       }
       if (!_matched) {
         if (feature instanceof MobaRESTCustomService) {
           _matched = true;
           String _name = ((MobaRESTCustomService) feature).getName();
           boolean _contains = tempServiceFeatures.contains(_name);
           if (_contains) {
             this.error(
                 "Name must be unique",
                 application,
                 MobaPackage.Literals.MOBA_APPLICATION__FEATURES,
                 index);
           }
           String _name_1 = ((MobaRESTCustomService) feature).getName();
           tempServiceFeatures.add(_name_1);
         }
       }
       if (!_matched) {
         if (feature instanceof MobaRESTCrud) {
           _matched = true;
           String _name = ((MobaRESTCrud) feature).getName();
           boolean _contains = tempServiceFeatures.contains(_name);
           if (_contains) {
             this.error(
                 "Name must be unique",
                 application,
                 MobaPackage.Literals.MOBA_APPLICATION__FEATURES,
                 index);
           }
           String _name_1 = ((MobaRESTCrud) feature).getName();
           tempServiceFeatures.add(_name_1);
         }
       }
       index++;
     }
   }
 }