Writing own method in openbravo's java class - openbravo

For Openbravo's custom Initial Data Load they have given a class by which we can extend and write code to upload other custom columns.
myclass extends IdlServiceJava in that some method's are used which are of different class eg:- validator.checkNotNull(validator.checkString(values[2], 255), "JournalHeader"); which are of Validator.java
what i did is like checkNotNull() method i made my own (methodcheckCostCenter()) in Validator.java
I ran is successfully and also got wanted results but when i pack this module to install it on other Openbravo instance for testing it is giving me following error.
Bottom of error log:-
compileSqlc:
[javac] Compiling 4 source files to /opt/OpenbravoERP-3.0/openbravo-erp/build/classes
[javac] /opt/OpenbravoERP-3.0/openbravo-erp/modules/in.pispl.idl.journal.costcentre/src/in/pispl/idl/journal/costcentre/ad_process/JournalEntriesProcessCostCentre.java:96: cannot find symbol
[javac] symbol : method checkCostCenter(java.lang.String,int,java.lang.String,java.lang.String,java.lang.String)
[javac] location: class org.openbravo.idl.proc.Validator
[javac] validator.checkCostCenter(values[4], 4, ELEMENTTYPE_ACCOUNT, values[7]/* accTschema */,
[javac] ^
[javac] Note: /opt/OpenbravoERP-3.0/openbravo-erp/modules/in.pispl.idl.journal.costcentre/src/in/pispl/idl/journal/costcentre/ad_process/JournalEntriesProcessCostCentre.java uses unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 1 error
Any solution for this ?
Why it gave me error ?

Do not add any methods to Validator.java as it does not get shipped inside package(openbravo - custom-your-module.obx)..
Instead what you can do is , you can copy the whole Validator.java class to your module package and add your custom methods also inside of it.. In that way, when you install obx in another instance , you can get this working..
Hope this helps !..

Related

Android Studio gradle release Build taking infinite time

I recently updated my code base to Androidx and now trying to build production variant using the command
> ./gradlew assembleProduction
It keeps on building at the process transformClassesAndResourcesWithProguardForProductionRelease
Here is the output
Note: com.google.android.gms.measurement.internal.zzgp: can't find dynamically referenced class com.google.android.gms.tagmanager.TagManagerService
Note: com.google.android.gms.measurement.internal.zzs: can't find dynamically referenced class android.os.SystemProperties
Note: com.google.android.youtube.player.internal.aa: can't find dynamically referenced class com.google.android.youtube.api.locallylinked.LocallyLinkedFactory
Note: com.squareup.okhttp.internal.Platform: can't find dynamically referenced class com.android.org.conscrypt.SSLParametersImpl
Note: com.squareup.okhttp.internal.Platform: can't find dynamically referenced class org.apache.harmony.xnet.provider.jsse.SSLParametersImpl
Note: com.squareup.okhttp.internal.Platform: can't find dynamically referenced class sun.security.ssl.SSLContextImpl
Note: io.fabric.sdk.android.FabricKitsFinder: can't find dynamically referenced class com.google.android.gms.ads.AdView
Note: kotlin.internal.PlatformImplementationsKt: can't find dynamically referenced class kotlin.internal.JRE8PlatformImplementations
Note: kotlin.internal.PlatformImplementationsKt: can't find dynamically referenced class kotlin.internal.JRE7PlatformImplementations
Note: okhttp3.internal.platform.AndroidPlatform$CloseGuard$Companion: can't find dynamically referenced class dalvik.system.CloseGuard
Note: okhttp3.internal.platform.AndroidPlatform$Companion: can't find dynamically referenced class com.android.org.conscrypt.SSLParametersImpl
Note: okhttp3.internal.platform.AndroidPlatform$Companion: can't find dynamically referenced class com.android.org.conscrypt.OpenSSLSocketImpl
Note: okhttp3.internal.platform.ConscryptPlatform$Companion: can't find dynamically referenced class org.conscrypt.Conscrypt$Version
Note: okhttp3.internal.platform.Platform: can't find dynamically referenced class sun.security.ssl.SSLContextImpl
Note: the configuration refers to the unknown field 'com.google.android.gms.common.api.internal.BasePendingResult$ReleasableResultGuardian mResultGuardian' in class 'com.google.android.gms.common.api.internal.BasePendingResult'
Note: the configuration refers to the unknown method 'com.android.vending.billing.IInAppBillingService asInterface(android.os.IBinder)' in class 'com.android.vending.billing.IInAppBillingService'
Note: the configuration refers to the unknown method 'com.google.android.gms.measurement.AppMeasurement getInstance(android.content.Context,java.lang.String,java.lang.String)' in class 'com.google.android.gms.measurement.AppMeasurement'
Note: the configuration explicitly specifies 'sun.misc.Unsafe' to keep library class 'sun.misc.Unsafe'
Note: the configuration explicitly specifies 'org.xmlpull.v1.**' to keep library class 'org.xmlpull.v1.XmlPullParser'
Note: the configuration explicitly specifies 'org.xmlpull.v1.**' to keep library class 'org.xmlpull.v1.XmlPullParserException'
Note: the configuration explicitly specifies 'org.xmlpull.v1.**' to keep library class 'org.xmlpull.v1.XmlPullParserFactory'
Note: the configuration explicitly specifies 'org.xmlpull.v1.**' to keep library class 'org.xmlpull.v1.XmlSerializer'
Note: the configuration explicitly specifies 'android.widget.Space' to keep library class 'android.widget.Space'
Note: there were 7 references to unknown classes.
You should check your configuration for typos.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unknownclass)
Note: there were 3 references to unknown class members.
You should check your configuration for typos.
Note: there were 6 library classes explicitly being kept.
You don't need to keep library classes; they are already left unchanged.
(http://proguard.sourceforge.net/manual/troubleshooting.html#libraryclass)
Note: there were 49 unresolved dynamic references to classes or interfaces.
You should check if you need to specify additional program jars.
(http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclass)
Note: there were 1 class casts of dynamically created class instances.
You might consider explicitly keeping the mentioned classes and/or
their implementations (using '-keep').
(http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclasscast)
Ignoring unused library classes...
Original number of library classes: 24139
Final number of library classes: 2071
Printing kept classes, fields, and methods...
Inlining subroutines...
Shrinking...
Printing usage to [/Users/harsh/git/Mobile_Android_MVA/app/build/outputs/mapping/production/release/usage.txt]...
Removing unused program classes and class elements...
Original number of program classes: 21242
Final number of program classes: 21242
Optimizing (pass 1/5)...
<=<============-> 99% EXECUTING [14m 57s]
> :app:transformClassesAndResourcesWithProguardForProductionRelease
My gradle.properties looks like this
> org.gradle.jvmargs=-Xmx3096m -XX:MaxPermSize=512m
> -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
>
> org.gradle.parallel=true org.gradle.daemon=true
> # Disables R8 for Android Library modules only. android.enableR8.libraries = false
> # Disables R8 for all modules. android.enableR8 = false android.useAndroidX=true android.enableJetifier=true
>
> org.gradle.configureondemand=true
I am using proguard and release buildType has following
minifyEnabled true
useProguard true
shrinkResources true
zipAlignEnabled true
debuggable false
I tried with and without androidx proguard but same result
-keep class androidx.appcompat.widget.** { *; }
-dontwarn com.google.android.material.**
-keep class com.google.android.material.** { *; }
-dontwarn androidx.**
-keep class androidx.** { *; }
-keep interface androidx.** { *; }
Can you please help me how to solve this so I could generate a signed apk
Which version of Android studio are you using? 3.4?
What happens when you compile with R8 instead of Proguard? Sometimes error messages are more explicit.

Why Acumatica can't find method

I'm working with Acumatica 5.30.2347. I have following selector in my graph:
var check = PXSelect<POLine,Where<POLine.orderType, Equal<POOrderType.regularOrder>>>
.Select(this);
but when I try to execute it, I receive following error:
Method not found: 'Void PX.Data.PXLineAttribute..ctor'(System.Type).
Initially I've got an impression, that this error message appeared because class PXLineAttribute doesn't have constructor which accepts System.Type, but with help of reflector I've discovered that PXLineAttribute has following declaration:
public PXLineNbrAttribute(System.Type sourceType)
: this(sourceType, false)
{
}
which gives me idea that PXLineNbrAttribute has needed constructor. So I have two questions: Why Acumatica Framework can't find constructor of PXLineNbrAttribute? How to help Acumatica to find before mentioned constructor?
Please check your VS class library project references to Acumatica assemblies. I would suspect them to reference assemblies from a different Acumatica build and therefore cause "Method not found ..." errors at runtime.

Having error "Module 'name' resolves to an untyped module at..." when writing custom TypeScript definition file

I can't find TypeScript definition #type/{name} for one of my installed NodeJS packages, so I attempt to write a d.ts file for it, and put the file in {project root}\typings folder. This is how I do:
// My source code: index.ts
import Helper from 'node-helper-lib';
// My definition: \typings\node-helper-lib.d.ts
declare....(something else)
declare module 'node-helper-lib' {
class Helper { ... }
export = Helper;
}
However, Visual Studio Code keeps yielding this error and puts red line under declare module 'node-helper-lib':
[ts] Invalid module name in augmentation. Module 'node-helper-lib'
resolves to an untyped module at '{project
path}\node_modules\node-helper-lib\index.js', which cannot be
augmented.
Isn't it legit that because the library is untyped, so I should be allowed to add typing to it?
UPDATE:
I am using:
TypeScript: 2.1.4
Visual Studio Code: 1.9.1
Node JS: 6.9.4
Windows 10 x64
The actual solution is given in a comment by #Paleo in #hirikarate's answer:
Imports should be declared inside the module declaration.
Example:
declare module 'node-helper-lib' {
import * as SomeThirdParty from 'node-helper-lib';
interface Helper {
new(opt: SomeThirdParty.Options): SomeThirdParty.Type
}
export = Helper;
}
After some tries and errors, I found that augmentation means "declaring a module in the same file with other module declaration(s)".
Therefore if we want to write a definition file for an untyped 3rd-party JavaScript library, we must have ONLY ONE declare module 'lib-name' in that file, and 'lib-name' must exactly match the library name (can be found in its package.json, "name" property).
On the other hand, if a 3rd-party library already has definition file .d.ts included, and we want to extend its functionalities, then we can put the additional definition in another file that we create. This is called augmenting.
For example:
// These module declarations are in same file, given that each of them already has their own definition file.
declare module 'events' {
// Extended functionality
}
declare module 'querystring' {
// Extended functionality
}
declare module '...' { ... }
I leave my discovery here just in case somebody has same question. And please correct me if I missed something.
The issue for me was that I was trying to declare the module in a .ts file. I changed it to .d.ts and it all worked just fine.
I was getting that error message too. The issue for me was that I was trying to declare another module in an existing type definition file that had a module declaration in it. After I moved the new module declaration to a new file, the error went away.

package org.eclipse.persistence.oxm.annotations does not exist

for a while now I have been trying to use the #XmlInverseReference annotation from Eclipselink 2.5 to unmarshall one to many relationship between classes.
When I use the annotation the import of corresponding package is generated as shown below :
#XmlInverseReference(mappedBy="materialClassDescription")
public MaterialClass getMaterialClass() {
return materialClass;
}
import org.eclipse.persistence.oxm.annotations.XmlInverseReference;
Eclipselink jar is in the build path, jaxb.properties is maintained and works since I use it to annotate #XmlId on a non string field, on building however i receive the following error :
package org.eclipse.persistence.oxm.annotations does not exist
[javac] ERROR: import
org.eclipse.persistence.oxm.annotations.XmlInverseReference;
[javac]
can anybody help ...
If you are in a regular Java SE setup, then you just need to ensure that eclipselink.jar is on your classpath. You can confirm that you are using EclipseLink 2.5 by running the following:
org.eclipse.persistence.Version.printVersion();

Griffon Upgrade compilation error: mvcGroupInit repetitive method

I'm upgrading a big 0.3.1 Griffon app into 0.9.4 I'm getting these difficulties:
Controlllers:
I've disabled UI Threading Injection in order to avoid the Compilation BUG issue (see Compilation error: BUG! exception after Griffon project upgrade)
That's how I avoid that compilation error but then some other have appeared:
[griffonc]
[griffonc] C:\maestro\desarrollo\projects\interactionManager\sgmentia-client\griffon-app\controllers\com\nortia\sgmentia\client\select\SelectController.groovy: 53: Repetitive method name/signature for method 'void mvcGroupInit(java.util.Map)' in class 'com.nortia.sgmentia.client.select.SelectController'.
[griffonc] # line 53, column 2.
[griffonc] void mvcGroupInit(Map args) {
[griffonc] ^
[griffonc]
[griffonc] C:\maestro\desarrollo\projects\interactionManager\sgmentia-client\griffon-app\controllers\com\nortia\sgmentia\client\select\SelectController.groovy: -1: Repetitive method name/signature for method 'void mvcGroupInit(java.util.Map)' in class 'com.nortia.sgmentia.client.select.SelectController'.
[griffonc] # line -1, column -1.
It seems as if you were not allowed to overrride this method in a child controller. For example:
class MyCommonController{
...
}
class MyChildController extends MyCommonController{
...
void mvcGroupInit(java.util.Map){}
}
I solved this error in other controllers doing the following refactoring:
class MyCommonController{
...
void mvcGroupInit(java.util.Map args){
initMyCommon(map)
}
abstract void initMyCommon(map)
}
class MyChildController extends MyCommonController{
...
void initMyCommon(map){
//My real init code goes here
}
}
but this controller is more complicated to refactor:
class SelectController extends WindowAdapter implements DocumentController
Is this the real problem? Any ideas?
Thanks in advance.
Ivan.
I've replicated the same settings but can get the application to work properly, at least if all controllers are found inside griffon-app/controllers. However if the base controller is placed in another directory, for example src/main, then you'll get this error.
This is a bug in Griffon that should be fixed. Would you care to post a JIRA ticket at http://jira.codehaus.org/browse/griffon?

Resources