1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 package fr.paris.lutece.plugins.gru.web.actions.groups.builders.impl;
35
36 import fr.paris.lutece.plugins.gru.web.Constants;
37 import fr.paris.lutece.plugins.gru.web.actions.groups.builders.AbstractActionGroupBuilder;
38 import fr.paris.lutece.plugins.grubusiness.business.demand.Demand;
39 import fr.paris.lutece.portal.service.util.AppPropertiesService;
40
41 import java.util.List;
42
43
44
45
46 public abstract class AbstractDemandActionGroupBuilder extends AbstractActionGroupBuilder
47 {
48 protected static final String PROPERTY_COLOR_DEFAULT = "gru.color.default";
49 protected static final String PROPERTY_COLOR_PRIMARY = "gru.color.primary";
50 protected static final String PROPERTY_COLOR_DANGER = "gru.color.danger";
51 protected static final String COLOR_DEFAULT = AppPropertiesService.getProperty( PROPERTY_COLOR_DEFAULT, "default" );
52 protected static final String COLOR_PRIMARY = AppPropertiesService.getProperty( PROPERTY_COLOR_PRIMARY, "blue" );
53 protected static final String COLOR_DANGER = AppPropertiesService.getProperty( PROPERTY_COLOR_DANGER, "red" );
54
55 private static final String BOOKMARK_ID = "{id}";
56 private static final String BOOKMARK_TYPE = "{type}";
57 private String _strDemandManagementUrl;
58 private List<String> _listExcludedTypes;
59 private List<String> _listIncludedTypes;
60
61
62
63
64
65
66
67 public void setDemandManagementUrl( String strUrl )
68 {
69 _strDemandManagementUrl = strUrl;
70 }
71
72
73
74
75
76
77 protected String getDemandManagementUrl( )
78 {
79 return _strDemandManagementUrl;
80 }
81
82
83
84
85
86
87
88
89
90
91
92
93 protected String buildDemandManagementLink( String strDemandId, String strDemandTypeId, String strCustomerId )
94 {
95 String strUrl = _strDemandManagementUrl.replace( BOOKMARK_ID, strDemandId );
96 strUrl = strUrl.replace( BOOKMARK_TYPE, strDemandTypeId );
97
98 return new StringBuilder( strUrl ).append( '&' ).append( Constants.PARAMETER_ID_CUSTOMER ).append( '=' ).append( strCustomerId ).toString( );
99 }
100
101
102
103
104
105
106
107 public void setExcludedTypesList( List<String> listExcludedTypes )
108 {
109 _listExcludedTypes = listExcludedTypes;
110 }
111
112
113
114
115
116
117 protected List<String> getExcludedTypesList( )
118 {
119 return _listExcludedTypes;
120 }
121
122
123
124
125
126
127
128 public void setIncludedTypesList( List<String> listIncludedTypes )
129 {
130 _listIncludedTypes = listIncludedTypes;
131 }
132
133
134
135
136
137
138 protected List<String> getIncludedTypesList( )
139 {
140 return _listIncludedTypes;
141 }
142
143
144
145
146
147
148
149
150
151
152
153
154 protected String processGroupBadgeColor( Demand demand, String strCurrentBadgeColor, String strActiveBadgeColor )
155 {
156 String strBadgeColor = strCurrentBadgeColor;
157
158 if ( strCurrentBadgeColor == null )
159 {
160 strBadgeColor = COLOR_DEFAULT;
161 }
162
163 if ( demand.getStatusId( ) != Demand.STATUS_CLOSED )
164 {
165 strBadgeColor = strActiveBadgeColor;
166 }
167
168 return strBadgeColor;
169 }
170
171
172
173
174
175
176
177
178
179
180 protected String processItemColor( Demand demand, String strActiveColor )
181 {
182 return ( demand.getStatusId( ) == Demand.STATUS_CLOSED ) ? COLOR_DEFAULT : strActiveColor;
183 }
184 }