blob: 26991785cd8544f6052feca6641b4f6e6c6e8bd5 (
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
|
/*******************************************************************************
* Copyright (c) 2012 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.orcs.db.internal.change;
import java.util.HashMap;
import org.eclipse.osee.framework.core.enums.ModificationType;
import org.eclipse.osee.framework.core.model.change.ArtifactChangeItem;
import org.eclipse.osee.framework.core.model.change.ChangeItem;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.jdbc.JdbcStatement;
import org.eclipse.osee.orcs.db.internal.change.ChangeItemLoader.ChangeItemFactory;
public final class ArtifactChangeItemFactory implements ChangeItemFactory {
private static final String SELECT_ARTIFACTS_BY_GAMMAS =
"select art_id, art_type_id, txj.gamma_id from osee_artifact id, osee_join_transaction txj where id.gamma_id = txj.gamma_id and txj.query_id = ?";
private final HashMap<Long, ModificationType> changeByGammaId;
public ArtifactChangeItemFactory(HashMap<Long, ModificationType> changeByGammaId) {
super();
this.changeByGammaId = changeByGammaId;
}
@Override
public String getLoadByGammaQuery() {
return SELECT_ARTIFACTS_BY_GAMMAS;
}
@Override
public ChangeItem createItem(JdbcStatement chStmt) throws OseeCoreException {
int artId = chStmt.getInt("art_id");
long artTypeId = chStmt.getLong("art_type_id");
long gammaId = chStmt.getLong("gamma_id");
ModificationType modType = changeByGammaId.get(gammaId);
return new ArtifactChangeItem(artId, artTypeId, gammaId, modType);
}
@Override
public String getItemIdColumnName() {
return "art_id";
}
@Override
public String getItemTableName() {
return "osee_artifact";
}
@Override
public String getItemValueColumnName() {
return null;
}
}
|