Skip to content

Commit

Permalink
Merge pull request #1 from EdwinBetanc0urt/feature/set-file-handler-o…
Browse files Browse the repository at this point in the history
…n-client-info

feat: Set File Handler on Client Info.
  • Loading branch information
yamelsenih authored Sep 27, 2024
2 parents c14a26b + 755c5f0 commit 8747b19
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions src/main/java/org/spin/eca62/setup/Deploy.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import java.util.Properties;

import org.adempiere.exceptions.AdempiereException;
import org.compiere.model.MClientInfo;
import org.compiere.util.Env;
import org.spin.model.MADAppRegistration;
import org.spin.model.MADAppSupport;
import org.spin.util.ISetupDefinition;
Expand All @@ -33,12 +35,16 @@ public class Deploy implements ISetupDefinition {

@Override
public String doIt(Properties context, String transactionName) {
//
createConnection(context, transactionName);
// create App Registration
MADAppRegistration appRegistration = createConnection(context, transactionName);

// Set App Registration to Client Info
configClient(context, appRegistration, transactionName);

return "@AD_SetupDefinition_ID@ @Ok@";
}

private void createConnection(Properties context, String transactionName) {
private MADAppRegistration createConnection(Properties context, String transactionName) {
MADAppRegistration aws3Connection = MADAppRegistration.getByApplicationType(context, APP_TYPE, transactionName);
if(aws3Connection == null
|| aws3Connection.getAD_AppRegistration_ID() <= 0) {
Expand All @@ -57,5 +63,16 @@ private void createConnection(Properties context, String transactionName) {
aws3Connection.setPort(9000);
aws3Connection.saveEx();
}
return aws3Connection;
}

private void configClient(Properties context, MADAppRegistration aws3Connection, String transactionName) {
int clientId = Env.getAD_Client_ID(context);
MClientInfo clientInfo = MClientInfo.get(context, clientId, transactionName);
clientInfo.setFileHandler_ID(
aws3Connection.getAD_AppRegistration_ID()
);
clientInfo.saveEx();
}

}

0 comments on commit 8747b19

Please sign in to comment.