1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.fatwire.gst.foundation.facade.runtag.assetset;
18
19 import COM.FutureTense.Interfaces.ICS;
20 import COM.FutureTense.Interfaces.IList;
21
22 import com.fatwire.assetapi.data.AssetId;
23 import com.fatwire.gst.foundation.facade.runtag.AbstractTagRunner;
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38 public final class GetAttributeValues extends AbstractTagRunner {
39
40 public GetAttributeValues() {
41 super("ASSETSET.GETATTRIBUTEVALUES");
42 }
43
44
45
46
47
48
49 public void setName(String s) {
50
51 if (s == null || s.length() == 0) {
52 throw new IllegalArgumentException("Invalid name string: " + s);
53 }
54 this.set("NAME", s);
55 }
56
57
58
59
60
61
62 public void setAttribute(String s) {
63
64 if (s == null || s.length() == 0) {
65 throw new IllegalArgumentException("Invalid attribute string: " + s);
66 }
67 this.set("ATTRIBUTE", s);
68 }
69
70
71
72
73
74
75 public void setListvarname(String s) {
76
77 if (s == null || s.length() == 0) {
78 throw new IllegalArgumentException("Invalid listvarname string: " + s);
79 }
80 this.set("LISTVARNAME", s);
81 }
82
83
84
85
86
87
88 public void setTypename(String s) {
89
90 if (s == null || s.length() == 0) {
91 throw new IllegalArgumentException("Invalid typename string: " + s);
92 }
93 this.set("TYPENAME", s);
94 }
95
96
97
98
99
100
101 public void setImmediateonly(String s) {
102
103 if (s == null || s.length() == 0 || !s.equals("true") && !s.equals("false")) {
104 throw new IllegalArgumentException("Invalid immediateonly string: " + s);
105 }
106 this.set("IMMEDIATEONLY", s);
107 }
108
109
110
111
112
113
114 public void setOrdering(String s) {
115
116 if (s == null || s.length() == 0 || !s.equals("ascending") && !s.equals("descending")) {
117 throw new IllegalArgumentException("Invalid ordering string: " + s);
118 }
119 this.set("ORDERING", s);
120 }
121
122
123
124
125
126
127
128
129
130
131
132
133 public static IList getAttributeValues(ICS ics, AssetId id, String deptype, String locale, String attr,
134 String attrType, String ordering) {
135
136
137 SetAsset setAsset = new SetAsset();
138 final String assetSetName = "__AssetSet" + ics.genID(false);
139 setAsset.setName(assetSetName);
140 setAsset.setType(id.getType());
141 setAsset.setId(Long.toString(id.getId()));
142 if (deptype != null) {
143 setAsset.setDeptype(deptype);
144 }
145 if (locale != null) {
146 setAsset.setLocale(locale);
147 }
148 setAsset.execute(ics);
149
150 GetAttributeValues gav = new GetAttributeValues();
151 gav.setName(assetSetName);
152 gav.setAttribute(attr);
153 if (attrType != null) {
154 gav.setTypename(attrType);
155 }
156 if (ordering != null) {
157 gav.setOrdering(ordering);
158 }
159 String listname = ics.genID(true);
160 gav.setListvarname(listname);
161 gav.execute(ics);
162
163 IList result = ics.GetList(listname);
164 ics.RegisterList(listname, null);
165 return result;
166 }
167
168 }