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