1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package tools.gsf.facade.assetapi;
18
19 import COM.FutureTense.Interfaces.IList;
20 import com.fatwire.assetapi.data.AssetId;
21 import tools.gsf.facade.sql.AbstractIList;
22 import tools.gsf.facade.sql.IListIterable;
23
24 import java.util.ArrayList;
25 import java.util.Collection;
26 import java.util.Collections;
27 import java.util.List;
28
29
30
31
32
33
34
35
36
37 public class AssetIdIList extends AbstractIList {
38
39 public static final String ASSETTYPE = "ASSETTYPE";
40 public static final String ASSETID = "ASSETID";
41
42
43
44 protected List<AssetId> ids;
45
46
47
48
49
50
51
52 public AssetIdIList(String name, Collection<AssetId> ids) {
53 super(name);
54 this.ids = Collections.unmodifiableList(new ArrayList<AssetId>(ids));
55 }
56
57 public IList clone(String newname) {
58 List<AssetId> clone = new ArrayList<AssetId>(ids.size());
59 for (AssetId id : ids) {
60 clone.add(id);
61 }
62 return new AssetIdIList(newname, clone);
63 }
64
65 public void flush() {
66 ids = new ArrayList<AssetId>();
67 }
68
69 public int numColumns() {
70 return 2;
71 }
72
73 public String getColumnName(int i) throws ArrayIndexOutOfBoundsException {
74 if (i == 0) {
75 return ASSETTYPE;
76 }
77 if (i == 1) {
78 return ASSETID;
79 }
80 throw new ArrayIndexOutOfBoundsException(i);
81 }
82
83 public int numRows() {
84 return ids.size();
85 }
86
87 public String getValue(String s) throws NoSuchFieldException {
88
89
90 if (ASSETID.equalsIgnoreCase(s)) {
91 return Long.toString(ids.get(currentRow() - 1).getId());
92 }
93 if (ASSETTYPE.equalsIgnoreCase(s)) {
94 return ids.get(currentRow() - 1).getType();
95 }
96 throw new NoSuchFieldException(s);
97 }
98
99 public Object getObject(String s) throws NoSuchFieldException {
100 return getValue(s);
101 }
102
103 public byte[] getFileData(String s) throws IllegalArgumentException, NoSuchFieldException {
104 throw new IllegalArgumentException(s);
105 }
106
107 public String getFileString(String s) throws NoSuchFieldException {
108 throw new IllegalArgumentException(s);
109 }
110
111 public int numIndirectColumns() {
112 return 0;
113 }
114
115 public String getIndirectColumnName(int i) {
116 return null;
117 }
118
119 public boolean stringInList(String s) {
120 return false;
121 }
122 }