Пример #1
0
 private static IEntity createPattern(IEntity child) {
   IEntity pattern = EntityUtils.clone(child);
   EntityDescriptor<?> ed = pattern.wGetEntityDescriptor();
   for (FeatureDescriptor fd : ed.getEntityFeatureDescriptors()) {
     if (!name.equals(fd))
       pattern.wSet(
           fd, CommonsEntityAdapterFactory.createVariable(fd.getEntityDescriptor(), fd.getName()));
   }
   return pattern;
 }
Пример #2
0
  public static IEntity cloneArtifact(IEntity artifact, IEntity appendChild) {
    IEntityFactory ef = GenericEntityFactory.instance(RegistryConfigurations.RESOLVER);
    EntityDescriptor<?> ed = artifact.wGetEntityDescriptor();

    IEntity newArtifact = ef.create(ed);
    for (FeatureDescriptor fd : ed.getEntityFeatureDescriptors()) {
      if (artifacts.equals(fd) || projects.equals(fd)) {
        IEntity composite = newArtifact.wGet(fd);
        if (appendChild != null) composite.wAdd(appendChild);
        else composite.wResolveWith(fd.getEntityDescriptor());
      } else newArtifact.wSet(fd, EntityUtils.clone(artifact.wGet(fd)));
    }
    return newArtifact;
  }