blob: 92a647b48a50653ce6acb5ea6c3ce8d7f83c7ec3 (
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
/*******************************************************************************
* Copyright (c) 2013 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.core.client.internal;
import org.eclipse.osee.ats.api.IAtsConfigObject;
import org.eclipse.osee.ats.api.agile.IAgileFeatureGroup;
import org.eclipse.osee.ats.api.agile.IAgileTeam;
import org.eclipse.osee.ats.api.ai.IAtsActionableItem;
import org.eclipse.osee.ats.api.data.AtsArtifactTypes;
import org.eclipse.osee.ats.api.insertion.IAtsInsertion;
import org.eclipse.osee.ats.api.insertion.IAtsInsertionActivity;
import org.eclipse.osee.ats.api.insertion.JaxNewInsertion;
import org.eclipse.osee.ats.api.insertion.JaxNewInsertionActivity;
import org.eclipse.osee.ats.api.program.IAtsProgram;
import org.eclipse.osee.ats.api.team.IAtsTeamDefinition;
import org.eclipse.osee.ats.api.version.IAtsVersion;
import org.eclipse.osee.ats.core.client.IAtsClient;
import org.eclipse.osee.ats.core.client.agile.AgileFeatureGroup;
import org.eclipse.osee.ats.core.client.agile.AgileTeam;
import org.eclipse.osee.ats.core.client.program.internal.Program;
import org.eclipse.osee.ats.core.config.AbstractConfigItemFactory;
import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
/**
* @author Donald G. Dunne
*/
public class ConfigItemFactory extends AbstractConfigItemFactory {
private final IAtsClient atsClient;
public ConfigItemFactory(IAtsClient atsClient) {
this.atsClient = atsClient;
}
@Override
public IAtsConfigObject getConfigObject(ArtifactId art) throws OseeCoreException {
IAtsConfigObject configObject = null;
if (art instanceof IAtsConfigObject) {
configObject = (IAtsConfigObject) art;
} else if (art instanceof Artifact) {
Artifact artifact = (Artifact) art;
if (artifact.isOfType(AtsArtifactTypes.Program)) {
configObject = getProgram(artifact);
} else if (artifact.isOfType(AtsArtifactTypes.Version)) {
configObject = getVersion(artifact);
} else if (artifact.isOfType(AtsArtifactTypes.TeamDefinition)) {
configObject = getTeamDef(artifact);
} else if (artifact.isOfType(AtsArtifactTypes.ActionableItem)) {
configObject = getActionableItem(artifact);
} else if (artifact.isOfType(AtsArtifactTypes.AgileTeam)) {
configObject = getAgileTeam(artifact);
} else if (artifact.isOfType(AtsArtifactTypes.AgileFeatureGroup)) {
configObject = getAgileFeatureGroup(artifact);
}
}
return configObject;
}
@Override
public IAtsVersion getVersion(ArtifactId artifact) {
IAtsVersion version = null;
if ((artifact instanceof Artifact) && ((Artifact) artifact).isOfType(AtsArtifactTypes.Version)) {
version = (IAtsVersion) atsClient.getConfigObject((Artifact) artifact);
}
return version;
}
@Override
public IAtsTeamDefinition getTeamDef(ArtifactId artifact) throws OseeCoreException {
IAtsTeamDefinition teamDef = null;
if ((artifact instanceof Artifact) && ((Artifact) artifact).isOfType(AtsArtifactTypes.TeamDefinition)) {
teamDef = (IAtsTeamDefinition) atsClient.getConfigObject((Artifact) artifact);
}
return teamDef;
}
@Override
public IAtsActionableItem getActionableItem(ArtifactId artifact) throws OseeCoreException {
IAtsActionableItem ai = null;
if ((artifact instanceof Artifact) && ((Artifact) artifact).isOfType(AtsArtifactTypes.ActionableItem)) {
ai = (IAtsActionableItem) atsClient.getConfigObject((Artifact) artifact);
}
return ai;
}
@Override
public IAtsProgram getProgram(ArtifactId object) {
IAtsProgram program = null;
if (object instanceof IAtsProgram) {
program = (IAtsProgram) object;
} else if ((object instanceof Artifact) && ((Artifact) object).isOfType(AtsArtifactTypes.Program)) {
program = new Program(atsClient, (Artifact) object);
}
return program;
}
@Override
public IAgileTeam getAgileTeam(ArtifactId artifact) {
IAgileTeam agileTeam = null;
if (artifact instanceof IAgileTeam) {
agileTeam = (IAgileTeam) artifact;
} else if ((artifact instanceof Artifact) && ((Artifact) artifact).isOfType(AtsArtifactTypes.AgileTeam)) {
agileTeam = new AgileTeam(atsClient, (Artifact) artifact);
}
return agileTeam;
}
@Override
public IAgileFeatureGroup getAgileFeatureGroup(ArtifactId artifact) {
IAgileFeatureGroup group = null;
if (artifact instanceof IAgileFeatureGroup) {
group = (IAgileFeatureGroup) artifact;
} else if ((artifact instanceof Artifact) && ((Artifact) artifact).isOfType(AtsArtifactTypes.AgileFeatureGroup)) {
group = new AgileFeatureGroup(atsClient, (Artifact) artifact);
}
return group;
}
@Override
public IAtsInsertion getInsertion(ArtifactId object) {
throw new UnsupportedOperationException("getInsertion not implemented on client");
}
@Override
public IAtsInsertionActivity getInsertionActivity(ArtifactId object) {
throw new UnsupportedOperationException("getInsertionActivity not implemented on client");
}
@Override
public IAtsInsertion createInsertion(ArtifactId teamArtifact, JaxNewInsertion newInsertion) {
throw new UnsupportedOperationException("createInsertion not implemented on client");
}
@Override
public IAtsInsertion updateInsertion(JaxNewInsertion newInsertion) {
throw new UnsupportedOperationException("updateInsertion not implemented on client");
}
@Override
public void deleteInsertion(ArtifactId artifact) {
throw new UnsupportedOperationException("deleteInsertion not implemented on client");
}
@Override
public IAtsInsertionActivity createInsertionActivity(ArtifactId insertion, JaxNewInsertionActivity newActivity) {
throw new UnsupportedOperationException("createInsertionActivity not implemented on client");
}
@Override
public IAtsInsertionActivity updateInsertionActivity(JaxNewInsertionActivity newActivity) {
throw new UnsupportedOperationException("updateInsertionActivity not implemented on client");
}
@Override
public void deleteInsertionActivity(ArtifactId artifact) {
throw new UnsupportedOperationException("deleteInsertionActivity not implemented on client");
}
@Override
public boolean isAtsConfigArtifact(ArtifactId artifact) {
return getAtsConfigArtifactTypes().contains(((Artifact) artifact).getArtifactType());
}
}
|