Skip to main content
summaryrefslogtreecommitdiffstats
blob: 200b173131ffd27b0a742161bb66bbc3de83e5f0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*******************************************************************************
 * Copyright (c) 2004, 2007 Boeing.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Boeing - initial API and implementation
 *******************************************************************************/
package org.eclipse.osee.ats.artifact;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.logging.Level;
import org.eclipse.osee.ats.internal.AtsPlugin;
import org.eclipse.osee.ats.util.AtsArtifactTypes;
import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
import org.eclipse.osee.framework.core.exception.OseeArgumentException;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.Branch;
import org.eclipse.osee.framework.core.model.type.ArtifactType;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.artifact.ArtifactFactory;
import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;

/**
 * @author Ryan D. Brooks
 */
public class AtsArtifactFactory extends ArtifactFactory {

   public AtsArtifactFactory() {
      super(
         Arrays.asList(AtsArtifactTypes.Action.getName(), AtsArtifactTypes.PeerToPeerReview.getName(),
            AtsArtifactTypes.DecisionReview.getName(), AtsArtifactTypes.ActionableItem.getName(),
            AtsArtifactTypes.Task.getName(), AtsArtifactTypes.TeamWorkflow.getName(),
            AtsArtifactTypes.TeamDefinition.getName(), AtsArtifactTypes.Version.getName(),
            AtsArtifactTypes.Goal.getName()));
   }

   @Override
   public Artifact getArtifactInstance(String guid, String humandReadableId, Branch branch, ArtifactType artifactType) throws OseeCoreException {
      if (artifactType.equals(AtsArtifactTypes.Action)) {
         return new ActionArtifact(this, guid, humandReadableId, branch, artifactType);
      } else if (artifactType.equals(AtsArtifactTypes.Task)) {
         return new TaskArtifact(this, guid, humandReadableId, branch, artifactType);
      } else if (artifactType.equals(AtsArtifactTypes.TeamWorkflow)) {
         return new TeamWorkFlowArtifact(this, guid, humandReadableId, branch, artifactType);
      } else if (artifactType.equals(AtsArtifactTypes.TeamDefinition)) {
         return new TeamDefinitionArtifact(this, guid, humandReadableId, branch, artifactType);
      } else if (artifactType.equals(AtsArtifactTypes.Version)) {
         return new VersionArtifact(this, guid, humandReadableId, branch, artifactType);
      } else if (artifactType.equals(AtsArtifactTypes.ActionableItem)) {
         return new ActionableItemArtifact(this, guid, humandReadableId, branch, artifactType);
      } else if (artifactType.equals(AtsArtifactTypes.DecisionReview)) {
         return new DecisionReviewArtifact(this, guid, humandReadableId, branch, artifactType);
      } else if (artifactType.equals(AtsArtifactTypes.PeerToPeerReview)) {
         return new PeerToPeerReviewArtifact(this, guid, humandReadableId, branch, artifactType);
      } else if (artifactType.equals(AtsArtifactTypes.Goal)) {
         return new GoalArtifact(this, guid, humandReadableId, branch, artifactType);
      } else {
         throw new OseeArgumentException("did not recognize the artifact type [%s]", artifactType);
      }
   }

   @Override
   public Collection<ArtifactType> getEternalArtifactTypes() {
      List<ArtifactType> artifactTypes = new ArrayList<ArtifactType>();
      try {
         artifactTypes.add(ArtifactTypeManager.getType(AtsArtifactTypes.Version));
         artifactTypes.add(ArtifactTypeManager.getType(AtsArtifactTypes.TeamDefinition));
         artifactTypes.add(ArtifactTypeManager.getType(AtsArtifactTypes.ActionableItem));
         artifactTypes.add(ArtifactTypeManager.getType(CoreArtifactTypes.WorkRuleDefinition));
         artifactTypes.add(ArtifactTypeManager.getType(CoreArtifactTypes.WorkFlowDefinition));
         artifactTypes.add(ArtifactTypeManager.getType(CoreArtifactTypes.WorkWidgetDefinition));
         artifactTypes.add(ArtifactTypeManager.getType(CoreArtifactTypes.WorkPageDefinition));
      } catch (OseeCoreException ex) {
         OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
      }
      return artifactTypes;
   }

}

Back to the top