Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename all packages #3966

Merged
merged 39 commits into from
Sep 20, 2022

Conversation

yamelsenih
Copy link
Member

@yamelsenih yamelsenih commented Aug 7, 2022

Branch: feature/#Src-Change-Packages

Rename base Package

This pull request basically change the package name of all I_ and X_ classes to new structure:

Old structure:

  - it.cnr.imaa.essi.lablib.gui.checkboxtree
  - org.compiere.acct
  - org.eevolution.engine.forecast
  - org.eevolution.exceptions
  - org.eevolution.model
  - org.eevolution.model.impl
  - org.eevolution.model.reasoner
  - org.eevolution.model.wrapper
  - org.eevolution.msg
  - org.eevolution.process
  - org.eevolution.report
  - org.eevolution.tools
  - org.eevolution.tools.worker

New structure:

  - it.cnr.imaa.essi.lablib.gui.checkboxtree
  - org.eevolution.manufacturing.acct
  - org.eevolution.manufacturing.controller
  - org.eevolution.manufacturing.engine.forecast
  - org.eevolution.manufacturing.exceptions
  - org.eevolution.manufacturing.model
  - org.eevolution.manufacturing.model.impl
  - org.eevolution.manufacturing.model.reasoner
  - org.eevolution.manufacturing.model.validator
  - org.eevolution.manufacturing.model.wrapper
  - org.eevolution.manufacturing.msg
  - org.eevolution.manufacturing.process
  - org.eevolution.manufacturing.report
  - org.eevolution.manufacturing.tools
  - org.eevolution.manufacturing.tools.worker
  - org.eevolution.manufacturing.utils
  - org.eevolution.model

Here some checks:

Processes

SELECT p.Value, p.Name
FROM AD_Process p
WHERE p.ClassName IN ('org.eevolution.process.CalculateLowLevel', 'org.eevolution.process.CompletePrintOrder', 'org.eevolution.process.ComponentChange', 'org.eevolution.process.CopyCostTypeToCostType', 'org.eevolution.process.CopyFromBOM', 'org.eevolution.process.CopyPriceToStandard', 'org.eevolution.process.CreateCostElement', 'org.eevolution.process.CreateDocType', 'org.eevolution.process.CreatePeriods', 'org.eevolution.process.CreateProductPlanning', 'org.eevolution.process.CRP', 'org.eevolution.process.CRPSummary', 'org.eevolution.process.DistributionRunOrders', 'org.eevolution.process.FixPaymentCashLine', 'org.eevolution.process.ForecastRunCreate', 'org.eevolution.process.FrozenUnFrozenCost', 'org.eevolution.process.GenerateCostDetail', 'org.eevolution.process.GenerateForecast', 'org.eevolution.process.GenerateOrderCost', 'org.eevolution.process.GenerateSalesHistory', 'org.eevolution.process.ImportForecast', 'org.eevolution.process.ImportProductBOM', 'org.eevolution.process.ImportProductPlanning', 'org.eevolution.process.ImportSalesHistory', 'org.eevolution.process.ImportWorkflow', 'org.eevolution.process.MRP', 'org.eevolution.process.MRPApproval', 'org.eevolution.process.MRPSchedule', 'org.eevolution.process.MRPUpdate', 'org.eevolution.process.PP_Product_BOM_Check', 'org.eevolution.process.PrintBOM', 'org.eevolution.process.ProcessInfoHandler', 'org.eevolution.process.ProcessingForecast', 'org.eevolution.process.ProjectGenerateManufacturingOrder', 'org.eevolution.process.RollupBillOfMaterial', 'org.eevolution.process.RollupWorkflow', 'org.eevolution.process.SimulatedPickList', 'org.eevolution.distribution.process.ValidateOrderedAndReservedQuantity');
Value Name
Import_Workflow Import Workflow
PP_Order GenerateOrderCost Generate Manufacturing Order Cost
Import_ProductBOM Import Product BOM
PP_Create DocType Create Doc Type to Manufacturing
PP_Mutiple Components Change Mutiple Components Change
PP_Simulated Pick List Simulated Pick List
Import_ProductPlanning Import Product Planning and Forecast
M_DistributionRun Orders Distribution Run Orders
Import_Sales History Import Sales History
M_Forecast Processing Processing a forecast
PP_Calculate Forecast PP_Calculate Forecast
PP_Period Definition Create Periods Create Periods
C_SalesHistory_Generate Generate Sales History
M_Forecast Generate Forecast Generate Forecast
Import_Forecast Import Forecast
M_CostDetail Generate Cost Transaction Generate Cost Transaction
MRP_Requisition_Approval Requisition Approval
PP_Calculate Capacity Plan Calculate Capacity Plan
MRP_Manufacturing_Order_Approval Manufacturing Order Approval
MRP_Distribution_Order_Approval Distribution Order Approval
MRP_Schedule Demands and Supplies to schedule
PP_Product_Planning Create Product Planning
PP_Calculate Low Level Calculate Low Level
PP_Create Record MRP Create Record MRP
PP_Copy Price to Standard Cost Copy Price to Standard Cost
PP_Workflow Cost Roll-Up Workflow Cost Roll-Up
PP_Bill of Material Cost Roll-UP Bill of Material & Formula Cost Roll-UP
PP_Product_BOM CopyFrom PP_Product_BOM CopyFrom
PP_Print & Release Order Print & Release Order
PP_Cost_Element Create Element
PP_Multi Level BOM & Formula Multi Level BOM & Formula Detail
PP_Cost Frozen/UnFrozen Frozen/UnFrozen Cost
DRP_Calculate Distribution Plan Calculate Distribution Plan
MRP_Regenerative Material Plan Regenerative Material Plan
MRP_Net_Change Material Plan Net Change Material Plan
MRP_Selective Material Plan Selective Material Plan
PP_Copy Cost Type to Cost Type Copy Cost Type to other Cost Type
C_Project_GenerateMO Generate Manufacturing Order from Project
PP_Product_BOM Verify BOM

Model Validators

SELECT mv.Name, mv.Description
FROM AD_ModelValidator mv
WHERE MV.ModelValidationClass IN('');
Name Description

Callouts

SELECT t.TableName, c.ColumnName, c.Callout
FROM AD_Table t
INNER JOIN AD_Column c ON(c.AD_Table_ID = t.AD_Table_ID)
WHERE Callout LIKE '%org.eevolution.model.CalloutBOM%'
OR Callout LIKE '%org.eevolution.model.CalloutCostCollector%'
OR Callout LIKE '%org.eevolution.model.CalloutDistributionOrder%'
OR Callout LIKE '%org.eevolution.model.CalloutOrder%'
ORDER BY t.TableName, c.ColumnName;
tablename columnname callout
DD_Order AD_Org_ID org.eevolution.model.CalloutDistributionOrder.bPartner
DD_OrderLine ConfirmedQty org.eevolution.model.CalloutDistributionOrder.qtyConfirmed
DD_OrderLine C_UOM_ID org.eevolution.model.CalloutDistributionOrder.qty
DD_OrderLine M_AttributeSetInstance_ID org.eevolution.model.CalloutDistributionOrder.qty
DD_OrderLine M_AttributeSetInstanceTo_ID org.eevolution.model.CalloutDistributionOrder.qty
DD_OrderLine M_Product_ID org.eevolution.model.CalloutDistributionOrder.setLocatorTo
DD_OrderLine QtyEntered org.eevolution.model.CalloutDistributionOrder.qty
DD_OrderLine QtyOrdered org.eevolution.model.CalloutDistributionOrder.qty
PP_Cost_Collector MovementQty org.eevolution.model.CalloutCostCollector.duration
PP_Cost_Collector PP_Order_ID org.eevolution.model.CalloutCostCollector.order
PP_Cost_Collector PP_Order_Node_ID org.eevolution.model.CalloutCostCollector.node
PP_Order M_Product_ID org.eevolution.model.CalloutOrder.product
PP_Order QtyEntered org.eevolution.model.CalloutOrder.qty;org.eevolution.model.CalloutOrder.qtyBatch
PP_Order_BOMLine QtyEntered org.eevolution.model.CalloutBOM.qtyLine
PP_Order_BOMLine QtyRequired org.eevolution.model.CalloutBOM.qtyLine
PP_Product_BOM M_Product_ID org.eevolution.model.CalloutBOM.getdefaults
PP_Product_BOMLine M_Product_ID org.eevolution.model.CalloutBOM.parent

Forms

SELECT f.Name, f.Description
FROM AD_Form f
WHERE f.ClassName IN('');
Name Description

Step by Step for build with gradle

Requirements:

  • Gradle 7.4.1 or later
  • Java 8 or later
  • Export a eviroment variable named ADEMIERE_LIBRARY_VERSION

Export enviroment variable

export ADEMIERE_LIBRARY_VERSION="some-version"

Build with gradle

cd /AdempiereRepo
gradle build

@yamelsenih yamelsenih assigned marcalwestf and unassigned marcalwestf Aug 7, 2022
@yamelsenih yamelsenih assigned yamelsenih and unassigned marcalwestf Aug 7, 2022
@yamelsenih yamelsenih added the 20 Refactoring Code refactoring with no change in behavior label Aug 7, 2022
@yamelsenih yamelsenih added this to the 3.9.4 milestone Aug 7, 2022
@marcalwestf
Copy link
Collaborator

marcalwestf commented Aug 7, 2022

@yamelsenih some questions Yamel:

  1. is it intended to build already with gradle?
  2. if so, can you deliver a step-by-step instruction to test it?
  3. is there a minimum grade version it must be implemented to run correctly?
  4. notwithstanding it can be built with gradle or not, I suppose, the compatibility should be 11, instead of 8, shouldn't it?
    imagen

Thanks!

@marcalwestf marcalwestf added the 17 Waiting for Information Information needed to continue testing label Aug 7, 2022
@marcalwestf
Copy link
Collaborator

... I see in the Github actions that there is a build with Gradle -BTW exited with an error- so I suppose, it is meant to run with Gradle...

@marcalwestf
Copy link
Collaborator

I started a terminal on Eclipse and went to the root of the project and run there
gradle build
this is the result:
imagen

My grade version is 6.3:

$ gradle -v

Gradle 6.3
------------------------------------------------------------

Build time:   2020-03-24 19:52:07 UTC
Revision:     bacd40b727b0130eeac8855ae3f9fd9a0b207c60

Kotlin:       1.3.70
Groovy:       2.5.10
Ant:          Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM:          11.0.15 (Azul Systems, Inc. 11.0.15+10-LTS)
OS:           Linux 4.15.0-161-generic i386

I will update my grade version and try anew.

@yamelsenih
Copy link
Member Author

I started a terminal on Eclipse and went to the root of the project and run there gradle build this is the result: imagen

My grade version is 6.3:

$ gradle -v

Gradle 6.3
------------------------------------------------------------

Build time:   2020-03-24 19:52:07 UTC
Revision:     bacd40b727b0130eeac8855ae3f9fd9a0b207c60

Kotlin:       1.3.70
Groovy:       2.5.10
Ant:          Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM:          11.0.15 (Azul Systems, Inc. 11.0.15+10-LTS)
OS:           Linux 4.15.0-161-generic i386

I will update my grade version and try anew.

Hi @marcalwestf
Here the response:

Step by Step for build with gradle

Requirements:

  • Gradle 7.4.1 or later
  • Java 8 or later
  • Export a eviroment variable named ADEMIERE_LIBRARY_VERSION

Export enviroment variable

export ADEMIERE_LIBRARY_VERSION="some-version"

Build with gradle

cd /AdempiereRepo
gradle build

Copy link
Collaborator

@marcalwestf marcalwestf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Libero test: Report Cost BOM Multi Level Review -> OK

@yamelsenih
Copy link
Member Author

yamelsenih commented Aug 15, 2022

  • Production

Hi @marcalwestf this error was resolved yet
Here the change: f9c5bb1

@marcalwestf marcalwestf self-requested a review August 15, 2022 19:01
Copy link
Collaborator

@marcalwestf marcalwestf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • A Production Batch was created, prepared, and completed -> OK
  • A Production completed using the button on Swing-> OK
    imagen
  • A Production completed using the icon (toolbar) on Swing-> java.lang.ClassNotFoundException: org.compiere.process.ProductionProcess
    imagen

@yamelsenih
Copy link
Member Author

Hi @marcalwestf the process "Process Production" is no longer supported because already exists the workflow for Production, this process was deprecated and instead just should run document action with process instead complete action

@yamelsenih
Copy link
Member Author

  • A Production Batch was created, prepared, and completed -> OK
  • A Production completed using the button on Swing-> OK
    imagen
  • A Production completed using the icon (toolbar) on Swing-> java.lang.ClassNotFoundException: org.compiere.process.ProductionProcess
    imagen

Hi @marcalwestf these process are deprecated here: b032393

Please remove current XML and import it from source

@marcalwestf
Copy link
Collaborator

@yamelsenih Yamel, concerning the gradle error:

Gradle build sucess

At last, I was able to get the exact result as the action when calling gradle build:
imagen

The reason: using different JDKs like zulu-jdk11.0.15, or java-11-openjdk-amd64 there were errors thrown.
With jdk-11.0.11+9, and jdk-11.0.11 instead, I could run gradle build successfully. I ignore if there are more; in the action, jdk-11.0.11+8 is used.
We thus, must be very careful wich JDK we use to build.

Correction of typo

I notice, in all build.gradle files the variable name is ADEMIERE_LIBRARY_VERSION instead of ADEMPIERE_LIBRARY_VERSION:
imagen

This should be modified in all gradle.build files which refer to this variable to ADEMPIERE_LIBRARY_VERSION, because users might try to write the correct name (=ADEMPIERE) and this would lead to errors.

.gitignore for Gradle

Also, the .gradle directory should be included in the .gitignore file, so it files are not considered to be pushed, which confuses otherwise:
imagen

Question

Last, but not least, I notice that gradle build compiles, but it doesn't create packages nor the binary as ANT does, is it correct?

@marcalwestf
Copy link
Collaborator

marcalwestf commented Aug 16, 2022

@yamelsenih Yamel, I loaded and applied the XML file. The changes you made are OK and improve the usability.

About the error at Production: the error is thrown when you click on the icon, as you can see in the following image.
The process dialog is shown and the complete action works well, nothwithstanding.
Selection_327-modifieda

@yamelsenih
Copy link
Member Author

@yamelsenih Yamel, concerning the gradle error:

Gradle build sucess

At last, I was able to get the exact result as the action when calling gradle build: imagen

The reason: using different JDKs like zulu-jdk11.0.15, or java-11-openjdk-amd64 there were errors thrown. With jdk-11.0.11+9, and jdk-11.0.11 instead, I could run gradle build successfully. I ignore if there are more; in the action, jdk-11.0.11+8 is used. We thus, must be very careful wich JDK we use to build.

Correction of typo

I notice, in all build.gradle files the variable name is ADEMIERE_LIBRARY_VERSION instead of ADEMPIERE_LIBRARY_VERSION: imagen

This should be modified in all gradle.build files which refer to this variable to ADEMPIERE_LIBRARY_VERSION, because users might try to write the correct name (=ADEMPIERE) and this would lead to errors.

.gitignore for Gradle

Also, the .gradle directory should be included in the .gitignore file, so it files are not considered to be pushed, which confuses otherwise: imagen

Question

Last, but not least, I notice that gradle build compiles, but it doesn't create packages nor the binary as ANT does, is it correct?

Hi @marcalwestf thanks, hahaha was me at 3:00 AM.

This was resolved here: 305f560

@yamelsenih
Copy link
Member Author

@yamelsenih Yamel, I loaded and applied the XML file. The changes you made are OK and improve the usability.

About the error at Production: the error is thrown when you click on the icon, as you can see in the following image. The process dialog is shown and the complete action works well, nothwithstanding. Selection_327-modifieda

Hi @marcalwestf this was resolved here: b2c8e0e

The current functionality is unsupported for fields disabled or hidden

@marcalwestf
Copy link
Collaborator

hi @yamelsenih , at last, all the tests were positive.
From my side, this PR can be accepted.

@marcalwestf marcalwestf self-requested a review August 17, 2022 13:01
Copy link
Collaborator

@marcalwestf marcalwestf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After many tests and corrections, this PR doesn't throw any exception of the type ClassNotFound nor causes malfunctions.

@marcalwestf
Copy link
Collaborator

FYI:
Steps to run Gradle

  • install latest Gradle (as of today: 7.5.1)
  • install JDK 11, but beware that for example zulu-jdk11.0.15, or java-11-openjdk-amd64 delivered errors on my test , but jdk-11.0.11+9, and jdk-11.0.11 yielded no error.
  • on the console, set and export variable ADEMPIERE_LIBRARY_VERSION to any value (e.g. export ADEMPIERE_LIBRARY_VERSION=1.0.0)
  • on the console, go to the repository root directory (cd ...)
  • on the console, run gradle build

@e-Evolution
Copy link
Contributor

@yamelsenih Yamel I found a potential problem, it is not correct to replace an MModel class with X_Model since the X_Model classes do not contain the business logic after and before saving and/or deleting.

This may be that using the X_ class changes the behavior because it is not applying the business logic required in the MModel class.

X_Model classes can be used for reading only but not for using the save method:

Here is an example in the class with this problem:

AbstractCostingMethod.java

Please check any other refactory where you applied this procedure because it is not suitable.

image

I also realize that the code of the TestDocumentEngine.java class was removed from a test, the test does not pass and it is necessary to fix it later, do not remove the code, it is better to comment it and put a TODO: in the comment, we can ask Mike to review it for the behavior of the test since he was the one who designed that test.

it's not good to sweep code under the rug :-)

In the StandardCostingMethod.java class, code was removed although some utility classes were created, I could not find anywhere how that business logic that was executed before is now executed in this class.

In special the variance cost standard

		if (model instanceof MPPCostCollector)
		{
			MPPCostCollector cc = (MPPCostCollector) model;
			if (MPPCostCollector.COSTCOLLECTORTYPE_MethodChangeVariance.equals(cc.getCostCollectorType())) {
				createMethodVariances(cc);
			} else if (MPPCostCollector.COSTCOLLECTORTYPE_UsegeVariance.equals(cc.getCostCollectorType())) {
				createUsageVariances(cc);
			} else if (MPPCostCollector.COSTCOLLECTORTYPE_RateVariance.equals(cc.getCostCollectorType())) {
				createRateVariances(cc);
			} else if (MPPCostCollector.COSTCOLLECTORTYPE_MixVariance.equals(cc.getCostCollectorType())) {
				; // no implement
			}
		}

image

On the other hand, I see very well that all the callouts have been changed to a new package called controller, which seems correct to me, but since this is being done and the packages have been restructured, it seems very important to me to use the same pattern for all the callouts. that were moved from their current package, taking advantage of the fact that you already have the XML that changes the path of the package, it would be good if they all use the same pattern.

image

So the moment these changes are applied and my question is answered I can complete the merge.

on the other hand, I want to thank you for your enormous effort in this great challenge it was not easy, but you did it, congratulations

@marcalwestf
Copy link
Collaborator

@yamelsenih, @e-Evolution about the gradle files: in the gradle documentation (https://docs.gradle.org/current/userguide/java_plugin.html#sec:java-extension) and other explanations (e.g. https://www.baeldung.com/gradle-sourcecompatiblity-vs-targetcompatibility), there is a welll-defined description of using sourceCompatibility and targetCompatibility.

If we take into account that we compile ADempiere with JDK 11, but can execute with either JDK 11 or JDK 17, I think, the configuration should be

sourceCompatibility = 1.11
targetCompatibility = 1.17

This would allow us to compile up to JDK 11, and run with no less than JDK 17.
What do you think?

… standard cost method that was removed in previous commits
- Normalization of names for Callout of Assets, these were moved to the controller package
- Normalization of process names and implementation using the abstract class
- Move domino models to package org.adempiere.core.domains.models
- Set the application dictionary items to the entity type for Fixed Assets
- Fix the XML Script to define Release No and change the packages in the application dictionary
* develop:
  adempiere#3959 [Bug Report] Tomcat does not exist in the Read Connection Pool adempiere#3959
  adempiere#3976 [Bug Report] Backward compatibility was broken for queryData web services adempiere#3976
  Fix adempiere#3968
  Fixing migration xml sequences
  Fix adempiere#3968
  adempiere#3959 [Bug Report] Tomcat does not exist in the Read Connection Pool adempiere#3959
  adempiere#3959 [Bug Report] Tomcat does not exist in the Read Connection Pool adempiere#3959
  Fixing translations
  New Notification Window per user

# Conflicts:
#	base/src/org/compiere/model/POInfo.java
Copy link
Contributor

@e-Evolution e-Evolution left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I finished the pending refactory in code and enhancements :

  • Change package name from service to services to improve package names in ADempiere's DSL
  • Add business functionality for the calculation of variations in the standard cost method that was removed in previous commits
  • Change package name for Fixed Assets from FA to asset
  • Normalization of names for Callout of Assets, these were moved to the controller package
  • Normalization of process names and implementation using the abstract class
  • Move domino models to package org.adempiere.core.domains.models
  • Set the application dictionary items to the entity type for Fixed Assets
  • Fix the XML Script to define Release No and change the packages in the application dictionary

@e-Evolution e-Evolution merged commit 2f17de4 into adempiere:develop Sep 20, 2022
@e-Evolution e-Evolution deleted the feature/#Src-Rename-All-Packages branch September 20, 2022 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
09 Pending Peer Review 14 Waiting for User Changes Waiting for Pull request User make changes 17 Waiting for Information Information needed to continue testing 20 Refactoring Code refactoring with no change in behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants