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.insertajax.business;
35
36 import fr.paris.lutece.plugins.insertajax.service.InsertAjaxWorkgroupRemovalListener;
37 import fr.paris.lutece.portal.service.workgroup.AdminWorkgroupResource;
38 import fr.paris.lutece.portal.service.workgroup.AdminWorkgroupService;
39 import fr.paris.lutece.portal.service.workgroup.WorkgroupRemovalListenerService;
40
41
42
43
44
45 public class InsertAjax implements AdminWorkgroupResource
46 {
47
48
49 public static final String RESOURCE_TYPE = "INSERTAJAX";
50 public static final String ROLE_NONE = "none";
51 private static final String ID_PRIMARY_KEY = "ID_PRIMARY_KEY";
52 private static InsertAjaxWorkgroupRemovalListener _listenerWorkgroup;
53 private int _nId;
54 private String _strName;
55 private String _strHtml;
56 private String _strSql;
57 private String _strWorkgroupKey;
58 private String _strAdminWorkgroup;
59 private String _strRole;
60
61
62 public InsertAjax( )
63 {
64 }
65
66
67
68
69 public static void init( )
70 {
71
72 if ( _listenerWorkgroup == null )
73 {
74 _listenerWorkgroup = new InsertAjaxWorkgroupRemovalListener( );
75 WorkgroupRemovalListenerService.getService( ).registerListener( _listenerWorkgroup );
76 }
77 }
78
79
80
81
82 public int getId( )
83 {
84 return _nId;
85 }
86
87 public void setId( int nId )
88 {
89 _nId = nId;
90 }
91
92 public String getName( )
93 {
94 return _strName;
95 }
96
97 public void setName( String name )
98 {
99 _strName = name;
100 }
101
102 public String getHtml( )
103 {
104 return _strHtml;
105 }
106
107 public void setHtml( String html )
108 {
109 _strHtml = html;
110 }
111
112 public String getSql( )
113 {
114 return _strSql;
115 }
116
117 public void setSql( String sql )
118 {
119 _strSql = sql;
120 }
121
122
123
124
125
126
127
128
129 public String getWorkgroupKey( )
130 {
131 return _strWorkgroupKey;
132 }
133
134
135
136
137
138 public void setWorkgroupKey( String strWorkgroupKey )
139 {
140 _strWorkgroupKey = strWorkgroupKey;
141 }
142
143
144
145
146
147 public String getWorkgroup( )
148 {
149 return _strAdminWorkgroup;
150 }
151
152
153
154
155
156 public void setWorkgroup( String strAdminWorkgroup )
157 {
158 _strAdminWorkgroup = AdminWorkgroupService.normalizeWorkgroupKey( strAdminWorkgroup );
159 }
160
161 public String getRole( )
162 {
163 return _strRole;
164 }
165
166 public void setRole( String role )
167 {
168 _strRole = role;
169 }
170
171
172
173
174
175
176
177 public void replacePrimaryKey(int id)
178 {
179 String html = getHtml();
180 html = html.replaceAll(ID_PRIMARY_KEY, id+"");
181 setHtml(html);
182 }
183 }