Commit 98335761 authored by Ate Douma's avatar Ate Douma

CMS7-7024: drop DocumentTypeField.getCaption() as exposing it doesn't really...

CMS7-7024: drop DocumentTypeField.getCaption() as exposing it doesn't really match the purpose of the model, and correct the definingType for derived fields.
parent dd8743a6
......@@ -27,7 +27,6 @@ public class DocumentTypeFieldImpl extends Sealable implements DocumentTypeField
private final String definingType;
private final String name;
private EffectiveNodeTypeItem nti;
private String caption;
private final boolean propertyField;
private boolean derivedField;
private final String fieldType;
......@@ -66,8 +65,8 @@ public class DocumentTypeFieldImpl extends Sealable implements DocumentTypeField
this.propertyField = false;
}
public DocumentTypeFieldImpl(String definingType, EffectiveNodeTypeProperty property) {
this.definingType = definingType;
public DocumentTypeFieldImpl(EffectiveNodeTypeProperty property) {
this.definingType = property.getDefiningType();
this.nti = property;
this.primaryField = false;
this.propertyField = true;
......@@ -82,8 +81,8 @@ public class DocumentTypeFieldImpl extends Sealable implements DocumentTypeField
this.ordered = false;
}
public DocumentTypeFieldImpl(String definingType, EffectiveNodeTypeChild child) {
this.definingType = definingType;
public DocumentTypeFieldImpl(EffectiveNodeTypeChild child) {
this.definingType = child.getDefiningType();
this.nti = child;
this.primaryField = false;
this.propertyField = false;
......@@ -131,16 +130,6 @@ public class DocumentTypeFieldImpl extends Sealable implements DocumentTypeField
return name;
}
@Override
public String getCaption() {
return caption;
}
public void setCaption(String caption) {
checkSealed();
this.caption = caption;
}
@Override
public String getDefiningType() {
return definingType;
......
......@@ -300,7 +300,7 @@ public class DocumentTypeImpl extends Sealable implements DocumentType {
DocumentTypeFieldImpl dft = (DocumentTypeFieldImpl)fields.get(entry.getKey());
if (dft == null) {
// create new derived field
dft = new DocumentTypeFieldImpl(getName(), ent.getProperties().get(entry.getKey()).get(0));
dft = new DocumentTypeFieldImpl(entry.getValue().get(0));
fields.put(entry.getKey(), dft);
if (ent.getProperties().get(entry.getKey()).size() > 1) {
log.warn("Effective NodeType {} defines multiple properties named {} without corresponding field in Document Type {}. "
......@@ -384,7 +384,7 @@ public class DocumentTypeImpl extends Sealable implements DocumentType {
if (dft == null) {
if (!ignoredFields.contains(entry.getKey())) {
// create derived field
dft = new DocumentTypeFieldImpl(getName(), entry.getValue().get(0));
dft = new DocumentTypeFieldImpl(entry.getValue().get(0));
fields.put(entry.getKey(), dft);
if (ent.getChildren().get(entry.getKey()).size() > 1) {
log.warn("Effective NodeType {} defines multiple child nodes named {} without corresponding field in Document Type {}. "
......
......@@ -588,9 +588,6 @@ public class HippoContentTypeService implements ContentTypeService {
// TODO: this doesn't work anyway as df.getName() is based on the path property of the hipposysedit:field node, not its name (the latter is 'lost' when arriving here)
if (editorTemplate.hasNode(df.getName())) {
Node fieldEditor = editorTemplate.getNode(df.getName());
if (fieldEditor.hasProperty("caption")) {
df.setCaption(fieldEditor.getProperty("caption").getString());
}
if (fieldEditor.hasNode("cluster.options")) {
Node clusterOptions = fieldEditor.getNode("cluster.options");
for (PropertyIterator pi = clusterOptions.getProperties(); pi.hasNext(); ) {
......
......@@ -13,7 +13,6 @@
"test:title" : {
"definingType" : "test:test",
"name" : "test:title",
"caption" : null,
"propertyField" : true,
"derivedField" : false,
"fieldType" : "String",
......@@ -45,7 +44,6 @@
"test:child" : {
"definingType" : "test:test",
"name" : "test:child",
"caption" : null,
"propertyField" : false,
"derivedField" : false,
"fieldType" : "nt:unstructured",
......@@ -76,7 +74,6 @@
"test:extraField" : {
"definingType" : "test:test",
"name" : "test:extraField",
"caption" : null,
"propertyField" : true,
"derivedField" : false,
"fieldType" : "String",
......@@ -106,9 +103,8 @@
}
},
"jcr:mixinTypes" : {
"definingType" : "hippostd:relaxed,test:test",
"definingType" : "nt:base",
"name" : "jcr:mixinTypes",
"caption" : null,
"propertyField" : true,
"derivedField" : true,
"fieldType" : "Name",
......@@ -138,9 +134,8 @@
}
},
"jcr:primaryType" : {
"definingType" : "hippostd:relaxed,test:test",
"definingType" : "nt:base",
"name" : "jcr:primaryType",
"caption" : null,
"propertyField" : true,
"derivedField" : true,
"fieldType" : "Name",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment