|
75 | 75 | import org.apache.solr.common.SolrDocumentList;
|
76 | 76 | import org.apache.solr.common.SolrInputDocument;
|
77 | 77 | import org.apache.solr.common.SolrInputField;
|
| 78 | +import org.computate.search.wrap.Wrap; |
78 | 79 | import org.slf4j.Logger;
|
79 | 80 | import org.slf4j.LoggerFactory;
|
80 | 81 | import org.yaml.snakeyaml.Yaml;
|
@@ -5439,6 +5440,7 @@ else if(langueConfig.getString(ConfigCles.var_PUTFusion).equals(classeApiMethode
|
5439 | 5440 | wSmartDataModel.l("import io.vertx.core.json.JsonObject;");
|
5440 | 5441 | wSmartDataModel.l("import io.vertx.pgclient.data.Path;");
|
5441 | 5442 | wSmartDataModel.l("import io.vertx.pgclient.data.Point;");
|
| 5443 | + wSmartDataModel.l("import io.vertx.pgclient.data.Polygon;"); |
5442 | 5444 | wSmartDataModel.l();
|
5443 | 5445 | wSmartDataModel.l("/**");
|
5444 | 5446 | wSmartDataModel.l(" * SmartDataModel: ", classeSmartDataModel, " - ", classeSmartDataSubModule, " - ", classeSmartDataDomain);
|
@@ -5484,7 +5486,7 @@ else if(langueConfig.getString(ConfigCles.var_PUTFusion).equals(classeApiMethode
|
5484 | 5486 | String description = field.getString("description");
|
5485 | 5487 | String javaType = "JsonObject";
|
5486 | 5488 | if("areaServed".equals(fieldName))
|
5487 |
| - javaType = "Path"; |
| 5489 | + javaType = "Polygon"; |
5488 | 5490 | else if("location".equals(fieldName))
|
5489 | 5491 | javaType = "Point";
|
5490 | 5492 | else if("string".equals(jsonType))
|
@@ -5559,7 +5561,53 @@ else if("location".equals(fieldName))
|
5559 | 5561 | wSmartDataModel.l();
|
5560 | 5562 | }
|
5561 | 5563 | }
|
| 5564 | + |
| 5565 | + wSmartDataModel.l(""); |
| 5566 | + wSmartDataModel.l(" /**"); |
| 5567 | + wSmartDataModel.l(" * {@inheritDoc}"); |
| 5568 | + wSmartDataModel.l(" * DocValues: true"); |
| 5569 | + wSmartDataModel.l(" * Persist: true"); |
| 5570 | + wSmartDataModel.l(" * DisplayName: entity ID"); |
| 5571 | + wSmartDataModel.l(" * Description: A unique ID for this Smart Data Model"); |
| 5572 | + wSmartDataModel.l(" * HtmRow: 3"); |
| 5573 | + wSmartDataModel.l(" * HtmCell: 1"); |
| 5574 | + wSmartDataModel.l(" * Facet: true"); |
| 5575 | + wSmartDataModel.l(" */"); |
| 5576 | + wSmartDataModel.l(" protected void _entityId(Wrap<String> w) {"); |
| 5577 | + if(properties.fieldNames().contains("name")) { |
| 5578 | + wSmartDataModel.l(" w.o(String.format(\"urn:ngsi-ld:%s:%s\", CLASS_SIMPLE_NAME, toId(name)));"); |
| 5579 | + } |
| 5580 | + wSmartDataModel.l(" }"); |
| 5581 | + wSmartDataModel.l(""); |
| 5582 | + wSmartDataModel.l(" /**"); |
| 5583 | + wSmartDataModel.l(" * {@inheritDoc}"); |
| 5584 | + wSmartDataModel.l(" * DisplayName: short entity ID"); |
| 5585 | + wSmartDataModel.l(" * Description: A short ID for this Smart Data Model"); |
| 5586 | + wSmartDataModel.l(" * Facet: true"); |
| 5587 | + wSmartDataModel.l(" */"); |
| 5588 | + wSmartDataModel.l(" protected void _entityShortId(Wrap<String> w) {"); |
| 5589 | + wSmartDataModel.l(" if(entityId != null) {"); |
| 5590 | + wSmartDataModel.l(" w.o(StringUtils.substringAfter(entityId, String.format(\"urn:ngsi-ld:%s:\", CLASS_SIMPLE_NAME)));"); |
| 5591 | + wSmartDataModel.l(" }"); |
| 5592 | + wSmartDataModel.l(" }"); |
| 5593 | + wSmartDataModel.l(""); |
| 5594 | + wSmartDataModel.l(" @Override"); |
| 5595 | + wSmartDataModel.l(" protected void _objectTitle(Wrap<String> w) {"); |
| 5596 | + wSmartDataModel.l(" StringBuilder b = new StringBuilder();"); |
| 5597 | + wSmartDataModel.l(" b.append(Optional.ofNullable(entityShortId).map(s -> String.format(\"%s - %s\", ", classeNomSimple, "_NameAdjectiveSingular_enUS, s)).orElse(pk.toString()));"); |
| 5598 | + wSmartDataModel.l(" w.o(b.toString().trim());"); |
| 5599 | + wSmartDataModel.l(" }"); |
| 5600 | + wSmartDataModel.l(""); |
| 5601 | + wSmartDataModel.l(" @Override"); |
| 5602 | + wSmartDataModel.l(" protected void _objectId(Wrap<String> w) {"); |
| 5603 | + wSmartDataModel.l(" if(objectTitle != null) {"); |
| 5604 | + wSmartDataModel.l(" w.o(toId(objectTitle));"); |
| 5605 | + wSmartDataModel.l(" } else if(id != null){"); |
| 5606 | + wSmartDataModel.l(" w.o(id.toString());"); |
| 5607 | + wSmartDataModel.l(" }"); |
| 5608 | + wSmartDataModel.l(" }"); |
5562 | 5609 | wSmartDataModel.l("}");
|
| 5610 | + |
5563 | 5611 | wSmartDataModel.l();
|
5564 | 5612 | System.out.println(wSmartDataModel);
|
5565 | 5613 | }
|
|
0 commit comments