Search in sources :

Example 1 with FileArtifact

use of org.whole.lang.artifacts.reflect.ArtifactsEntityDescriptorEnum.FileArtifact in project whole by wholeplatform.

the class ArtifactsUtils method moveArtifactsIntoWorkspace.

public static void moveArtifactsIntoWorkspace(IEntity artifacts, IBindingManager bm) {
    switch(artifacts.wGetEntityDescriptor().getOrdinal()) {
        case ArtifactsEntityDescriptorEnum.Workspace_ord:
            Projects projectsPoint = (Projects) bm.wGet("projectsPoint");
            if (projectsPoint == null)
                throw new IllegalArgumentException("projectsPoint is undefined");
            IEntityIterator<Project> projectIterator = IteratorFactory.childIterator();
            projectIterator.reset(((Workspace) artifacts).getProjects());
            for (Project project : projectIterator) {
                projectIterator.remove();
                projectsPoint.add(project);
            }
            break;
        case ArtifactsEntityDescriptorEnum.Artifacts_ord:
            Artifacts packagesPoint = (Artifacts) bm.wGet("packagesPoint");
            if (packagesPoint == null)
                throw new IllegalArgumentException("packagesPoint is undefined");
            IEntityIterator<Artifact> artifactIterator = IteratorFactory.childIterator();
            artifactIterator.reset(artifacts);
            for (Artifact artifact : artifactIterator) {
                artifactIterator.remove();
                packagesPoint.add(artifact);
            }
            break;
        case ArtifactsEntityDescriptorEnum.PackageArtifact_ord:
        case ArtifactsEntityDescriptorEnum.FolderArtifact_ord:
            packagesPoint = (Artifacts) bm.wGet("packagesPoint");
            if (packagesPoint == null)
                throw new IllegalArgumentException("packagesPoint is undefined");
            packagesPoint.add((Artifact) artifacts);
            break;
        case ArtifactsEntityDescriptorEnum.FileArtifact_ord:
            Artifacts packageArtifactsPoint = (Artifacts) bm.wGet("packageArtifactsPoint");
            if (packageArtifactsPoint == null)
                throw new IllegalArgumentException("packageArtifactsPoint is undefined");
            packageArtifactsPoint.add((FileArtifact) artifacts);
            break;
    }
}
Also used : Project(org.whole.lang.artifacts.model.Project) Artifacts(org.whole.lang.artifacts.model.Artifacts) Projects(org.whole.lang.artifacts.model.Projects) Artifact(org.whole.lang.artifacts.model.Artifact) FileArtifact(org.whole.lang.artifacts.model.FileArtifact) PackageArtifact(org.whole.lang.artifacts.model.PackageArtifact) FolderArtifact(org.whole.lang.artifacts.model.FolderArtifact) FileArtifact(org.whole.lang.artifacts.reflect.ArtifactsEntityDescriptorEnum.FileArtifact)

Aggregations

Artifact (org.whole.lang.artifacts.model.Artifact)1 Artifacts (org.whole.lang.artifacts.model.Artifacts)1 FileArtifact (org.whole.lang.artifacts.model.FileArtifact)1 FolderArtifact (org.whole.lang.artifacts.model.FolderArtifact)1 PackageArtifact (org.whole.lang.artifacts.model.PackageArtifact)1 Project (org.whole.lang.artifacts.model.Project)1 Projects (org.whole.lang.artifacts.model.Projects)1 FileArtifact (org.whole.lang.artifacts.reflect.ArtifactsEntityDescriptorEnum.FileArtifact)1