示例#1
0
  private void copyActions(List<Action> actions) {
    if (actions.isEmpty()) return;

    ICSpecXMLFactory factory = ICSpecXMLFactory.eINSTANCE;
    IActionsType at = factory.createActionsType();
    xmlSpec.getActions().add(at);
    for (Action action : actions) {
      IAction xmlAction = factory.createAction();
      copyAction(action, xmlAction);
      if (action.isPublic()) at.getPublic().add(xmlAction);
      else at.getPrivate().add(xmlAction);
    }
  }
示例#2
0
  private void copyGroups(List<Group> groups) {
    if (groups.isEmpty()) return;

    ICSpecXMLFactory factory = ICSpecXMLFactory.eINSTANCE;
    IGroupsType gt = factory.createGroupsType();
    xmlSpec.getGroups().add(gt);
    for (Group group : groups) {
      IGroup xmlGroup = factory.createGroup();
      copyGroup(group, xmlGroup);
      if (group.isPublic()) gt.getPublic().add(xmlGroup);
      else gt.getPrivate().add(xmlGroup);
    }
  }
示例#3
0
  private void copyArtifacts(List<Artifact> artifacts) {
    if (artifacts.isEmpty()) return;

    ICSpecXMLFactory factory = ICSpecXMLFactory.eINSTANCE;
    IArtifactsType at = factory.createArtifactsType();
    xmlSpec.getArtifacts().add(at);
    for (Artifact artifact : artifacts) {
      IArtifact xmlArtifact = factory.createArtifact();
      copyArtifact(artifact, xmlArtifact);
      if (artifact.isPublic()) at.getPublic().add(xmlArtifact);
      else at.getPrivate().add(xmlArtifact);
    }
  }
示例#4
0
  private void copyDependencies() {
    List<ComponentRequest> deps = cspec.getDependencies();
    if (deps.isEmpty()) return;
    IDependenciesType dt = ICSpecXMLFactory.eINSTANCE.createDependenciesType();
    xmlSpec.getDependencies().add(dt);

    for (ComponentRequest dep : deps) {
      IComponentRequest xmlDep = ICSpecXMLFactory.eINSTANCE.createComponentRequest();
      xmlDep.setName(dep.getId());
      xmlDep.setComponentType(dep.getType());
      xmlDep.setRange(dep.getRange());
      xmlDep.setFilter(dep.getFilter());
      dt.getDependency().add(xmlDep);
    }
  }
示例#5
0
 public IComponentSpec exportCSpec(CSpec cspc) {
   cspec = cspc;
   xmlSpec = (ComponentSpecImpl) ICSpecXMLFactory.eINSTANCE.createComponentSpec();
   xmlSpec.setName(cspc.getId());
   xmlSpec.setComponentType(cspc.getType());
   xmlSpec.setVersion(cspc.getVersion());
   xmlSpec.setDocumentation(cspc.getDocumentation());
   xmlSpec.setFilter(cspc.getFilter());
   xmlSpec.setShortDesc(cspc.getShortDesc());
   xmlSpec.setProjectInfo(cspc.getProjectInfo());
   copyDependencies();
   copyGenerators();
   copyAttributes();
   return xmlSpec;
 }
示例#6
0
  private void copyGenerators() {
    List<Generator> generators = cspec.getGenerators();
    if (generators.isEmpty()) return;

    IGeneratorsType gt = ICSpecXMLFactory.eINSTANCE.createGeneratorsType();
    xmlSpec.getGenerators().add(gt);
    for (Generator generator : generators) {
      IGenerator xmlGen = ICSpecXMLFactory.eINSTANCE.createGenerator();
      ComponentIdentifier cid = generator.getGenerates();
      xmlGen.setGenerates(cid.getId());
      xmlGen.setGeneratesType(cid.getType());
      Version version = cid.getVersion();
      if (version != null) xmlGen.setGeneratesVersionString(version.toString());
      xmlGen.setAttribute(generator.getAttribute());
      ComponentRequest component = generator.getComponent();
      if (component != null) {
        xmlGen.setComponent(component.getId());
        xmlGen.setComponentType(component.getType());
      }
      gt.getGenerator().add(xmlGen);
    }
  }