Beispiel #1
0
  protected void fillRequirements(RequirementSource requirementSource) throws Exception {
    requirementSource.clearContent();
    Collection<MappingElement> mapping = requirementSource.getMappings();
    ResourceSet resourceSet = new ResourceSetImpl();

    String repositoryUri = requirementSource.getRepositoryUri();

    Resource resource =
        resourceSet.getResource(URI.createPlatformResourceURI(repositoryUri, true), true);
    OCLEvaluator evaluator =
        ZigguratOCLPlugin.compileOCL(
            resourceSet, URI.createPlatformResourceURI(bean.getOclUri(), true));

    TreeIterator<EObject> contents = resource.getAllContents();
    Collection<IRequirementType> requirementTypes = bean.getDataPackage().getRequirementTypes();
    while (contents.hasNext()) {
      EObject eObject = contents.next();
      for (IRequirementType reqType : requirementTypes) {
        if (OCLUtilities.isDataType(evaluator, eObject, reqType)) {
          AbstractElement requirement = createRequirement(evaluator, mapping, eObject, reqType);
          dataManager.addElementsToSource(requirementSource, requirement);
        }
      }
    }
  }
Beispiel #2
0
 @Override
 public boolean canFinish() {
   return bean != null
       && bean.getOclUri() != null
       && bean.getDataPackage() != null
       && bean.getUri() != null
       && !bean.getOclUri().isEmpty()
       && !bean.getUri().isEmpty();
 }