1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.fatwire.gst.foundation.facade.runtag.commercecontext;
18
19 import java.util.Collection;
20
21 import COM.FutureTense.Interfaces.ICS;
22 import COM.FutureTense.Interfaces.IList;
23 import COM.FutureTense.Util.IterableIListWrapper;
24
25 import com.fatwire.assetapi.data.AssetId;
26 import com.fatwire.gst.foundation.IListUtils;
27 import com.fatwire.gst.foundation.facade.assetapi.AssetIdIList;
28
29
30
31
32
33
34
35 public final class Recommendations {
36 private Recommendations() {
37 }
38
39
40
41
42
43
44
45
46
47
48 public static Collection<AssetId> getRecommendations(ICS ics, AssetId id, int max) {
49 GetRecommendations gr = new GetRecommendations();
50 gr.setCollectionId(id.getId());
51 gr.setMaxCount(max);
52 String list = IListUtils.generateRandomListName();
53 gr.setListVarName(list);
54 try {
55 gr.execute(ics);
56 IList result = ics.GetList(list);
57 return IListUtils.toAssetIdCollection(result);
58 } finally {
59 ics.RegisterList(list, null);
60 }
61
62 }
63
64
65
66
67
68
69
70
71
72
73
74 public static Collection<AssetId> getRecommendations(ICS ics, String collection, int max) {
75 GetRecommendations gr = new GetRecommendations();
76 gr.setCollection(collection);
77 gr.setMaxCount(max);
78 String list = IListUtils.generateRandomListName();
79 gr.setListVarName(list);
80 try {
81 gr.execute(ics);
82 IList result = ics.GetList(list);
83 return IListUtils.toAssetIdCollection(result);
84 } finally {
85 ics.RegisterList(list, null);
86 }
87
88 }
89
90
91
92
93
94
95
96
97
98 public static Collection<AssetId> getRecommendations(ICS ics, String collection, Collection<AssetId> input) {
99 GetRecommendations gr = new GetRecommendations();
100 String inputList = IListUtils.generateRandomListName();
101 ics.RegisterList(inputList, new AssetIdIList(inputList, input));
102 gr.setList(inputList);
103 gr.setCollection(collection);
104 String list = IListUtils.generateRandomListName();
105 gr.setListVarName(list);
106 try {
107 gr.execute(ics);
108 IList result = ics.GetList(list);
109 return IListUtils.toAssetIdCollection(result);
110 } finally {
111 ics.RegisterList(inputList, null);
112 ics.RegisterList(list, null);
113
114 }
115 }
116
117 }