gvsig-projects-pool / org.gvsig.vcsgis / trunk / org.gvsig.vcsgis / org.gvsig.vcsgis.lib / org.gvsig.vcsgis.lib.impl / src / main / java / org / gvsig / vcsgis / lib / workspace / tables / EntitiesTable.java @ 3459
History | View | Annotate | Download (21.7 KB)
1 |
package org.gvsig.vcsgis.lib.workspace.tables; |
---|---|
2 |
|
3 |
import java.util.List; |
4 |
import javax.json.JsonObject; |
5 |
import org.apache.commons.lang3.StringUtils; |
6 |
import org.gvsig.fmap.dal.DALLocator; |
7 |
import org.gvsig.fmap.dal.DataManager; |
8 |
import org.gvsig.fmap.dal.feature.EditableFeatureType; |
9 |
import org.gvsig.fmap.dal.feature.Feature; |
10 |
import org.gvsig.fmap.dal.feature.FeatureSet.DisposableFeatureSetIterable; |
11 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
12 |
import org.gvsig.fmap.dal.feature.FeatureType; |
13 |
import org.gvsig.json.Json; |
14 |
import org.gvsig.json.JsonObjectBuilder; |
15 |
import org.gvsig.tools.dataTypes.DataTypes; |
16 |
import org.gvsig.tools.dispose.DisposeUtils; |
17 |
import org.gvsig.tools.dynobject.DynObjectValueItem; |
18 |
import org.gvsig.vcsgis.lib.VCSGisEntity; |
19 |
import org.gvsig.vcsgis.lib.VCSGisEntityEditable; |
20 |
import static org.gvsig.vcsgis.lib.VCSGisManager.STATE_CONFLICT; |
21 |
import org.gvsig.vcsgis.lib.VCSGisUtils; |
22 |
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspace; |
23 |
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspaceEntity; |
24 |
import org.gvsig.vcsgis.lib.workspace.tables.AbstractTable.AbstractRow; |
25 |
import static org.gvsig.vcsgis.lib.VCSGisManager.STATE_LOCAL_UNMODIFIED; |
26 |
import static org.gvsig.vcsgis.lib.VCSGisManager.STATE_LOCAL_NEW; |
27 |
import static org.gvsig.vcsgis.lib.VCSGisManager.STATE_LOCAL_MODIFIED; |
28 |
import static org.gvsig.vcsgis.lib.VCSGisManager.STATE_LOCAL_OUTDATED; |
29 |
import static org.gvsig.vcsgis.lib.VCSGisManager.STATE_LOCAL_OUTDATED_AND_MODIFIED; |
30 |
import static org.gvsig.vcsgis.lib.VCSGisManager.TOPOLOGYPLAN_MODE_MANDATORY; |
31 |
import static org.gvsig.vcsgis.lib.VCSGisManager.TOPOLOGYPLAN_MODE_RECOMMENDED; |
32 |
import org.gvsig.vcsgis.lib.VCSGisUser; |
33 |
|
34 |
/**
|
35 |
*
|
36 |
* @author gvSIG Team
|
37 |
*/
|
38 |
@SuppressWarnings("UseSpecificCatch") |
39 |
public class EntitiesTable extends AbstractTable { |
40 |
|
41 |
public static final String TABLE_NAME = "VCSGIS_ENTITIES"; |
42 |
|
43 |
public static final String COD_ENTITY = "COD_ENTITY"; |
44 |
private static final String ENTITY_NAME = "ENT_NAME"; |
45 |
private static final String ENTITY_STATE = "ENT_STATE"; |
46 |
private static final String DATATABLE_NAME = "ENT_DATATABLE"; |
47 |
private static final String FEATUREID_FIELD_NAME = "ENT_FEATURECODE"; |
48 |
private static final String GEOMETRY_FIELD_NAME = "ENT_GEOMNAME"; |
49 |
private static final String DESCRIPTION = "ENT_DESCRIPTION"; |
50 |
private static final String FIELD_FOR_LABEL = "ENT_FIELDFORLABEL"; |
51 |
private static final String FEATURETYPE = "ENT_FEATURETYPE"; |
52 |
private static final String COD_LOCAL_REVISION = "COD_LOCAL_REVISION"; |
53 |
private static final String COD_REPOSITORY_REVISION = "COD_REPO_REVISION"; |
54 |
private static final String COD_USER = "COD_USER"; |
55 |
private static final String COD_TOPOLOGYPLAN = "COD_TOPOLOGYPLAN"; |
56 |
private static final String CATEGORY = "ENT_CATEGORY"; |
57 |
private static final String LABEL = "ENT_LABEL"; |
58 |
private static final String AUTHORIZATIONS = "ENT_AUTORIZATIONS"; |
59 |
private static final String TOPOLOGYPLAN_MODE = "ENT_TOPOLOGYPLAN_MODE"; |
60 |
private static final String RESOURCES = "ENT_RESOURCES"; |
61 |
private static final String DATA_MODELS = "ENT_DATA_MODELS"; |
62 |
|
63 |
public static class EntityRow extends AbstractRow implements VCSGisWorkspaceEntity { |
64 |
|
65 |
private FeatureType featureType;
|
66 |
|
67 |
public EntityRow(VCSGisWorkspace workspace) {
|
68 |
super(workspace, TABLE_NAME, COD_ENTITY);
|
69 |
} |
70 |
|
71 |
public EntityRow(VCSGisWorkspace workspace, Feature feature) {
|
72 |
super(workspace, TABLE_NAME, COD_ENTITY,feature);
|
73 |
} |
74 |
|
75 |
@Override
|
76 |
public String getEntityName() { |
77 |
return this.getString(ENTITY_NAME); |
78 |
} |
79 |
|
80 |
@Override
|
81 |
public String getDataTableName() { |
82 |
return this.getString(DATATABLE_NAME); |
83 |
} |
84 |
|
85 |
@Override
|
86 |
public String getFeatureIdFieldName() { |
87 |
return this.getString(FEATUREID_FIELD_NAME); |
88 |
} |
89 |
|
90 |
|
91 |
@Override
|
92 |
public String getGeometryFieldName() { |
93 |
return this.getString(GEOMETRY_FIELD_NAME); |
94 |
} |
95 |
|
96 |
@Override
|
97 |
public String getDescription() { |
98 |
return this.getString(DESCRIPTION); |
99 |
} |
100 |
|
101 |
@Override
|
102 |
public String getFieldForLabel() { |
103 |
return this.getString(FIELD_FOR_LABEL); |
104 |
} |
105 |
|
106 |
@Override
|
107 |
public String getUserCode() { |
108 |
return this.getString(COD_USER); |
109 |
} |
110 |
|
111 |
@Override
|
112 |
public String getTopologyPlanCode() { |
113 |
return this.getString(COD_TOPOLOGYPLAN); |
114 |
} |
115 |
|
116 |
@Override
|
117 |
public String getEntityCode() { |
118 |
return this.getCode(); |
119 |
} |
120 |
|
121 |
@Override
|
122 |
public String getLocalRevisionCode() { |
123 |
return this.getString(COD_LOCAL_REVISION); |
124 |
} |
125 |
|
126 |
@Override
|
127 |
public String getRepositoryRevisionCode() { |
128 |
return this.getString(COD_REPOSITORY_REVISION); |
129 |
} |
130 |
|
131 |
@Override
|
132 |
public String getCategory() { |
133 |
return this.getString(CATEGORY); |
134 |
} |
135 |
|
136 |
@Override
|
137 |
public List<String> getCategoriesAsList() { |
138 |
String s = getCategory();
|
139 |
return VCSGisUtils.getAsList(s);
|
140 |
} |
141 |
|
142 |
@Override
|
143 |
public String getAuthorizations() { |
144 |
return this.getString(AUTHORIZATIONS); |
145 |
} |
146 |
|
147 |
@Override
|
148 |
public int getTopologyPlanMode() { |
149 |
return this.getInt(TOPOLOGYPLAN_MODE, TOPOLOGYPLAN_MODE_RECOMMENDED); |
150 |
} |
151 |
|
152 |
@Override
|
153 |
public String getLabel() { |
154 |
return this.getString(LABEL); |
155 |
} |
156 |
|
157 |
@Override
|
158 |
public String getFeatureTypeAsJson() { |
159 |
return this.getString(FEATURETYPE); |
160 |
} |
161 |
|
162 |
@Override
|
163 |
public FeatureType getFeatureType() {
|
164 |
if (this.featureType == null) { |
165 |
JsonObject json = Json.createObject(this.getFeatureTypeAsJson());
|
166 |
this.featureType = DALLocator.getDataManager().createFeatureType(json);
|
167 |
} |
168 |
return this.featureType; |
169 |
} |
170 |
|
171 |
|
172 |
@Override
|
173 |
public EntityRow setEntityName(String entityName) { |
174 |
this.set(ENTITY_NAME, entityName);
|
175 |
if( StringUtils.isBlank(this.getLabel())) { |
176 |
this.setLabel(entityName);
|
177 |
} |
178 |
return this; |
179 |
} |
180 |
|
181 |
@Override
|
182 |
public EntityRow setDataTableName(String dataTableName) { |
183 |
this.set(DATATABLE_NAME, dataTableName);
|
184 |
return this; |
185 |
} |
186 |
|
187 |
@Override
|
188 |
public EntityRow setFeatureIdFieldName(String name) { |
189 |
this.set(FEATUREID_FIELD_NAME, name);
|
190 |
return this; |
191 |
} |
192 |
|
193 |
@Override
|
194 |
public EntityRow setGeometryFieldName(String name) { |
195 |
this.set(GEOMETRY_FIELD_NAME, name);
|
196 |
return this; |
197 |
} |
198 |
|
199 |
@Override
|
200 |
public EntityRow setDescription(String description) { |
201 |
this.set(DESCRIPTION, description);
|
202 |
return this; |
203 |
} |
204 |
|
205 |
@Override
|
206 |
public EntityRow setFieldForLabel(String fieldForLabel) { |
207 |
this.set(FIELD_FOR_LABEL, fieldForLabel);
|
208 |
return this; |
209 |
} |
210 |
|
211 |
@Override
|
212 |
public EntityRow setFeatureTypeAsJson(String json) { |
213 |
this.set(FEATURETYPE, json);
|
214 |
this.featureType = null; |
215 |
return this; |
216 |
} |
217 |
|
218 |
public EntityRow setFeatureType(FeatureType featureType) {
|
219 |
this.set(FEATURETYPE, featureType.toJson().toString());
|
220 |
return this; |
221 |
} |
222 |
|
223 |
@Override
|
224 |
public EntityRow setLocalRevisionCode(String code) { |
225 |
this.set(COD_LOCAL_REVISION, code);
|
226 |
return this; |
227 |
} |
228 |
|
229 |
@Override
|
230 |
public EntityRow setRepositoryRevisionCode(String code) { |
231 |
this.set(COD_REPOSITORY_REVISION, code);
|
232 |
return this; |
233 |
} |
234 |
|
235 |
|
236 |
@Override
|
237 |
public VCSGisEntityEditable setUserCode(String userCode) { |
238 |
this.set(COD_USER, userCode);
|
239 |
return this; |
240 |
} |
241 |
|
242 |
@Override
|
243 |
public VCSGisEntityEditable setTopologyPlanCode(String topologyplanCode) { |
244 |
this.set(COD_TOPOLOGYPLAN, topologyplanCode);
|
245 |
return this; |
246 |
} |
247 |
|
248 |
@Override
|
249 |
public VCSGisEntityEditable setCategory(String category) { |
250 |
this.set(CATEGORY, category);
|
251 |
return this; |
252 |
} |
253 |
|
254 |
@Override
|
255 |
public VCSGisEntityEditable setAuthorizations(String authorizations) { |
256 |
this.set(AUTHORIZATIONS, authorizations);
|
257 |
return this; |
258 |
} |
259 |
|
260 |
@Override
|
261 |
public VCSGisEntityEditable setTopologyPlanMode(int topologyPlanMode) { |
262 |
this.set(TOPOLOGYPLAN_MODE, topologyPlanMode);
|
263 |
return this; |
264 |
} |
265 |
|
266 |
@Override
|
267 |
public VCSGisEntityEditable setLabel(String label) { |
268 |
if(label != null){ |
269 |
this.set(LABEL, label);
|
270 |
} |
271 |
return this; |
272 |
} |
273 |
|
274 |
@Override
|
275 |
public long getCountLocalChanges() { |
276 |
WorkspaceChangesTable changesTable = new WorkspaceChangesTable();
|
277 |
return changesTable.getCountLocalChangesOfEntity(workspace, this.getCode()); |
278 |
} |
279 |
|
280 |
private void updateState() { |
281 |
long countChanges;
|
282 |
int state = this.getInt(ENTITY_STATE, -1); |
283 |
if( state == -1 ) { |
284 |
state = STATE_LOCAL_UNMODIFIED; |
285 |
this.setState(state);
|
286 |
} |
287 |
switch (state) {
|
288 |
case STATE_LOCAL_UNMODIFIED:
|
289 |
countChanges = this.getCountLocalChanges();
|
290 |
if (countChanges > 0) { |
291 |
state = STATE_LOCAL_MODIFIED; |
292 |
if(this.isOutdated()){ |
293 |
state = STATE_LOCAL_OUTDATED_AND_MODIFIED; |
294 |
} |
295 |
this.setState(state);
|
296 |
} else if(this.isOutdated()){ |
297 |
state = STATE_LOCAL_OUTDATED; |
298 |
this.setState(state);
|
299 |
} |
300 |
break;
|
301 |
case STATE_LOCAL_OUTDATED:
|
302 |
if(!this.isOutdated()){ |
303 |
countChanges = this.getCountLocalChanges();
|
304 |
if (countChanges > 0) { |
305 |
state = STATE_LOCAL_MODIFIED; |
306 |
} else {
|
307 |
state = STATE_LOCAL_UNMODIFIED; |
308 |
} |
309 |
} else {
|
310 |
countChanges = this.getCountLocalChanges();
|
311 |
if (countChanges > 0) { |
312 |
state = STATE_LOCAL_OUTDATED_AND_MODIFIED; |
313 |
this.setState(state);
|
314 |
} |
315 |
} |
316 |
this.setState(state);
|
317 |
break;
|
318 |
case STATE_LOCAL_MODIFIED:
|
319 |
countChanges = this.getCountLocalChanges();
|
320 |
if (countChanges == 0) { |
321 |
state = STATE_LOCAL_UNMODIFIED; |
322 |
if(this.isOutdated()){ |
323 |
state = STATE_LOCAL_OUTDATED; |
324 |
} |
325 |
} else {
|
326 |
if(this.isOutdated()){ |
327 |
state = STATE_LOCAL_OUTDATED_AND_MODIFIED; |
328 |
} |
329 |
} |
330 |
|
331 |
this.setState(state);
|
332 |
break;
|
333 |
case STATE_LOCAL_OUTDATED_AND_MODIFIED:
|
334 |
if(!this.isOutdated()){ |
335 |
countChanges = this.getCountLocalChanges();
|
336 |
if (countChanges > 0) { |
337 |
state = STATE_LOCAL_MODIFIED; |
338 |
this.setState(state);
|
339 |
} else {
|
340 |
state = STATE_LOCAL_UNMODIFIED; |
341 |
} |
342 |
} else {
|
343 |
countChanges = this.getCountLocalChanges();
|
344 |
if (countChanges > 0) { |
345 |
state = STATE_LOCAL_OUTDATED_AND_MODIFIED; |
346 |
this.setState(state);
|
347 |
} else {
|
348 |
state = STATE_LOCAL_OUTDATED; |
349 |
} |
350 |
} |
351 |
this.setState(state);
|
352 |
break;
|
353 |
|
354 |
case STATE_LOCAL_NEW:
|
355 |
countChanges = this.getCountLocalChanges();
|
356 |
if (countChanges > 0) { |
357 |
state = STATE_LOCAL_MODIFIED; |
358 |
if(this.isOutdated()){ |
359 |
state = STATE_LOCAL_OUTDATED_AND_MODIFIED; |
360 |
} |
361 |
this.setState(state);
|
362 |
} else {
|
363 |
state = STATE_LOCAL_UNMODIFIED; |
364 |
} |
365 |
this.setState(state);
|
366 |
break;
|
367 |
case STATE_CONFLICT:
|
368 |
break;
|
369 |
default:
|
370 |
if(this.isOutdated()){ |
371 |
state = STATE_LOCAL_OUTDATED; |
372 |
this.setState(state);
|
373 |
} |
374 |
} |
375 |
} |
376 |
|
377 |
@Override
|
378 |
public int getState() { |
379 |
this.updateState();
|
380 |
int state = this.getInt(ENTITY_STATE); |
381 |
return state;
|
382 |
} |
383 |
|
384 |
@Override
|
385 |
public boolean isOutdated() { |
386 |
final String repositoryRevisionCode = this.getRepositoryRevisionCode(); |
387 |
if(StringUtils.isBlank(repositoryRevisionCode)){
|
388 |
return false; |
389 |
} |
390 |
return !StringUtils.equalsIgnoreCase(repositoryRevisionCode,this.getLocalRevisionCode()); |
391 |
} |
392 |
|
393 |
public String getStateLabel() { |
394 |
return VCSGisUtils.getStateLabel(this.getState()); |
395 |
} |
396 |
|
397 |
public void setState(int state) { |
398 |
this.set(ENTITY_STATE, state);
|
399 |
} |
400 |
|
401 |
@Override
|
402 |
public void update() { |
403 |
this.updateState();
|
404 |
super.update();
|
405 |
} |
406 |
|
407 |
@Override
|
408 |
public VCSGisWorkspaceEntity getValue() {
|
409 |
return this; |
410 |
} |
411 |
|
412 |
@Override
|
413 |
public String toString() { |
414 |
if( StringUtils.isBlank(this.getLabel()) ) { |
415 |
return this.getEntityName(); |
416 |
} |
417 |
return this.getLabel(); |
418 |
} |
419 |
|
420 |
@Override
|
421 |
public EntityRow setEntityCode(String code) { |
422 |
this.setCode(code);
|
423 |
return this; |
424 |
} |
425 |
|
426 |
@Override
|
427 |
public void copyfrom(VCSGisEntity entity) { |
428 |
VCSGisUtils.copy(entity, this, null); |
429 |
} |
430 |
|
431 |
@Override
|
432 |
public void copyto(VCSGisEntityEditable entity) { |
433 |
VCSGisUtils.copy(this, entity, null); |
434 |
} |
435 |
|
436 |
@Override
|
437 |
public JsonObject toJson() {
|
438 |
return this.toJsonBuilder().build(); |
439 |
} |
440 |
|
441 |
@Override
|
442 |
public JsonObjectBuilder toJsonBuilder() {
|
443 |
return VCSGisUtils.toJsonBuilder(this, null); |
444 |
} |
445 |
|
446 |
@Override
|
447 |
public void fromJson(JsonObject json) { |
448 |
VCSGisUtils.fromJson(this, json);
|
449 |
} |
450 |
|
451 |
@Override
|
452 |
public boolean isAuthorized(VCSGisUser user, String operation) { |
453 |
return VCSGisUtils.isAuthorized(this, operation, user); |
454 |
} |
455 |
|
456 |
@Override
|
457 |
public VCSGisEntityEditable setResources(String resources) { |
458 |
this.set(RESOURCES, resources);
|
459 |
return this; |
460 |
} |
461 |
|
462 |
@Override
|
463 |
public String getResources() { |
464 |
return this.getString(RESOURCES); |
465 |
} |
466 |
|
467 |
@Override
|
468 |
public VCSGisEntityEditable setDataModels(String dataModels) { |
469 |
this.set(DATA_MODELS, dataModels);
|
470 |
return this; |
471 |
} |
472 |
|
473 |
@Override
|
474 |
public String getDataModels() { |
475 |
return this.getString(DATA_MODELS); |
476 |
} |
477 |
|
478 |
@Override
|
479 |
public List<String> getDataModelsAsList() { |
480 |
String s = getDataModels();
|
481 |
return VCSGisUtils.getAsList(s);
|
482 |
} |
483 |
} |
484 |
|
485 |
|
486 |
public EntitiesTable() {
|
487 |
super(TABLE_NAME, featureType());
|
488 |
} |
489 |
|
490 |
public EntityRow getByEntityName(VCSGisWorkspace workspace, String entityName) { |
491 |
FeatureStore store = null;
|
492 |
try {
|
493 |
store = workspace.getFeatureStore(TABLE_NAME); |
494 |
Feature f = store.findFirst("\"" + ENTITY_NAME + "\"='" + entityName + "'"); |
495 |
if (f == null) { |
496 |
return null; |
497 |
} |
498 |
EntityRow row = new EntityRow(workspace, f);
|
499 |
return row;
|
500 |
} catch (Exception ex) { |
501 |
throw new RuntimeException("Can't retrieve entity '" + entityName + "'.", ex); |
502 |
} finally {
|
503 |
DisposeUtils.disposeQuietly(store); |
504 |
} |
505 |
} |
506 |
|
507 |
public EntityRow getByEntityCode(VCSGisWorkspace workspace, String entityCode) { |
508 |
FeatureStore store = null;
|
509 |
try {
|
510 |
store = workspace.getFeatureStore(TABLE_NAME); |
511 |
Feature f = store.findFirst("\"" + COD_ENTITY + "\"='" + entityCode + "'"); |
512 |
if (f == null) { |
513 |
return null; |
514 |
} |
515 |
EntityRow row = new EntityRow(workspace, f);
|
516 |
return row;
|
517 |
} catch (Exception ex) { |
518 |
throw new RuntimeException("Can't retrieve entity '" + entityCode + "'.", ex); |
519 |
} finally {
|
520 |
DisposeUtils.disposeQuietly(store); |
521 |
} |
522 |
} |
523 |
|
524 |
public DisposableFeatureSetIterable getAll(VCSGisWorkspace workspace) {
|
525 |
FeatureStore store = null;
|
526 |
try {
|
527 |
store = workspace.getFeatureStore(TABLE_NAME); |
528 |
DisposableFeatureSetIterable items = store.getFeatureSet().iterable(); |
529 |
return items;
|
530 |
} catch (Exception ex) { |
531 |
throw new RuntimeException("Can't retrieve all entities.", ex); |
532 |
} finally {
|
533 |
if (store != null) { |
534 |
DisposeUtils.dispose(store); |
535 |
} |
536 |
} |
537 |
} |
538 |
|
539 |
public static final FeatureType featureType() { |
540 |
DataManager dataManager = DALLocator.getDataManager(); |
541 |
EditableFeatureType ft = dataManager.createFeatureType(); |
542 |
ft.setLabel("VCSGIS Entities");
|
543 |
ft.getTags().set("ID", TABLE_NAME);
|
544 |
ft.add(COD_ENTITY, DataTypes.STRING) |
545 |
.setSize(40)
|
546 |
.setIsPrimaryKey(true)
|
547 |
.setLabel("Code");
|
548 |
ft.add(COD_USER, DataTypes.STRING) |
549 |
.setSize(40)
|
550 |
.setIsPrimaryKey(false)
|
551 |
.setLabel("Code");
|
552 |
ft.add(COD_TOPOLOGYPLAN, DataTypes.STRING) |
553 |
.setSize(40)
|
554 |
.setIsPrimaryKey(false)
|
555 |
.setLabel("Code");
|
556 |
ft.add(ENTITY_NAME, DataTypes.STRING) |
557 |
.setIsIndexed(true)
|
558 |
.setAllowIndexDuplicateds(false)
|
559 |
.setSize(200)
|
560 |
.setLabel("Name");
|
561 |
ft.add(DATATABLE_NAME, DataTypes.STRING) |
562 |
.setSize(200)
|
563 |
.setLabel("Table name")
|
564 |
.setDescription("Name of the table in which the data is stored");
|
565 |
ft.add(FEATUREID_FIELD_NAME, DataTypes.STRING) |
566 |
.setSize(200)
|
567 |
.setLabel("Pk field name")
|
568 |
.setDescription("Name of the primary key of the table.");
|
569 |
ft.add(COD_LOCAL_REVISION, DataTypes.STRING) |
570 |
.setSize(40)
|
571 |
.setLabel("Revision")
|
572 |
.setDescription("Local revision.");
|
573 |
ft.add(COD_REPOSITORY_REVISION, DataTypes.STRING) |
574 |
.setSize(40)
|
575 |
.setLabel("Revision")
|
576 |
.setDescription("Last revision in repository.");
|
577 |
ft.add(ENTITY_STATE, DataTypes.INTEGER) |
578 |
.setLabel("State")
|
579 |
.setDescription("State of entity.");
|
580 |
ft.add(GEOMETRY_FIELD_NAME, DataTypes.STRING) |
581 |
.setSize(200)
|
582 |
.setLabel("Geometry field name")
|
583 |
.setDescription("Name of the geometry attribute.");
|
584 |
ft.add(FIELD_FOR_LABEL, DataTypes.STRING) |
585 |
.setSize(200)
|
586 |
.setLabel("Field for label");
|
587 |
ft.add(CATEGORY, DataTypes.STRING) |
588 |
.setSize(200)
|
589 |
.setLabel("Category");
|
590 |
ft.add(LABEL, DataTypes.STRING) |
591 |
.setSize(200)
|
592 |
.setLabel("Label");
|
593 |
ft.add(AUTHORIZATIONS, DataTypes.STRING) |
594 |
.setSize(10240)
|
595 |
.setLabel("Authorizations")
|
596 |
.setDefaultFieldValue("{\n" +
|
597 |
" \"add\": [ \"*\" ],\n" +
|
598 |
" \"checkout\": [ \"*\" ],\n" +
|
599 |
" \"commit\": [ \"*\" ],\n" +
|
600 |
" \"entities\": [ \"*\" ],\n" +
|
601 |
" \"history\": [ \"*\" ],\n" +
|
602 |
" \"topologyplans\": [ \"*\" ],\n" +
|
603 |
" \"update\": [ \"*\" ],\n" +
|
604 |
" \"users\": [ \"*\" ]\n" +
|
605 |
"}")
|
606 |
.setDescription("Json with the information of what operations the different users can do.\nExample:\n{\n" +
|
607 |
" \"add\": [ \"user1\", \"$admin\"],\n" +
|
608 |
" \"checkout\": [ \"user1\", \"user2\"],\n" +
|
609 |
" \"commit\": [ \"user1\" ],\n" +
|
610 |
" \"entities\": [ \"user1\", \"user2\"],\n" +
|
611 |
" \"history\": [ \"user1\" ],\n" +
|
612 |
" \"topologyplans\": [ \"user1\", \"user2\"],\n" +
|
613 |
" \"update\": [ \"user1\", \"user2\"],\n" +
|
614 |
" \"users\": [ \"user1\", \"user2\"]\n" +
|
615 |
"}\n\n" +
|
616 |
"use $ before the name to indicate a role name instead of a username.");
|
617 |
ft.add(DESCRIPTION, DataTypes.STRING) |
618 |
.setSize(10240)
|
619 |
.setLabel("Description");
|
620 |
ft.add(FEATURETYPE, DataTypes.STRING) |
621 |
.setSize(10240)
|
622 |
.setLabel("Feature type");
|
623 |
ft.add(TOPOLOGYPLAN_MODE, DataTypes.INTEGER) |
624 |
.setLabel("Topology plan mode")
|
625 |
.setAvailableValues(new DynObjectValueItem[] { |
626 |
new DynObjectValueItem(TOPOLOGYPLAN_MODE_RECOMMENDED, "Recommended"), |
627 |
new DynObjectValueItem(TOPOLOGYPLAN_MODE_MANDATORY, "Mandatory") |
628 |
}) |
629 |
; |
630 |
ft.add(RESOURCES, DataTypes.STRING) |
631 |
.setSize(200)
|
632 |
.setLabel("Resources");
|
633 |
ft.add(DATA_MODELS, DataTypes.STRING) |
634 |
.setSize(200)
|
635 |
.setLabel("Data models");
|
636 |
|
637 |
return ft.getNotEditableCopy();
|
638 |
} |
639 |
|
640 |
} |