Re: svn commit: r1597243 - in /ofbiz/branches/release13.07: ./ framework/entity/src/org/ofbiz/entity/model/ModelEntity.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1597243 - in /ofbiz/branches/release13.07: ./ framework/entity/src/org/ofbiz/entity/model/ModelEntity.java

Adrian Crum-3
This is not a bug fix, it is a new feature.

Adrian Crum
Sandglass Software
www.sandglass-software.com

On 5/23/2014 10:50 PM, [hidden email] wrote:

> Author: jleroux
> Date: Sat May 24 05:50:07 2014
> New Revision: 1597243
>
> URL: http://svn.apache.org/r1597243
> Log:
> "Applied fix from trunk for revision: 1597239  "
> ------------------------------------------------------------------------
> r1597239 | jleroux | 2014-05-24 07:09:39 +0200 (sam. 24 mai 2014) | 1 ligne
>
> Closes OFBIZ-5648 - Extend primary keys
> ------------------------------------------------------------------------
> 
>
> Modified:
>      ofbiz/branches/release13.07/   (props changed)
>      ofbiz/branches/release13.07/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java
>
> Propchange: ofbiz/branches/release13.07/
> ------------------------------------------------------------------------------
>    Merged /ofbiz/trunk:r1597239
>
> Modified: ofbiz/branches/release13.07/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java
> URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java?rev=1597243&r1=1597242&r2=1597243&view=diff
> ==============================================================================
> --- ofbiz/branches/release13.07/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java (original)
> +++ ofbiz/branches/release13.07/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java Sat May 24 05:50:07 2014
> @@ -47,8 +47,8 @@ import org.ofbiz.entity.Delegator;
>   import org.ofbiz.entity.GenericEntity;
>   import org.ofbiz.entity.GenericEntityException;
>   import org.ofbiz.entity.GenericValue;
> -import org.ofbiz.entity.config.model.Datasource;
>   import org.ofbiz.entity.config.EntityConfigUtil;
> +import org.ofbiz.entity.config.model.Datasource;
>   import org.ofbiz.entity.jdbc.DatabaseUtil;
>   import org.ofbiz.entity.model.ModelIndex.Field;
>   import org.w3c.dom.Document;
> @@ -366,11 +366,15 @@ public class ModelEntity implements Comp
>                   this.fieldsList.add(newField);
>                   this.fieldsMap.put(newField.getName(), newField);
>                   if (!newField.getIsPk()) {
> -                    // this will always be true for now as extend-entity fields are always nonpks
>                       if (existingField != null) {
>                           this.nopks.remove(existingField);
>                       }
>                       this.nopks.add(newField);
> +                } else {
> +                    if (existingField != null) {
> +                        this.pks.remove(existingField);
> +                    }
> +                    this.pks.add(newField);
>                   }
>               }
>           }
>
>
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1597243 - in /ofbiz/branches/release13.07: ./ framework/entity/src/org/ofbiz/entity/model/ModelEntity.java

Jacques Le Roux
Administrator
It's a moot point. You might not know that this feature is not available, nothing prevents you to use it.
Then you extend a primary key, check in entity maintenance that the field has been extended. From the UI, all seems OK: field placed at bottom instead
of top, type changed (from ide-ne to ide-long-ne in my case), but actually NOT!
Then you have to digg into the code to find that "extend-entity fields are always nonpks". Why the heck is that you think? Then you try the code
bellow and YES it works

It looks like a bug to me! Feel free to revert if it please you...

BTW I have documented in entitymodel.xsd that "Only overrides of type, colName, description and enable-audit-log are currently supported"
Though I was not able to show the doc in Eclipse either in Oxygen XML editor nor using OOTB XML editor. Even after reloading the file, restarting
Eclipse, etc. Since doc/auto-completion works in Minilang I have no ideas and gave up. I guess at least when committed it will work

Jacques

Le 24/05/2014 08:29, Adrian Crum a écrit :

> This is not a bug fix, it is a new feature.
>
> Adrian Crum
> Sandglass Software
> www.sandglass-software.com
>
> On 5/23/2014 10:50 PM, [hidden email] wrote:
>> Author: jleroux
>> Date: Sat May 24 05:50:07 2014
>> New Revision: 1597243
>>
>> URL: http://svn.apache.org/r1597243
>> Log:
>> "Applied fix from trunk for revision: 1597239  "
>> ------------------------------------------------------------------------
>> r1597239 | jleroux | 2014-05-24 07:09:39 +0200 (sam. 24 mai 2014) | 1 ligne
>>
>> Closes OFBIZ-5648 - Extend primary keys
>> ------------------------------------------------------------------------
>> 
>>
>> Modified:
>>      ofbiz/branches/release13.07/   (props changed)
>> ofbiz/branches/release13.07/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java
>>
>> Propchange: ofbiz/branches/release13.07/
>> ------------------------------------------------------------------------------
>>    Merged /ofbiz/trunk:r1597239
>>
>> Modified: ofbiz/branches/release13.07/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java
>> URL:
>> http://svn.apache.org/viewvc/ofbiz/branches/release13.07/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java?rev=1597243&r1=1597242&r2=1597243&view=diff
>> ==============================================================================
>> --- ofbiz/branches/release13.07/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java (original)
>> +++ ofbiz/branches/release13.07/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java Sat May 24 05:50:07 2014
>> @@ -47,8 +47,8 @@ import org.ofbiz.entity.Delegator;
>>   import org.ofbiz.entity.GenericEntity;
>>   import org.ofbiz.entity.GenericEntityException;
>>   import org.ofbiz.entity.GenericValue;
>> -import org.ofbiz.entity.config.model.Datasource;
>>   import org.ofbiz.entity.config.EntityConfigUtil;
>> +import org.ofbiz.entity.config.model.Datasource;
>>   import org.ofbiz.entity.jdbc.DatabaseUtil;
>>   import org.ofbiz.entity.model.ModelIndex.Field;
>>   import org.w3c.dom.Document;
>> @@ -366,11 +366,15 @@ public class ModelEntity implements Comp
>>                   this.fieldsList.add(newField);
>>                   this.fieldsMap.put(newField.getName(), newField);
>>                   if (!newField.getIsPk()) {
>> -                    // this will always be true for now as extend-entity fields are always nonpks
>>                       if (existingField != null) {
>>                           this.nopks.remove(existingField);
>>                       }
>>                       this.nopks.add(newField);
>> +                } else {
>> +                    if (existingField != null) {
>> +                        this.pks.remove(existingField);
>> +                    }
>> +                    this.pks.add(newField);
>>                   }
>>               }
>>           }
>>
>>
>

--