|
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;
|
@@ -5559,7 +5560,53 @@ else if("location".equals(fieldName))
|
5559 | 5560 | wSmartDataModel.l();
|
5560 | 5561 | }
|
5561 | 5562 | }
|
| 5563 | + |
| 5564 | + wSmartDataModel.l(""); |
| 5565 | + wSmartDataModel.l(" /**"); |
| 5566 | + wSmartDataModel.l(" * {@inheritDoc}"); |
| 5567 | + wSmartDataModel.l(" * DocValues: true"); |
| 5568 | + wSmartDataModel.l(" * Persist: true"); |
| 5569 | + wSmartDataModel.l(" * DisplayName: entity ID"); |
| 5570 | + wSmartDataModel.l(" * Description: A unique ID for this Smart Data Model"); |
| 5571 | + wSmartDataModel.l(" * HtmRow: 3"); |
| 5572 | + wSmartDataModel.l(" * HtmCell: 1"); |
| 5573 | + wSmartDataModel.l(" * Facet: true"); |
| 5574 | + wSmartDataModel.l(" */"); |
| 5575 | + wSmartDataModel.l(" protected void _entityId(Wrap<String> w) {"); |
| 5576 | + if(properties.fieldNames().contains("name")) { |
| 5577 | + wSmartDataModel.l(" w.o(String.format(\"urn:ngsi-ld:%s:%s\", CLASS_SIMPLE_NAME, toId(name)));"); |
| 5578 | + } |
| 5579 | + wSmartDataModel.l(" }"); |
| 5580 | + wSmartDataModel.l(""); |
| 5581 | + wSmartDataModel.l(" /**"); |
| 5582 | + wSmartDataModel.l(" * {@inheritDoc}"); |
| 5583 | + wSmartDataModel.l(" * DisplayName: short entity ID"); |
| 5584 | + wSmartDataModel.l(" * Description: A short ID for this Smart Data Model"); |
| 5585 | + wSmartDataModel.l(" * Facet: true"); |
| 5586 | + wSmartDataModel.l(" */"); |
| 5587 | + wSmartDataModel.l(" protected void _entityShortId(Wrap<String> w) {"); |
| 5588 | + wSmartDataModel.l(" if(entityId != null) {"); |
| 5589 | + wSmartDataModel.l(" w.o(StringUtils.substringAfter(entityId, String.format(\"urn:ngsi-ld:%s:\", CLASS_SIMPLE_NAME)));"); |
| 5590 | + wSmartDataModel.l(" }"); |
| 5591 | + wSmartDataModel.l(" }"); |
| 5592 | + wSmartDataModel.l(""); |
| 5593 | + wSmartDataModel.l(" @Override"); |
| 5594 | + wSmartDataModel.l(" protected void _objectTitle(Wrap<String> w) {"); |
| 5595 | + wSmartDataModel.l(" StringBuilder b = new StringBuilder();"); |
| 5596 | + wSmartDataModel.l(" b.append(Optional.ofNullable(entityShortId).map(s -> String.format(\"%s - %s\", ", classeNomSimple, "_NameAdjectiveSingular_enUS, s)).orElse(pk.toString()));"); |
| 5597 | + wSmartDataModel.l(" w.o(b.toString().trim());"); |
| 5598 | + wSmartDataModel.l(" }"); |
| 5599 | + wSmartDataModel.l(""); |
| 5600 | + wSmartDataModel.l(" @Override"); |
| 5601 | + wSmartDataModel.l(" protected void _objectId(Wrap<String> w) {"); |
| 5602 | + wSmartDataModel.l(" if(objectTitle != null) {"); |
| 5603 | + wSmartDataModel.l(" w.o(toId(objectTitle));"); |
| 5604 | + wSmartDataModel.l(" } else if(id != null){"); |
| 5605 | + wSmartDataModel.l(" w.o(id.toString());"); |
| 5606 | + wSmartDataModel.l(" }"); |
| 5607 | + wSmartDataModel.l(" }"); |
5562 | 5608 | wSmartDataModel.l("}");
|
| 5609 | + |
5563 | 5610 | wSmartDataModel.l();
|
5564 | 5611 | System.out.println(wSmartDataModel);
|
5565 | 5612 | }
|
|
0 commit comments