Comments (16)
No. It is not possible.
You can allways inspect entity
property of changelog item and select a specific module and call its methods.
from platypus-js.
Understood. I also wanna say that we tried to implement validator last week but it throws an error. I will post stack trace at monday, when will be in office.
from platypus-js.
This is what happens after trying to save any change log in application which contains empty template validator (validate()
function just make a log entry, @validator
annotation without specified data source name). Tested with making some data changes and sending it back to the server. After that changes are not saved.
12-Sep-2016 09:27:57.068 SEVERE [platypus-worker-pool-1-thread-25] com.eas.client.DatabasesClient.lambda$commit$26 null
com.eas.script.NoPublisherException: JavaScript API integrity check failed. No publisher function.
at com.eas.client.changes.Update.getPublished(Update.java:53)
at com.eas.script.Scripts$Space.toJs(Scripts.java:493)
at com.eas.script.Scripts$Space.toJs(Scripts.java:502)
at com.eas.client.ScriptedDatabasesClient.lambda$validate$2(ScriptedDatabasesClient.java:179)
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374)
at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
at com.eas.client.ScriptedDatabasesClient.validate(ScriptedDatabasesClient.java:177)
at com.eas.client.ScriptedDatabasesClient.apply(ScriptedDatabasesClient.java:83)
at com.eas.client.DatabasesClient.lambda$commit$26(DatabasesClient.java:500)
at java.util.HashMap$EntrySpliterator.forEachRemaining(HashMap.java:1691)
at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
at com.eas.client.DatabasesClient.commit(DatabasesClient.java:498)
at com.eas.server.handlers.CommitRequestHandler.lambda$handle$1(CommitRequestHandler.java:139)
at com.eas.server.handlers.CommitRequestHandler$ChangesSortProcess.complete(CommitRequestHandler.java:117)
at com.eas.server.handlers.CommitRequestHandler.lambda$null$2(CommitRequestHandler.java:161)
at com.eas.client.queries.LocalQueriesProxy.lambda$getQuery$1(LocalQueriesProxy.java:90)
at com.eas.script.Scripts$Space.lambda$process$3(Scripts.java:667)
at com.eas.script.Scripts$Space.lambda$process$4(Scripts.java:703)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
from platypus-js.
Ensure please, that you have dependencies from update.js
, insert.js
, delete.js
, command.js
modules in your validator. May be we should fix validator module template.
Also, can you clarify if global API is used by your application?
from platypus-js.
Nope, AMD is used right now
from platypus-js.
And how about dependencies, mentioned earlier?
from platypus-js.
Dependecies have written down just about 1 minute ago. There was also added @stateless
annotation. And it works fine right now.
Looks like fixing validator template is the fastest way. Thanks.
from platypus-js.
How do you think, should we add auto dependencies injection in Platypus.js code to avoid "unused" dependencies?
from platypus-js.
@marat-gainullin it better to be.
But may be there is another way like checking with annotations in specific types of modules like validator.
E.g. we have core/update
, core/insert
etc. dependencies. Is it possible to force platypus inject they stealthy like user never know it's used. Like it happens with global API P.*. Is it possible?
from platypus-js.
Okay, there is another validator issue.
Here is stacktrace
15-Sep-2016 10:38:31.017 SEVERE [platypus-worker-pool-1-thread-15] com.eas.client.DatabasesClient.lambda$commit$26 null
com.eas.script.NoPublisherException: JavaScript API integrity check failed. No publisher function.
at com.eas.client.changes.ChangeValue.getPublished(ChangeValue.java:52)
at jdk.nashorn.internal.scripts.Script$Recompilation$78$1685A$boxing.L:3$boxAsJs(boxing:56)
at jdk.nashorn.internal.scripts.Script$Recompilation$78$1685A$boxing.L:3$boxAsJs(boxing:70)
at jdk.nashorn.internal.scripts.Script$Recompilation$77$888$update.L:3$Update$get(core/update:32)
at jdk.nashorn.internal.runtime.UserAccessorProperty.invokeObjectGetter(UserAccessorProperty.java:290)
at jdk.nashorn.internal.runtime.UserAccessorProperty.getObjectValue(UserAccessorProperty.java:196)
at jdk.nashorn.internal.runtime.FindProperty.getObjectValue(FindProperty.java:229)
at jdk.nashorn.internal.runtime.ScriptObject.get(ScriptObject.java:2860)
at jdk.nashorn.internal.runtime.ScriptObject.get(ScriptObject.java:2877)
at jdk.nashorn.internal.objects.NativeJSON.str(NativeJSON.java:214)
at jdk.nashorn.internal.objects.NativeJSON.JO(NativeJSON.java:290)
at jdk.nashorn.internal.objects.NativeJSON.str(NativeJSON.java:268)
at jdk.nashorn.internal.objects.NativeJSON.stringify(NativeJSON.java:196)
at jdk.nashorn.internal.scripts.Script$Recompilation$75$1237AAAA$GlobalServerValidator.L:8$module_constructor$validate(Сервер/Валидаторы/GlobalServerValidator:22)
at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:645)
at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:494)
at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:393)
at jdk.nashorn.api.scripting.ScriptObjectMirror.call(ScriptObjectMirror.java:117)
at com.eas.client.ScriptedDatabasesClient.lambda$validate$2(ScriptedDatabasesClient.java:179)
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374)
at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
at com.eas.client.ScriptedDatabasesClient.validate(ScriptedDatabasesClient.java:177)
at com.eas.client.ScriptedDatabasesClient.apply(ScriptedDatabasesClient.java:83)
at com.eas.client.DatabasesClient.lambda$commit$26(DatabasesClient.java:500)
at java.util.HashMap$EntrySpliterator.forEachRemaining(HashMap.java:1691)
at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
at com.eas.client.DatabasesClient.commit(DatabasesClient.java:498)
at com.eas.server.handlers.CommitRequestHandler.lambda$handle$1(CommitRequestHandler.java:139)
at com.eas.server.handlers.CommitRequestHandler$ChangesSortProcess.complete(CommitRequestHandler.java:117)
at com.eas.server.handlers.CommitRequestHandler.lambda$null$2(CommitRequestHandler.java:161)
at com.eas.client.queries.LocalQueriesProxy.lambda$getQuery$1(LocalQueriesProxy.java:90)
at com.eas.script.Scripts$Space.lambda$process$3(Scripts.java:667)
at com.eas.script.Scripts$Space.lambda$process$4(Scripts.java:703)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
This happens when I try to access change log inside validator. The funny thing about that is this template code works fine:
this.validate = function (aLog, aDatasource, aOnSuccess, aOnFailure) {
Logger.info("GlobalServerValidator. aLog.length: " + aLog.length + "; aDatasource: " + aDatasource + ";");
if (aOnSuccess) {
// TODO: place your asynchronous validation code here
} else {
// TODO: place your synchronous validation code here
}
};
This works fine and prints out this:
15-Sep-2016 10:38:30.975 INFO [platypus-worker-pool-1-thread-15] jdk.nashorn.internal.scripts.Script$Recompilation$76$2129A$logger.L:3$value-3 GlobalServerValidator. aLog.length: 1; aDatasource: tk;
But if I try to access aLog
, it fails with stacktrace posted at the begining.
E.g. eve this simple code fails:
Logger.info(JSON.stringify(aLog[0]));
from platypus-js.
It is because aLog is native Java array, not js array. And so it can't be JSONed. Try Java.from(aLog)
before JSON.stringify(...)
.
Also, try to add dependency change-value.js
to the validator module.
from platypus-js.
Works fine now with core/change-value
.
from platypus-js.
JSON.stringify
doesn't work with non enumerable properties (e.g. Update.keys
). It skips such properties and generates '{}'
text for objects with none of enumerable properties. The changeling entries have non enumerable properties. So, you should develop your own JSON-er or take one already implemented in Platypus.js low level code.
from platypus-js.
Validator still laughing at me :(
This code runs exactly as it is written here.
var log = Java.from(aLog); //Cause aLog is native
var action = log[0]; //First element
Logger.info(JSON.stringify(action)); //This prints 'undefined'
Logger.info(JSON.stringify(action.entity)); //And this prints correct name of entity
How can it be possible?
from platypus-js.
It is because JSON.stringify()
works only with native JS objects. Anyway this situation is to be investigated.
from platypus-js.
Another funny thing
var log = Java.from(aLog); //Cause aLog is native
Logger.info(JSON.stringify(log)); //Prints correct JSON object structure
from platypus-js.
Related Issues (20)
- Link and collection properties HOT 1
- Grid after form resize
- Инспектор модели данных HOT 1
- Ошибка применения пустых полей в SE клиенте
- Postgresql 10 support HOT 3
- Add CI
- File # New File # Database structure diagram. HOT 2
- Custom Widgets API HOT 11
- Session share feature HOT 2
- JavaFX HOT 1
- Grid get cell element HOT 2
- Unminified web client HOT 3
- AMD recursive define fail HOT 6
- Tomcat don't save new password HOT 1
- Dynamic Rpc.Proxy instantiation in HTML5 client HOT 4
- Designer. Explore from here feature HOT 1
- Custom annotations in queries HOT 2
- ModelTextArea editable option isn't working HOT 2
- model.save() works bad in queries with joined tables (CRITICAL BUG!) 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 platypus-js.