Comments (3)
For case 1, after scrutinize the EntityFindBase I find that:
- if in XMLAction we use entity-find-one without any field-map, then moqui will call
.condition(context)
, then create simpleAndMap with only 1 key. Due to the viewentity PersonAndUserAccount has more than 1 PKs, the oneInternal method will return null. - if we use entity-find-one with a field-map. i.e 'partyId', then moqui will call
.condition(field, value)
, then create a pair of singleCondField/singleCondValue. Later on, the oneInternal method will form a whereCondition with this field/value and return result as expected.
I've tried to change the method EntityFind condition(Map<String, Object> fields)
to force using singleCondField/singleCondValue
instead of simpleAndMap
if it has only 1 field:
if (fieldsSize == 1 && noSam && noScf) {
// just set the singleCondField
Map.Entry<String, Object> onlyEntry = fields.entrySet().iterator().next()
singleCondField = (String) onlyEntry.key
singleCondValue = onlyEntry.value
} else {
if (noSam) simpleAndMap = new LinkedHashMap<String, Object>()
if (!noScf) {
simpleAndMap.put(singleCondField, singleCondValue)
singleCondField = (String) null
singleCondValue = null
}
getEntityDef().setFields(fields, simpleAndMap, true, null, null)
// My Code: use singleCond to avoid checking PKs in .oneInternal()
if (simpleAndMap?.size() == 1 && noScf) {
// just set the singleCondField
Map.Entry<String, Object> onlyEntry = simpleAndMap.entrySet().iterator().next()
singleCondField = (String) onlyEntry.key
singleCondValue = onlyEntry.value
simpleAndMap = null
}
}
This fixed the issue that use entity-find-one without any field-map. However, I don't know if this change will have any side-effect or not.
About the case 2, I can't reproduce the issue.
from moqui-framework.
Would you pull the latest code and try this again? I am unable to reproduce the error.
If I understand correctly this error should be seen by just going to:
http://localhost:8080/apps/hmadmin/User/EditUser?partyId=EX_JOHN_DOE
That screen and the populated form are rendering fine for me now with the single PK for the view-entity entity-find-one. Let me know if there is something different that needs to be done to reproduce this issue.
The EntityFindBase code, and lots of code related to it, has been reviewed and updated quite a bit (mostly for performance/efficiency), and while it is somewhat complex and messy to run faster it should all be working now.
from moqui-framework.
This issue not happen with newest code. It has been fixed in commit 2e6eaff.
In this commit, system don't change simpleAndMap
in case its size = 1
from moqui-framework.
Related Issues (20)
- Need to support custom SQL HOT 1
- Connection pool issues HOT 3
- docker - moqui server not running https://moqui.local HOT 2
- CVE-2023-26049 (Medium) detected in jetty-http-10.0.13.jar HOT 1
- CVE-2023-26048 (Medium) detected in jetty-server-10.0.13.jar HOT 1
- CVE-2023-24998 (High) detected in commons-fileupload-1.4.jar HOT 1
- When entity find has pk and other conditions, only pk takes effect
- WS-2023-0236 (Low) detected in jetty-xml-10.0.13.jar, jetty-xml-10.0.15.jar - autoclosed HOT 2
- CVE-2023-34478 (Critical) detected in shiro-core-1.11.0.jar HOT 1
- Xss risk HOT 3
- Issues when using sendJsonResponse in service for rest call HOT 4
- If the parameter type of service is BigDecimal, it will be unconditionally cast. HOT 1
- After clicking "Clear Parameters" to query the order, the query results are incorrect
- After the order is unapproved, an error is reported when importing inventory HOT 1
- Catalog/Search: ordering is broken HOT 1
- Any plans to upgrade to Java 17 or Java 21? HOT 2
- 100% CPU for pressure testing database HOT 4
- Client Side Template Injection Vulnerability HOT 5
- Is jetty mode startup of Moqui not supporting HTTPS? HOT 2
- CVE-2023-46750 (Medium) detected in shiro-web-1.12.0.jar HOT 1
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 moqui-framework.