Comments (20)
Hi
Looks like a useful addition. Indeed the convert function could be a bit
difficult, because the model generator is using jackson for serialization.
But I'm sure there is a solution for this.
Would be nice if you could contribut some code. I'm happy to integrate this
into the next release.
Ralph
On Sat, Nov 24, 2012 at 2:37 AM, dilbertside [email protected]:
Hi,
I had in mind to upgrade to the new model generator as I have a new grid
to build from a deprecated one.
Every thing is fine so far.
But I face a problem with one single column type 'checkcolumn' which is a
virtual field in the original model.
code
fields: [
....
,{name: 'sl', type: 'string'}
,{name: 'ac', type: 'bool', //Virtual Field
mapping: 'sl', persist: false,
convert: function(v, record) {
var a = record.raw.sl.split('|');
return (a.length > 1);
}
}
],
......Question is: will it be possible to extend the model generator to produce
this virtual field.
The difficult part is maybe the convert function but I have some ode
somewhere which I made for a metachange store event , I was sending a
convert function from the backend without troubles.
I could contribute for that bit or more if you want.What do you think?
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/50.
from extdirectspring.
Ok. I propose a draft on my fork.
On 11/24/2012 09:47 AM, Ralph Schaer wrote:
Hi
Looks like a useful addition. Indeed the convert function could be a bit
difficult, because the model generator is using jackson for
serialization.
But I'm sure there is a solution for this.
Would be nice if you could contribut some code. I'm happy to integrate
this
into the next release.Ralph
On Sat, Nov 24, 2012 at 2:37 AM, dilbertside
[email protected]:Hi,
I had in mind to upgrade to the new model generator as I have a new
grid
to build from a deprecated one.
Every thing is fine so far.
But I face a problem with one single column type 'checkcolumn' which
is a
virtual field in the original model.
code
fields: [
....
,{name: 'sl', type: 'string'}
,{name: 'ac', type: 'bool', //Virtual Field
mapping: 'sl', persist: false,
convert: function(v, record) {
var a = record.raw.sl.split('|');
return (a.length > 1);
}
}
],
......Question is: will it be possible to extend the model generator to
produce
this virtual field.
The difficult part is maybe the convert function but I have some ode
somewhere which I made for a metachange store event , I was sending a
convert function from the backend without troubles.
I could contribute for that bit or more if you want.What do you think?
—
Reply to this email directly or view it on
GitHubhttps://github.com//issues/50.—
Reply to this email directly or view it on GitHub
#50 (comment).
from extdirectspring.
draft committed;
2 remarks
I suggest the following version
the java script engine will parse it and I guess create an appropriate
object, when the Ext.onReady is called (inconvenience, cannot reload the
model dynamically, and inject it)
@ModelField(mapping="bigValue", persist=false, convert="function(v,
record) { return (record.raw.bigValue > 1000000);}")
this one is maybe useless as it might not be needed to instantiate
a function on the fly, but will provide a way to inject the model when
the app is already instanciated
@ModelField(mapping="bigValue", persist=false, convert="new
Function('v', 'record', return (record.raw.bigValue > 1000000);)")
In the unit test I hit a problem as by default the model generator set
mapper.configure(JsonGenerator.Feature.QUOTE_FIELD_NAMES, false);
problem in the case of the convert function, it is not required,
possible solution json mixin? ;-)
do you have another idea to cancel this quote field name for that single
field?
Regards,
On 11/24/2012 09:47 AM, Ralph Schaer wrote:
Hi
Looks like a useful addition. Indeed the convert function could be a bit
difficult, because the model generator is using jackson for
serialization.
But I'm sure there is a solution for this.
Would be nice if you could contribut some code. I'm happy to integrate
this
into the next release.Ralph
On Sat, Nov 24, 2012 at 2:37 AM, dilbertside
[email protected]:Hi,
I had in mind to upgrade to the new model generator as I have a new
grid
to build from a deprecated one.
Every thing is fine so far.
But I face a problem with one single column type 'checkcolumn' which
is a
virtual field in the original model.
code
fields: [
....
,{name: 'sl', type: 'string'}
,{name: 'ac', type: 'bool', //Virtual Field
mapping: 'sl', persist: false,
convert: function(v, record) {
var a = record.raw.sl.split('|');
return (a.length > 1);
}
}
],
......Question is: will it be possible to extend the model generator to
produce
this virtual field.
The difficult part is maybe the convert function but I have some ode
somewhere which I made for a metachange store event , I was sending a
convert function from the backend without troubles.
I could contribute for that bit or more if you want.What do you think?
—
Reply to this email directly or view it on
GitHubhttps://github.com//issues/50.—
Reply to this email directly or view it on GitHub
#50 (comment).
from extdirectspring.
actually I'm wrong this
mapper.configure(JsonGenerator.Feature.QUOTE_FIELD_NAMES, false); has no
incidence...
On 11/24/2012 09:47 AM, Ralph Schaer wrote:
Hi
Looks like a useful addition. Indeed the convert function could be a bit
difficult, because the model generator is using jackson for
serialization.
But I'm sure there is a solution for this.
Would be nice if you could contribut some code. I'm happy to integrate
this
into the next release.Ralph
On Sat, Nov 24, 2012 at 2:37 AM, dilbertside
[email protected]:Hi,
I had in mind to upgrade to the new model generator as I have a new
grid
to build from a deprecated one.
Every thing is fine so far.
But I face a problem with one single column type 'checkcolumn' which
is a
virtual field in the original model.
code
fields: [
....
,{name: 'sl', type: 'string'}
,{name: 'ac', type: 'bool', //Virtual Field
mapping: 'sl', persist: false,
convert: function(v, record) {
var a = record.raw.sl.split('|');
return (a.length > 1);
}
}
],
......Question is: will it be possible to extend the model generator to
produce
this virtual field.
The difficult part is maybe the convert function but I have some ode
somewhere which I made for a metachange store event , I was sending a
convert function from the backend without troubles.
I could contribute for that bit or more if you want.What do you think?
—
Reply to this email directly or view it on
GitHubhttps://github.com//issues/50.—
Reply to this email directly or view it on GitHub
#50 (comment).
from extdirectspring.
ok got it by using @JsonRawValue
On 11/24/2012 09:47 AM, Ralph Schaer wrote:
Hi
Looks like a useful addition. Indeed the convert function could be a bit
difficult, because the model generator is using jackson for
serialization.
But I'm sure there is a solution for this.
Would be nice if you could contribut some code. I'm happy to integrate
this
into the next release.Ralph
On Sat, Nov 24, 2012 at 2:37 AM, dilbertside
[email protected]:Hi,
I had in mind to upgrade to the new model generator as I have a new
grid
to build from a deprecated one.
Every thing is fine so far.
But I face a problem with one single column type 'checkcolumn' which
is a
virtual field in the original model.
code
fields: [
....
,{name: 'sl', type: 'string'}
,{name: 'ac', type: 'bool', //Virtual Field
mapping: 'sl', persist: false,
convert: function(v, record) {
var a = record.raw.sl.split('|');
return (a.length > 1);
}
}
],
......Question is: will it be possible to extend the model generator to
produce
this virtual field.
The difficult part is maybe the convert function but I have some ode
somewhere which I made for a metachange store event , I was sending a
convert function from the backend without troubles.
I could contribute for that bit or more if you want.What do you think?
—
Reply to this email directly or view it on
GitHubhttps://github.com//issues/50.—
Reply to this email directly or view it on GitHub
#50 (comment).
from extdirectspring.
This @JsonRawValue is interesting. Maybe this could also solve my problem
with directFn,read,... methods. Right now I remove the quotes with a call
to string.replaceAll call.
On Sat, Nov 24, 2012 at 5:03 AM, dilbertside [email protected]:
@JsonRawValue
from extdirectspring.
ah that's the reason I saw those regexes, get it now.
certainly, will do and avoid overhead: end result faster.
I still have pending problem with the test
a single quote is added to the string to compare
});'
in
compareExtJs4Model(ModelGenerator.generateJavascript(BeanWithAnnotations.class,
OutputFormat.EXTJS4, true),
true);
in testGenerateJavascriptClassOfQOutputFormatBoolean
I don't understand why as I stick to your model as close as possible
On 11/24/2012 12:11 PM, Ralph Schaer wrote:
This @JsonRawValue is interesting. Maybe this could also solve my problem
with directFn,read,... methods. Right now I remove the quotes with a call
to string.replaceAll call.On Sat, Nov 24, 2012 at 5:03 AM, dilbertside
[email protected]:@JsonRawValue
—
Reply to this email directly or view it on GitHub
#50 (comment).
from extdirectspring.
Don't have a problem with this test. It's only missing the two new fields.
I don't have a ' at the end.
On Sat, Nov 24, 2012 at 5:17 AM, dilbertside [email protected]:
ah that's the reason I saw those regexes, get it now.
certainly, will do and avoid overhead: end result faster.
I still have pending problem with the test
a single quote is added to the string to compare
});'in
compareExtJs4Model(ModelGenerator.generateJavascript(BeanWithAnnotations.class,OutputFormat.EXTJS4, true),
true);
in testGenerateJavascriptClassOfQOutputFormatBooleanI don't understand why as I stick to your model as close as possible
On 11/24/2012 12:11 PM, Ralph Schaer wrote:
This @JsonRawValue is interesting. Maybe this could also solve my problem
with directFn,read,... methods. Right now I remove the quotes with a call
to string.replaceAll call.On Sat, Nov 24, 2012 at 5:03 AM, dilbertside
[email protected]:@JsonRawValue
—
Reply to this email directly or view it on GitHub
<
https://github.com/ralscha/extdirectspring/issues/50#issuecomment-10673725>.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/50#issuecomment-10673767.
from extdirectspring.
I'm wondering if we can improve this a bit more. If I'm understand this
correctly then
private boolean aBooleanVirtual;
is an useless instance variable.
Maybe we can put two @ModelField annotation on one field. Something like
this:
@ModelFields({
@ModelField,
@ModelField(mapping="bigValue", persist=false, convert="function(v,
record) { return (record.raw.bigValue >
1000000);}")
})
private BigInteger bigValue;
On Sat, Nov 24, 2012 at 5:28 AM, Ralph Schaer [email protected] wrote:
Don't have a problem with this test. It's only missing the two new fields.
I don't have a ' at the end.On Sat, Nov 24, 2012 at 5:17 AM, dilbertside [email protected]:
ah that's the reason I saw those regexes, get it now.
certainly, will do and avoid overhead: end result faster.
I still have pending problem with the test
a single quote is added to the string to compare
});'in
compareExtJs4Model(ModelGenerator.generateJavascript(BeanWithAnnotations.class,OutputFormat.EXTJS4, true),
true);
in testGenerateJavascriptClassOfQOutputFormatBooleanI don't understand why as I stick to your model as close as possible
On 11/24/2012 12:11 PM, Ralph Schaer wrote:
This @JsonRawValue is interesting. Maybe this could also solve my
problem
with directFn,read,... methods. Right now I remove the quotes with a
call
to string.replaceAll call.On Sat, Nov 24, 2012 at 5:03 AM, dilbertside
[email protected]:@JsonRawValue
—
Reply to this email directly or view it on GitHub
<
https://github.com/ralscha/extdirectspring/issues/50#issuecomment-10673725>.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/50#issuecomment-10673767.
from extdirectspring.
Well, agree, Java speaking it is useless.
But in terms of extjs model we still need it, the generator need to
build this variable and its name.
So it will be used by Extjs library.
Without name this virtual field is useless on extjs side.
If you are concerned about having this variable being jsonified at
runtime, it is better to include @JsonInclude(Include.NON_NULL)
So this variable won't be instantiated at runtime by being set at null
permanently.
If you want to keep your proposition it should be amended as following:
@ModelFields({
@ModelField,
@ModelField(value=aBooleanVirtual, mapping="bigValue", persist=false,
convert="function(v,
record) { return (record.raw.bigValue >1000000);}")
})
private BigInteger bigValue;
what I would propose to keep it simple is to :
@model(...)
@JsonInclude(Include.NON_NULL)
public class BeanWithAnnotations {
private BigInteger bigValue;
@ModelField(mapping="bigValue", persist=false, convert="function(v,
record) { return (record.raw.bigValue > 1000000);}")
private boolean aBooleanVirtual = null;
}
Inconvenience with my system is the developer responsibility to add this
include.
But it keeps things flexible for unexpected use.
or why not provide a singular implementation expanding your idea.
@ModelFields({
@ModelField,
@virtualfield(value=aBooleanVirtual, mapping="bigValue", persist=false,
convert="function(v,
record) { return (record.raw.bigValue >1000000);}")
})
private BigInteger bigValue;
Order is very important, this virtual field HAS to be created after the
mapped field (in our case bigValue)
in that case it could be also
@ModelFields({
@ModelField("bigValueCustomName"),
@virtualfield(value=aBooleanVirtual, convert="function(v,
record) { return (record.raw.bigValueCustomName >1000000);}")
})
private BigInteger bigValue;
will produce:
... , {
name : 'bigValueCustomName',
type : 'int'
}, {
name : 'aBooleanVirtual',
type : 'boolean',
mapping : 'bigValueCustomName',
persist : false,
convert : function(v, record) { return
(record.raw.bigValueCustomName > 1000000);}
},...
What do you think?
On 11/24/2012 12:39 PM, Ralph Schaer wrote:
I'm wondering if we can improve this a bit more. If I'm understand this
correctly then
private boolean aBooleanVirtual;
is an useless instance variable.Maybe we can put two @ModelField annotation on one field. Something like
this:@ModelFields({
@ModelField,
@ModelField(mapping="bigValue", persist=false, convert="function(v,
record) { return (record.raw.bigValue >
1000000);}")
})
private BigInteger bigValue;On Sat, Nov 24, 2012 at 5:28 AM, Ralph Schaer [email protected]
wrote:Don't have a problem with this test. It's only missing the two new
fields.
I don't have a ' at the end.On Sat, Nov 24, 2012 at 5:17 AM, dilbertside
[email protected]:ah that's the reason I saw those regexes, get it now.
certainly, will do and avoid overhead: end result faster.
I still have pending problem with the test
a single quote is added to the string to compare
});'in
compareExtJs4Model(ModelGenerator.generateJavascript(BeanWithAnnotations.class,
OutputFormat.EXTJS4, true),
true);
in testGenerateJavascriptClassOfQOutputFormatBooleanI don't understand why as I stick to your model as close as possible
On 11/24/2012 12:11 PM, Ralph Schaer wrote:
This @JsonRawValue is interesting. Maybe this could also solve my
problem
with directFn,read,... methods. Right now I remove the quotes with a
call
to string.replaceAll call.On Sat, Nov 24, 2012 at 5:03 AM, dilbertside
[email protected]:@JsonRawValue
—
Reply to this email directly or view it on GitHub
<https://github.com/ralscha/extdirectspring/issues/50#issuecomment-10673725>.
—
Reply to this email directly or view it on
GitHubhttps://github.com//issues/50#issuecomment-10673767.—
Reply to this email directly or view it on GitHub
#50 (comment).
from extdirectspring.
You are right. Let's keep it simple and go with your initial approach with
the two instance variables.
@JsonInclude(Include.NON_NULL) solves the serialization issue quite nicely.
Let me know when your code is ready then I will integrate it into the
current codebase.
Ralph
On Sat, Nov 24, 2012 at 11:10 AM, dilbertside [email protected]:
Well, agree, Java speaking it is useless.
But in terms of extjs model we still need it, the generator need to
build this variable and its name.
So it will be used by Extjs library.
Without name this virtual field is useless on extjs side.If you are concerned about having this variable being jsonified at
runtime, it is better to include @JsonInclude(Include.NON_NULL)
So this variable won't be instantiated at runtime by being set at null
permanently.If you want to keep your proposition it should be amended as following:
@ModelFields({
@ModelField,
@ModelField(value=aBooleanVirtual, mapping="bigValue", persist=false,
convert="function(v,
record) { return (record.raw.bigValue >1000000);}")
})
private BigInteger bigValue;what I would propose to keep it simple is to :
@model(...)
@JsonInclude(Include.NON_NULL)
public class BeanWithAnnotations {
private BigInteger bigValue;@ModelField(mapping="bigValue", persist=false, convert="function(v,
record) { return (record.raw.bigValue > 1000000);}")
private boolean aBooleanVirtual = null;
}Inconvenience with my system is the developer responsibility to add this
include.
But it keeps things flexible for unexpected use.
or why not provide a singular implementation expanding your idea.
@ModelFields({
@ModelField,
@virtualfield(value=aBooleanVirtual, mapping="bigValue", persist=false,
convert="function(v,
record) { return (record.raw.bigValue >1000000);}")
})
private BigInteger bigValue;Order is very important, this virtual field HAS to be created after the
mapped field (in our case bigValue)
in that case it could be also@ModelFields({
@ModelField("bigValueCustomName"),
@virtualfield(value=aBooleanVirtual, convert="function(v,
record) { return (record.raw.bigValueCustomName >1000000);}")
})
private BigInteger bigValue;will produce:
... , {
name : 'bigValueCustomName',
type : 'int'
}, {
name : 'aBooleanVirtual',
type : 'boolean',
mapping : 'bigValueCustomName',
persist : false,
convert : function(v, record) { return
(record.raw.bigValueCustomName > 1000000);}
},...What do you think?
On 11/24/2012 12:39 PM, Ralph Schaer wrote:
I'm wondering if we can improve this a bit more. If I'm understand this
correctly then
private boolean aBooleanVirtual;
is an useless instance variable.Maybe we can put two @ModelField annotation on one field. Something like
this:@ModelFields({
@ModelField,
@ModelField(mapping="bigValue", persist=false, convert="function(v,
record) { return (record.raw.bigValue >
1000000);}")
})
private BigInteger bigValue;On Sat, Nov 24, 2012 at 5:28 AM, Ralph Schaer [email protected]
wrote:Don't have a problem with this test. It's only missing the two new
fields.
I don't have a ' at the end.On Sat, Nov 24, 2012 at 5:17 AM, dilbertside
[email protected]:ah that's the reason I saw those regexes, get it now.
certainly, will do and avoid overhead: end result faster.
I still have pending problem with the test
a single quote is added to the string to compare
});'in
compareExtJs4Model(ModelGenerator.generateJavascript(BeanWithAnnotations.class,
OutputFormat.EXTJS4, true),
true);
in testGenerateJavascriptClassOfQOutputFormatBooleanI don't understand why as I stick to your model as close as possible
On 11/24/2012 12:11 PM, Ralph Schaer wrote:
This @JsonRawValue is interesting. Maybe this could also solve my
problem
with directFn,read,... methods. Right now I remove the quotes with a
call
to string.replaceAll call.On Sat, Nov 24, 2012 at 5:03 AM, dilbertside
[email protected]:@JsonRawValue
—
Reply to this email directly or view it on GitHub
<—
Reply to this email directly or view it on
GitHub<
#50 (comment)
.—
Reply to this email directly or view it on GitHub
<
https://github.com/ralscha/extdirectspring/issues/50#issuecomment-10673909>.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/50#issuecomment-10676058.
from extdirectspring.
code is ready on my side with latest push, very simple to implement, but
got problems to run unittests, always fail in my env.
Either Eclipse or CLI fail.
It is annoying as I fail to see what's wrong. I got nothing different
than my fork.
Fortunately, code is valid for Touch with no change.
On 11/24/2012 06:53 PM, Ralph Schaer wrote:
You are right. Let's keep it simple and go with your initial approach
with
the two instance variables.
@JsonInclude(Include.NON_NULL) solves the serialization issue quite
nicely.Let me know when your code is ready then I will integrate it into the
current codebase.
RalphOn Sat, Nov 24, 2012 at 11:10 AM, dilbertside
[email protected]:Well, agree, Java speaking it is useless.
But in terms of extjs model we still need it, the generator need to
build this variable and its name.
So it will be used by Extjs library.
Without name this virtual field is useless on extjs side.If you are concerned about having this variable being jsonified at
runtime, it is better to include @JsonInclude(Include.NON_NULL)
So this variable won't be instantiated at runtime by being set at null
permanently.If you want to keep your proposition it should be amended as following:
@ModelFields({
@ModelField,
@ModelField(value=aBooleanVirtual, mapping="bigValue", persist=false,
convert="function(v,
record) { return (record.raw.bigValue >1000000);}")
})
private BigInteger bigValue;what I would propose to keep it simple is to :
@model(...)
@JsonInclude(Include.NON_NULL)
public class BeanWithAnnotations {
private BigInteger bigValue;@ModelField(mapping="bigValue", persist=false, convert="function(v,
record) { return (record.raw.bigValue > 1000000);}")
private boolean aBooleanVirtual = null;
}Inconvenience with my system is the developer responsibility to add
this
include.
But it keeps things flexible for unexpected use.
or why not provide a singular implementation expanding your idea.
@ModelFields({
@ModelField,
@virtualfield(value=aBooleanVirtual, mapping="bigValue", persist=false,
convert="function(v,
record) { return (record.raw.bigValue >1000000);}")
})
private BigInteger bigValue;Order is very important, this virtual field HAS to be created after the
mapped field (in our case bigValue)
in that case it could be also@ModelFields({
@ModelField("bigValueCustomName"),
@virtualfield(value=aBooleanVirtual, convert="function(v,
record) { return (record.raw.bigValueCustomName >1000000);}")
})
private BigInteger bigValue;will produce:
... , {
name : 'bigValueCustomName',
type : 'int'
}, {
name : 'aBooleanVirtual',
type : 'boolean',
mapping : 'bigValueCustomName',
persist : false,
convert : function(v, record) { return
(record.raw.bigValueCustomName > 1000000);}
},...What do you think?
On 11/24/2012 12:39 PM, Ralph Schaer wrote:
I'm wondering if we can improve this a bit more. If I'm understand
this
correctly then
private boolean aBooleanVirtual;
is an useless instance variable.Maybe we can put two @ModelField annotation on one field.
Something like
this:@ModelFields({
@ModelField,
@ModelField(mapping="bigValue", persist=false, convert="function(v,
record) { return (record.raw.bigValue >
1000000);}")
})
private BigInteger bigValue;On Sat, Nov 24, 2012 at 5:28 AM, Ralph Schaer [email protected]
wrote:Don't have a problem with this test. It's only missing the two new
fields.
I don't have a ' at the end.On Sat, Nov 24, 2012 at 5:17 AM, dilbertside
[email protected]:ah that's the reason I saw those regexes, get it now.
certainly, will do and avoid overhead: end result faster.
I still have pending problem with the test
a single quote is added to the string to compare
});'in
compareExtJs4Model(ModelGenerator.generateJavascript(BeanWithAnnotations.class,
OutputFormat.EXTJS4, true),
true);
in testGenerateJavascriptClassOfQOutputFormatBooleanI don't understand why as I stick to your model as close as
possibleOn 11/24/2012 12:11 PM, Ralph Schaer wrote:
This @JsonRawValue is interesting. Maybe this could also
solve my
problem
with directFn,read,... methods. Right now I remove the quotes
with a
call
to string.replaceAll call.On Sat, Nov 24, 2012 at 5:03 AM, dilbertside
[email protected]:@JsonRawValue
—
Reply to this email directly or view it on GitHub
<.
—
Reply to this email directly or view it on
GitHub<.
—
Reply to this email directly or view it on GitHub
<https://github.com/ralscha/extdirectspring/issues/50#issuecomment-10673909>.
—
Reply to this email directly or view it on
GitHubhttps://github.com//issues/50#issuecomment-10676058.—
Reply to this email directly or view it on GitHub
#50 (comment).
from extdirectspring.
I saw you solved the regex api replace on branch next.
If you could push a snapshot, I'll be able to test this enhancement and
changes in a real case scenario.
Thank you.
On 11/24/2012 06:53 PM, Ralph Schaer wrote:
You are right. Let's keep it simple and go with your initial approach
with
the two instance variables.
@JsonInclude(Include.NON_NULL) solves the serialization issue quite
nicely.Let me know when your code is ready then I will integrate it into the
current codebase.
RalphOn Sat, Nov 24, 2012 at 11:10 AM, dilbertside
[email protected]:Well, agree, Java speaking it is useless.
But in terms of extjs model we still need it, the generator need to
build this variable and its name.
So it will be used by Extjs library.
Without name this virtual field is useless on extjs side.If you are concerned about having this variable being jsonified at
runtime, it is better to include @JsonInclude(Include.NON_NULL)
So this variable won't be instantiated at runtime by being set at null
permanently.If you want to keep your proposition it should be amended as following:
@ModelFields({
@ModelField,
@ModelField(value=aBooleanVirtual, mapping="bigValue", persist=false,
convert="function(v,
record) { return (record.raw.bigValue >1000000);}")
})
private BigInteger bigValue;what I would propose to keep it simple is to :
@model(...)
@JsonInclude(Include.NON_NULL)
public class BeanWithAnnotations {
private BigInteger bigValue;@ModelField(mapping="bigValue", persist=false, convert="function(v,
record) { return (record.raw.bigValue > 1000000);}")
private boolean aBooleanVirtual = null;
}Inconvenience with my system is the developer responsibility to add
this
include.
But it keeps things flexible for unexpected use.
or why not provide a singular implementation expanding your idea.
@ModelFields({
@ModelField,
@virtualfield(value=aBooleanVirtual, mapping="bigValue", persist=false,
convert="function(v,
record) { return (record.raw.bigValue >1000000);}")
})
private BigInteger bigValue;Order is very important, this virtual field HAS to be created after the
mapped field (in our case bigValue)
in that case it could be also@ModelFields({
@ModelField("bigValueCustomName"),
@virtualfield(value=aBooleanVirtual, convert="function(v,
record) { return (record.raw.bigValueCustomName >1000000);}")
})
private BigInteger bigValue;will produce:
... , {
name : 'bigValueCustomName',
type : 'int'
}, {
name : 'aBooleanVirtual',
type : 'boolean',
mapping : 'bigValueCustomName',
persist : false,
convert : function(v, record) { return
(record.raw.bigValueCustomName > 1000000);}
},...What do you think?
On 11/24/2012 12:39 PM, Ralph Schaer wrote:
I'm wondering if we can improve this a bit more. If I'm understand
this
correctly then
private boolean aBooleanVirtual;
is an useless instance variable.Maybe we can put two @ModelField annotation on one field.
Something like
this:@ModelFields({
@ModelField,
@ModelField(mapping="bigValue", persist=false, convert="function(v,
record) { return (record.raw.bigValue >
1000000);}")
})
private BigInteger bigValue;On Sat, Nov 24, 2012 at 5:28 AM, Ralph Schaer [email protected]
wrote:Don't have a problem with this test. It's only missing the two new
fields.
I don't have a ' at the end.On Sat, Nov 24, 2012 at 5:17 AM, dilbertside
[email protected]:ah that's the reason I saw those regexes, get it now.
certainly, will do and avoid overhead: end result faster.
I still have pending problem with the test
a single quote is added to the string to compare
});'in
compareExtJs4Model(ModelGenerator.generateJavascript(BeanWithAnnotations.class,
OutputFormat.EXTJS4, true),
true);
in testGenerateJavascriptClassOfQOutputFormatBooleanI don't understand why as I stick to your model as close as
possibleOn 11/24/2012 12:11 PM, Ralph Schaer wrote:
This @JsonRawValue is interesting. Maybe this could also
solve my
problem
with directFn,read,... methods. Right now I remove the quotes
with a
call
to string.replaceAll call.On Sat, Nov 24, 2012 at 5:03 AM, dilbertside
[email protected]:@JsonRawValue
—
Reply to this email directly or view it on GitHub
<.
—
Reply to this email directly or view it on
GitHub<.
—
Reply to this email directly or view it on GitHub
<https://github.com/ralscha/extdirectspring/issues/50#issuecomment-10673909>.
—
Reply to this email directly or view it on
GitHubhttps://github.com//issues/50#issuecomment-10676058.—
Reply to this email directly or view it on GitHub
#50 (comment).
from extdirectspring.
Everything is integrated. Unittests are fixed. One of the files contained
an empty line at the end.
There is a 1.2.3-SNAPSHOT that contains everything:
https://oss.sonatype.org/content/repositories/snapshots/ch/ralscha/extdirectspring/1.2.3-SNAPSHOT/extdirectspring-1.2.3-20121124.142141-14.jar
Ralph
On Sat, Nov 24, 2012 at 12:44 PM, dilbertside [email protected]:
I saw you solved the regex api replace on branch next.
If you could push a snapshot, I'll be able to test this enhancement and
changes in a real case scenario.Thank you.
On 11/24/2012 06:53 PM, Ralph Schaer wrote:
You are right. Let's keep it simple and go with your initial approach
with
the two instance variables.
@JsonInclude(Include.NON_NULL) solves the serialization issue quite
nicely.Let me know when your code is ready then I will integrate it into the
current codebase.
RalphOn Sat, Nov 24, 2012 at 11:10 AM, dilbertside
[email protected]:Well, agree, Java speaking it is useless.
But in terms of extjs model we still need it, the generator need to
build this variable and its name.
So it will be used by Extjs library.
Without name this virtual field is useless on extjs side.If you are concerned about having this variable being jsonified at
runtime, it is better to include @JsonInclude(Include.NON_NULL)
So this variable won't be instantiated at runtime by being set at null
permanently.If you want to keep your proposition it should be amended as following:
@ModelFields({
@ModelField,
@ModelField(value=aBooleanVirtual, mapping="bigValue", persist=false,
convert="function(v,
record) { return (record.raw.bigValue >1000000);}")
})
private BigInteger bigValue;what I would propose to keep it simple is to :
@model(...)
@JsonInclude(Include.NON_NULL)
public class BeanWithAnnotations {
private BigInteger bigValue;@ModelField(mapping="bigValue", persist=false, convert="function(v,
record) { return (record.raw.bigValue > 1000000);}")
private boolean aBooleanVirtual = null;
}Inconvenience with my system is the developer responsibility to add
this
include.
But it keeps things flexible for unexpected use.
or why not provide a singular implementation expanding your idea.
@ModelFields({
@ModelField,
@virtualfield(value=aBooleanVirtual, mapping="bigValue", persist=false,
convert="function(v,
record) { return (record.raw.bigValue >1000000);}")
})
private BigInteger bigValue;Order is very important, this virtual field HAS to be created after the
mapped field (in our case bigValue)
in that case it could be also@ModelFields({
@ModelField("bigValueCustomName"),
@virtualfield(value=aBooleanVirtual, convert="function(v,
record) { return (record.raw.bigValueCustomName >1000000);}")
})
private BigInteger bigValue;will produce:
... , {
name : 'bigValueCustomName',
type : 'int'
}, {
name : 'aBooleanVirtual',
type : 'boolean',
mapping : 'bigValueCustomName',
persist : false,
convert : function(v, record) { return
(record.raw.bigValueCustomName > 1000000);}
},...What do you think?
On 11/24/2012 12:39 PM, Ralph Schaer wrote:
I'm wondering if we can improve this a bit more. If I'm understand
this
correctly then
private boolean aBooleanVirtual;
is an useless instance variable.Maybe we can put two @ModelField annotation on one field.
Something like
this:@ModelFields({
@ModelField,
@ModelField(mapping="bigValue", persist=false, convert="function(v,
record) { return (record.raw.bigValue >
1000000);}")
})
private BigInteger bigValue;On Sat, Nov 24, 2012 at 5:28 AM, Ralph Schaer <[email protected]
wrote:
Don't have a problem with this test. It's only missing the two new
fields.
I don't have a ' at the end.On Sat, Nov 24, 2012 at 5:17 AM, dilbertside
[email protected]:ah that's the reason I saw those regexes, get it now.
certainly, will do and avoid overhead: end result faster.
I still have pending problem with the test
a single quote is added to the string to compare
});'in
compareExtJs4Model(ModelGenerator.generateJavascript(BeanWithAnnotations.class,
OutputFormat.EXTJS4, true),
true);
in testGenerateJavascriptClassOfQOutputFormatBooleanI don't understand why as I stick to your model as close as
possibleOn 11/24/2012 12:11 PM, Ralph Schaer wrote:
This @JsonRawValue is interesting. Maybe this could also
solve my
problem
with directFn,read,... methods. Right now I remove the quotes
with a
call
to string.replaceAll call.On Sat, Nov 24, 2012 at 5:03 AM, dilbertside
[email protected]:@JsonRawValue
—
Reply to this email directly or view it on GitHub
<.
—
Reply to this email directly or view it on
GitHub<.
—
Reply to this email directly or view it on GitHub
<—
Reply to this email directly or view it on
GitHub<
#50 (comment)
.—
Reply to this email directly or view it on GitHub
<
https://github.com/ralscha/extdirectspring/issues/50#issuecomment-10676397>.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/50#issuecomment-10676841.
from extdirectspring.
It works wonderfully.
I tried this virtual field, and generation works seamlessly.
Thank you very much for your great reactivity.
On 11/24/2012 10:25 PM, Ralph Schaer wrote:
Everything is integrated. Unittests are fixed. One of the files contained
an empty line at the end.There is a 1.2.3-SNAPSHOT that contains everything:
https://oss.sonatype.org/content/repositories/snapshots/ch/ralscha/extdirectspring/1.2.3-SNAPSHOT/extdirectspring-1.2.3-20121124.142141-14.jarRalph
On Sat, Nov 24, 2012 at 12:44 PM, dilbertside
[email protected]:I saw you solved the regex api replace on branch next.
If you could push a snapshot, I'll be able to test this enhancement and
changes in a real case scenario.Thank you.
On 11/24/2012 06:53 PM, Ralph Schaer wrote:
You are right. Let's keep it simple and go with your initial approach
with
the two instance variables.
@JsonInclude(Include.NON_NULL) solves the serialization issue quite
nicely.Let me know when your code is ready then I will integrate it into the
current codebase.
RalphOn Sat, Nov 24, 2012 at 11:10 AM, dilbertside
[email protected]:Well, agree, Java speaking it is useless.
But in terms of extjs model we still need it, the generator need to
build this variable and its name.
So it will be used by Extjs library.
Without name this virtual field is useless on extjs side.If you are concerned about having this variable being jsonified at
runtime, it is better to include @JsonInclude(Include.NON_NULL)
So this variable won't be instantiated at runtime by being set
at null
permanently.If you want to keep your proposition it should be amended as
following:@ModelFields({
@ModelField,
@ModelField(value=aBooleanVirtual, mapping="bigValue",
persist=false,
convert="function(v,
record) { return (record.raw.bigValue >1000000);}")
})
private BigInteger bigValue;what I would propose to keep it simple is to :
@model(...)
@JsonInclude(Include.NON_NULL)
public class BeanWithAnnotations {
private BigInteger bigValue;@ModelField(mapping="bigValue", persist=false, convert="function(v,
record) { return (record.raw.bigValue > 1000000);}")
private boolean aBooleanVirtual = null;
}Inconvenience with my system is the developer responsibility to add
this
include.
But it keeps things flexible for unexpected use.
or why not provide a singular implementation expanding your idea.
@ModelFields({
@ModelField,
@virtualfield(value=aBooleanVirtual, mapping="bigValue",
persist=false,
convert="function(v,
record) { return (record.raw.bigValue >1000000);}")
})
private BigInteger bigValue;Order is very important, this virtual field HAS to be created
after the
mapped field (in our case bigValue)
in that case it could be also@ModelFields({
@ModelField("bigValueCustomName"),
@virtualfield(value=aBooleanVirtual, convert="function(v,
record) { return (record.raw.bigValueCustomName >1000000);}")
})
private BigInteger bigValue;will produce:
... , {
name : 'bigValueCustomName',
type : 'int'
}, {
name : 'aBooleanVirtual',
type : 'boolean',
mapping : 'bigValueCustomName',
persist : false,
convert : function(v, record) { return
(record.raw.bigValueCustomName > 1000000);}
},...What do you think?
On 11/24/2012 12:39 PM, Ralph Schaer wrote:
I'm wondering if we can improve this a bit more. If I'm
understand
this
correctly then
private boolean aBooleanVirtual;
is an useless instance variable.Maybe we can put two @ModelField annotation on one field.
Something like
this:@ModelFields({
@ModelField,
@ModelField(mapping="bigValue", persist=false,
convert="function(v,
record) { return (record.raw.bigValue >
1000000);}")
})
private BigInteger bigValue;On Sat, Nov 24, 2012 at 5:28 AM, Ralph Schaer
<[email protected]wrote:
Don't have a problem with this test. It's only missing the
two new
fields.
I don't have a ' at the end.On Sat, Nov 24, 2012 at 5:17 AM, dilbertside
[email protected]:ah that's the reason I saw those regexes, get it now.
certainly, will do and avoid overhead: end result faster.
I still have pending problem with the test
a single quote is added to the string to compare
});'in
compareExtJs4Model(ModelGenerator.generateJavascript(BeanWithAnnotations.class,
OutputFormat.EXTJS4, true),
true);
in testGenerateJavascriptClassOfQOutputFormatBooleanI don't understand why as I stick to your model as close as
possibleOn 11/24/2012 12:11 PM, Ralph Schaer wrote:
This @JsonRawValue is interesting. Maybe this could also
solve my
problem
with directFn,read,... methods. Right now I remove the
quotes
with a
call
to string.replaceAll call.On Sat, Nov 24, 2012 at 5:03 AM, dilbertside
[email protected]:@JsonRawValue
—
Reply to this email directly or view it on GitHub
<.
—
Reply to this email directly or view it on
GitHub<.
—
Reply to this email directly or view it on GitHub
<.
—
Reply to this email directly or view it on
GitHub<.
—
Reply to this email directly or view it on GitHub
<https://github.com/ralscha/extdirectspring/issues/50#issuecomment-10676397>.
—
Reply to this email directly or view it on
GitHubhttps://github.com//issues/50#issuecomment-10676841.—
Reply to this email directly or view it on GitHub
#50 (comment).
from extdirectspring.
Made a small changes that allows the use of @JsonIgnore on the virtual field.
private BigInteger bigValue;
@ModelField(mapping="bigValue", persist=false, convert="function(v,
record) { return (record.raw.bigValue > 1000000);}")
@JsonIgnore
private boolean aBooleanVirtual = null;
from extdirectspring.
Subtle change and it works.
I removed the @JsonInclude(Include.NON_NULL)
and add @JsonIgnore, the virtual Field has been generated.
with visibility private or public.
I tend to remove this boilerplate code of getter and setters by abusing
@JsonProperty when building json bean
So we have 2 solutions to generate that virtual field.
Documentation should be amended: as it is stated:
https://github.com/ralscha/extdirectspring/wiki/ModelGenerator excerpt
"The generator tries to read all public accessible properties. If a
field should not be part of the generated code annotate it with
@JsonIgnore
http://fasterxml.github.com/jackson-annotations/javadoc/2.0.2/com/fasterxml/jackson/annotation/JsonIgnore.html.
"
in fact that one will be generated despite @JsonIgnore
http://fasterxml.github.com/jackson-annotations/javadoc/2.0.2/com/fasterxml/jackson/annotation/JsonIgnore.html.
On 11/25/2012 05:45 PM, Ralph Schaer wrote:
Made a small changes that allows the use of @JsonIgnore on the virtual
field.| private BigInteger bigValue;
@ModelField(mapping="bigValue", persist=false, convert="function(v,
|record) { return (record.raw.bigValue > 1000000);}")
@JsonIgnore
private boolean aBooleanVirtual = null;—
Reply to this email directly or view it on GitHub
#50 (comment).
from extdirectspring.
I updated the doc. It's still true that @JsonIgnore prevents the field
from being written into the model code. But if @ModelField or
@ModelAssociation is present on the field too @JsonIgnore is ignored (only
for model generation, Jackson still ignores the field during serialization
and deserialization).
On Sun, Nov 25, 2012 at 3:46 PM, dilbertside [email protected]:
Subtle change and it works.
I removed the @JsonInclude(Include.NON_NULL)
and add @JsonIgnore, the virtual Field has been generated.
with visibility private or public.
I tend to remove this boilerplate code of getter and setters by abusing
@JsonProperty when building json beanSo we have 2 solutions to generate that virtual field.
Documentation should be amended: as it is stated:
https://github.com/ralscha/extdirectspring/wiki/ModelGenerator excerpt
"The generator tries to read all public accessible properties. If a
field should not be part of the generated code annotate it with
@JsonIgnore
<
http://fasterxml.github.com/jackson-annotations/javadoc/2.0.2/com/fasterxml/jackson/annotation/JsonIgnore.html>."
in fact that one will be generated despite @JsonIgnore
<
http://fasterxml.github.com/jackson-annotations/javadoc/2.0.2/com/fasterxml/jackson/annotation/JsonIgnore.html.
On 11/25/2012 05:45 PM, Ralph Schaer wrote:
Made a small changes that allows the use of @JsonIgnore on the virtual
field.| private BigInteger bigValue;
@ModelField(mapping="bigValue", persist=false, convert="function(v,
|record) { return (record.raw.bigValue > 1000000);}")
@JsonIgnoreprivate boolean aBooleanVirtual = null;
—
Reply to this email directly or view it on GitHub
<
https://github.com/ralscha/extdirectspring/issues/50#issuecomment-10691822>.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/50#issuecomment-10694091.
from extdirectspring.
Ok, in clear you removed the previous constraint which would limit the
model generator to build a field if @JsonIgnore was present
Except one case, the generator puts back @JsonIgnore to what it should
be limited to: I mean Json serialization
It gives more flexibility to the developer to control his model
generation (design) and its Json serialization(runtime).
We can imagine a case where @JsonIgnore is useful: it is the case user
credential hash not to be serialized over the wire, model field and json
serialization value would be cancelled.
On 11/26/2012 02:53 PM, Ralph Schaer wrote:
I updated the doc. It's still true that @JsonIgnore prevents the field
from being written into the model code. But if @ModelField or
@ModelAssociation is present on the field too @JsonIgnore is ignored
(only
for model generation, Jackson still ignores the field during
serialization
and deserialization).On Sun, Nov 25, 2012 at 3:46 PM, dilbertside
[email protected]:Subtle change and it works.
I removed the @JsonInclude(Include.NON_NULL)
and add @JsonIgnore, the virtual Field has been generated.
with visibility private or public.
I tend to remove this boilerplate code of getter and setters by abusing
@JsonProperty when building json beanSo we have 2 solutions to generate that virtual field.
Documentation should be amended: as it is stated:
https://github.com/ralscha/extdirectspring/wiki/ModelGenerator excerpt
"The generator tries to read all public accessible properties. If a
field should not be part of the generated code annotate it with
@JsonIgnore
<"
in fact that one will be generated despite @JsonIgnore
<.
On 11/25/2012 05:45 PM, Ralph Schaer wrote:
Made a small changes that allows the use of @JsonIgnore on the
virtual
field.| private BigInteger bigValue;
@ModelField(mapping="bigValue", persist=false, convert="function(v,
|record) { return (record.raw.bigValue > 1000000);}")
@JsonIgnoreprivate boolean aBooleanVirtual = null;
Reply to this email directly or view it on GitHub
<https://github.com/ralscha/extdirectspring/issues/50#issuecomment-10691822>.
Reply to this email directly or view it on
GitHubhttps://github.com//issues/50#issuecomment-10694091.
Reply to this email directly or view it on GitHub
#50 (comment).
from extdirectspring.
Version 1.2.3 released
from extdirectspring.
Related Issues (20)
- Move getComparison() method to the base Filter class
- Support null values in BooleanFilter
- Struggling to work out what dependencies extdirectspring has HOT 2
- AuthenticationPrincipal moves into another package with Spring Security 4
- Inecting CDI Beans HOT 4
- Changing Jackson object mapper naming strategy impacts API json HOT 2
- Store filter syntax HOT 8
- @ExtDirectMethod(value = STORE_READ, jsonView=) is ignored HOT 4
- Default value for Ext Direct Remoting API variable name changes in Ext JS 6.0.1
- Static methods for ExtDirectStoreResult, ExtDirectFormLoadResult, ExtDirectFormPostResult, ExtDirectRawJsonStoreResult HOT 2
- Model Generator APT source? HOT 1
- Problem with grid grouping HOT 2
- org.springframework.web.bind.annotation.RequestParam.name HOT 1
- Test fail HOT 4
- Model CURD method metadata support HOT 2
- It's really nice to have methods as ExtDirectFormPostResult.create HOT 1
- Need to have special customization for variable "requestUrlString" in ApiController.buildAndCacheApiString
- Spring 5? HOT 2
- Router accepts text/plain requests which makes it CSRF vulnerable HOT 6
- Dependency org.springframework:spring-web, leading to CVE problem HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from extdirectspring.