[
https://jira.nuxeo.com/browse/NXP-6301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=89667#action_89667
]
Wojciech Sulejman commented on NXP-6301:
----------------------------------------
My next step was to use the max field of the StringLengthConstraints class
signifying the maximum string length to be used for the SQL's VARCHAR size
//set the max field length from the constraints
if (fieldType instanceof SimpleTypeImpl){
SimpleTypeImpl sti=(SimpleTypeImpl)fieldType;
for(Constraint constraint:sti.getConstraints()){
if(constraint instanceof StringLengthConstraint){
StringLengthConstraint
stc=(StringLengthConstraint)constraint;
fieldLength=stc.getMax();
}
}
}
return type.addField(elementName, fieldType.getRef(), defValue, flags,
fieldLength);
the add.Field method returns a Field (interface to which I wanted to add a new
method: "Integer getLength()".
This method would populate the length field of the Column object returned by
the Column getSqlColumn(String name, String typeName, int length) method of the
FieldMapper.
1) now, because the "type" object (type.addField...) is of the ComplexType
type which uses a TypeRef proxy I do not know what the best path is to pass the
max length using the proxy without directly passing/exposing implementation
details so that I do not break the abstraction in the process?
2) What would be the least invasive, interface-wise, path of the xsd defined
length to be passed on to the Column definition?
(I do agree with Thierry D. that the FieldMapper should return a column object
which should also include a "length" field. That is a full SQL type definition
should be returned, unlike the original method's: public static int
getSqlField(String name), which did not pass any field lengths from the
configuration to the sql directory classes -> those being its primary consumer)
> length of field in schema should be configurable
> ------------------------------------------------
>
> Key: NXP-6301
> URL: https://jira.nuxeo.com/browse/NXP-6301
> Project: Nuxeo Enterprise Platform
> Issue Type: Improvement
> Affects Versions: 5.4.0.1
> Reporter: Alexandre Russel
> Assignee: Wojciech Sulejman
> Fix For: 5.4.1
>
>
> I should be able to do:
> <simpleType name="myString">
> <restriction base="string">
> <maxLength value="200"/>
> </restriction>
> </simpleType>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.nuxeo.com/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
_______________________________________________
ECM-tickets mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm-tickets