summaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorArne H Juul <arnej@yahooinc.com>2022-03-18 10:09:57 +0000
committerArne H Juul <arnej@yahooinc.com>2022-03-18 12:04:26 +0000
commit7a936b42393e65c0c5886b9747018ebab839c887 (patch)
treecb2b6bb372d2bd4d42b39da4e1cad7f14578d1a8 /config-model
parent497cef53c4174f3c7b1b9b729b43fcbd6d3bdaf4 (diff)
header -> content struct
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/java/com/yahoo/documentmodel/NewDocumentType.java33
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentManager.java6
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentTypes.java2
3 files changed, 12 insertions, 29 deletions
diff --git a/config-model/src/main/java/com/yahoo/documentmodel/NewDocumentType.java b/config-model/src/main/java/com/yahoo/documentmodel/NewDocumentType.java
index a6571ef819d..c008b4f1e36 100644
--- a/config-model/src/main/java/com/yahoo/documentmodel/NewDocumentType.java
+++ b/config-model/src/main/java/com/yahoo/documentmodel/NewDocumentType.java
@@ -38,7 +38,7 @@ public final class NewDocumentType extends StructuredDataType implements DataTyp
private final DataTypeRepo dataTypes = new DataTypeRepo();
private final Map<Integer, NewDocumentType> inherits = new LinkedHashMap<>();
private final AnnotationTypeRegistry annotations = new AnnotationTypeRegistry();
- private final StructDataType header;
+ private final StructDataType contentStruct;
private final Set<FieldSet> fieldSets = new LinkedHashSet<>();
private final Set<Name> documentReferences;
// Imported fields are virtual and therefore exist outside of the SD's document field definition
@@ -66,13 +66,13 @@ public final class NewDocumentType extends StructuredDataType implements DataTyp
}
public NewDocumentType(Name name,
- StructDataType header,
+ StructDataType contentStruct,
FieldSets fs,
Set<Name> documentReferences,
Set<String> importedFieldNames) {
super(name.getName());
this.name = name;
- this.header = header;
+ this.contentStruct = contentStruct;
if (fs != null) {
this.fieldSets.addAll(fs.userFieldSets().values());
for (FieldSet f : fs.builtInFieldSets().values()) {
@@ -90,28 +90,11 @@ public final class NewDocumentType extends StructuredDataType implements DataTyp
return name;
}
- public DataType getHeader() { return header; }
+ public DataType getContentStruct() { return contentStruct; }
public Collection<NewDocumentType> getInherited() { return inherits.values(); }
public NewDocumentType getInherited(Name inherited) { return inherits.get(inherited.getId()); }
public NewDocumentType removeInherited(Name inherited) { return inherits.remove(inherited.getId()); }
- /**
- * Data type of the header fields of this and all inherited document types
- * @return merged {@link StructDataType}
- */
- public StructDataType allHeader() {
- StructDataType ret = new StructDataType(header.getName());
- for (Field f : header.getFields()) {
- ret.addField(f);
- }
- for (NewDocumentType inherited : getInherited()) {
- for (Field f : ((StructDataType) inherited.getHeader()).getFields()) {
- ret.addField(f);
- }
- }
- return ret;
- }
-
@Override
public Class<Document> getValueClass() {
return Document.class;
@@ -172,7 +155,7 @@ public final class NewDocumentType extends StructuredDataType implements DataTyp
@Override
public Field getField(String name) {
- Field field = header.getField(name);
+ Field field = contentStruct.getField(name);
if (field == null) {
for (NewDocumentType inheritedType : inherits.values()) {
field = inheritedType.getField(name);
@@ -190,7 +173,7 @@ public final class NewDocumentType extends StructuredDataType implements DataTyp
@Override
public Field getField(int id) {
- Field field = header.getField(id);
+ Field field = contentStruct.getField(id);
if (field == null) {
for (NewDocumentType inheritedType : inherits.values()) {
field = inheritedType.getField(id);
@@ -209,13 +192,13 @@ public final class NewDocumentType extends StructuredDataType implements DataTyp
collection.addAll(type.getAllFields());
}
- collection.addAll(header.getFields());
+ collection.addAll(contentStruct.getFields());
return Collections.unmodifiableCollection(collection);
}
public Collection<Field> getFields() {
Collection<Field> collection = new LinkedList<>();
- collection.addAll(header.getFields());
+ collection.addAll(contentStruct.getFields());
return Collections.unmodifiableCollection(collection);
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentManager.java b/config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentManager.java
index 6f52a384a36..43b32ed391e 100644
--- a/config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentManager.java
+++ b/config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentManager.java
@@ -138,7 +138,7 @@ public class DocumentManager {
builder.documenttype(doc);
doc.
name(dt.getName()).
- headerstruct(dt.getHeader().getId());
+ headerstruct(dt.getContentStruct().getId());
for (NewDocumentType inherited : dt.getInherited()) {
doc.inherits(new Datatype.Documenttype.Inherits.Builder().name(inherited.getName()));
}
@@ -280,13 +280,13 @@ public class DocumentManager {
db.
idx(indexMap.idxOf(documentType)).
name(documentType.getName()).
- contentstruct(indexMap.idxOf(documentType.getHeader()));
+ contentstruct(indexMap.idxOf(documentType.getContentStruct()));
docTypeBuildFieldSets(documentType.getFieldSets(), db);
docTypeBuildImportedFields(documentType.getImportedFieldNames(), db);
for (NewDocumentType inherited : documentType.getInherited()) {
db.inherits(b -> b.idx(indexMap.idxOf(inherited)));
}
- docTypeBuildAnyType(documentType.getHeader(), db, indexMap);
+ docTypeBuildAnyType(documentType.getContentStruct(), db, indexMap);
for (DataType dt : sortedList(documentType.getAllTypes().getTypes(),
(a,b) -> a.getName().compareTo(b.getName()))) {
diff --git a/config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentTypes.java b/config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentTypes.java
index 2f0814bd664..dd6ae6cf2ee 100644
--- a/config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentTypes.java
+++ b/config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentTypes.java
@@ -58,7 +58,7 @@ public class DocumentTypes {
db.
id(documentType.getId()).
name(documentType.getName()).
- headerstruct(documentType.getHeader().getId());
+ headerstruct(documentType.getContentStruct().getId());
Set<Integer> built = new HashSet<>();
for (NewDocumentType inherited : documentType.getInherited()) {
db.inherits(new DocumenttypesConfig.Documenttype.Inherits.Builder().id(inherited.getId()));