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 java.util.List;
20
21 import COM.FutureTense.Interfaces.ICS;
22
23 import com.fatwire.assetapi.data.AssetId;
24 import com.fatwire.gst.foundation.facade.runtag.AbstractTagRunner;
25 import com.fatwire.gst.foundation.facade.runtag.listobject.AddRow;
26 import com.fatwire.gst.foundation.facade.runtag.listobject.Create;
27 import com.fatwire.gst.foundation.facade.runtag.listobject.ToList;
28
29
30
31
32
33
34
35
36 public final class GetMultipleValues extends AbstractTagRunner {
37 public GetMultipleValues() {
38 super("ASSETSET.GETMULTIPLEVALUES");
39 }
40
41 public void setName(String name) {
42 set("NAME", name);
43 }
44
45 public void setPrefix(String prefix) {
46 set("PREFIX", prefix);
47 }
48
49 public void setImmediateOnly(boolean b) {
50 set("IMMEDIATEONLY", b ? "true" : "false");
51 }
52
53 public void setByAsset(boolean b) {
54 set("BYASSET", b ? "true" : "false");
55 }
56
57 public void setList(String inputSortListName) {
58 set("LIST", inputSortListName);
59 }
60
61 public static void getMultipleValues(ICS ics, AssetId id, String prefix, String attrType, List<String> columns) {
62 getMultipleValues(ics, id, null, null, false, false, prefix, attrType, columns);
63 }
64
65 public static void getMultipleValues(ICS ics, AssetId id, String deptype, String locale, boolean byAsset,
66 boolean immediateOnly, String prefix, String attrType, List<String> columns) {
67
68 SetAsset setAsset = new SetAsset();
69 final String assetSetName = "__AssetSet" + ics.genID(true);
70 setAsset.setName(assetSetName);
71 setAsset.setType(id.getType());
72 setAsset.setId(Long.toString(id.getId()));
73 if (deptype != null) {
74 setAsset.setDeptype(deptype);
75 }
76 if (locale != null) {
77 setAsset.setLocale(locale);
78 }
79 setAsset.execute(ics);
80
81
82 Create createSortList = new Create();
83 final String sortListObjectName = "__SortList" + ics.genID(true);
84 createSortList.setName(sortListObjectName);
85 createSortList.setColumns("attributetypename,attributename,direction");
86 createSortList.execute(ics);
87
88
89 for (String col : columns) {
90 AddRow addRow = new AddRow();
91 addRow.setName(sortListObjectName);
92 addRow.setColumnValue("attributetypename", attrType);
93 addRow.setColumnValue("attributename", col);
94 addRow.setColumnValue("direction", "ascending");
95 addRow.execute(ics);
96 }
97
98 final String sortListIListName = "__sortListIList" + ics.genID(true);
99 ToList toList = new ToList();
100 toList.setName(sortListObjectName);
101 toList.setListVarName(sortListIListName);
102 toList.execute(ics);
103
104
105 GetMultipleValues gmv = new GetMultipleValues();
106 gmv.setName(assetSetName);
107 gmv.setByAsset(byAsset);
108 gmv.setImmediateOnly(immediateOnly);
109 gmv.setList(sortListIListName);
110 gmv.setPrefix(prefix);
111 gmv.execute(ics);
112 }
113
114 }