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