Exportfile for AOT version 1.0 or later Formatversion: 1 ***Element: CLS ; Microsoft Dynamics AX Class: KlForUpdateCustomers unloaded ; -------------------------------------------------------------------------------- CLSVERSION 1 CLASS #KlForUpdateCustomers PROPERTIES Name #KlForUpdateCustomers Extends # RunOn #Called from ENDPROPERTIES METHODS Version: 3 SOURCE #classDeclaration #class KlForUpdateCustomers #{ # CustTable custTable; #} ENDSOURCE SOURCE #new #protected void new() #{ #} ENDSOURCE SOURCE #parmCustTable #public CustTable parmCustTable(CustTable _custTable = custTable) #{ # ; # custTable = _custTable; # # return custTable; #} # ENDSOURCE SOURCE #run #public void run() #{ # ; # // simulate a process that takes 3 seconds # sleep(3000); # info(strfmt('updated customer %1', this.parmCustTable().AccountNum)); #} ENDSOURCE SOURCE #construct #private static KlForUpdateCustomers construct() #{ # return new KlForUpdateCustomers(); #} # ENDSOURCE SOURCE #newcustTable #public static KlForUpdateCustomers newcustTable(CustTable _custTable) #{ # KlForUpdateCustomers klForUpdateCustomers; # ; # # klForUpdateCustomers = KlForUpdateCustomers::construct(); # klForUpdateCustomers.parmCustTable(_custTable); # # return klForUpdateCustomers; #} # ENDSOURCE ENDMETHODS ENDCLASS ***Element: CLS ; Microsoft Dynamics AX Class: KlForUpdateCustomersSingleTheadBatch unloaded ; -------------------------------------------------------------------------------- CLSVERSION 1 CLASS #KlForUpdateCustomersSingleTheadBatch PROPERTIES Name #KlForUpdateCustomersSingleTheadBatch Extends #RunBaseBatch RunOn #Called from ENDPROPERTIES METHODS Version: 3 SOURCE #caption #public ClassDescription caption() #{ # ClassDescription ret; # # ret = 'Update Customers Single Thead Batch'; # # return ret; #} ENDSOURCE SOURCE #classDeclaration #class KlForUpdateCustomersSingleTheadBatch extends runBaseBatch #{ # QueryRun queryRun; # # #Define.CurrentVersion(1) #} ENDSOURCE SOURCE #initParmDefault #public void initParmDefault() #{ # Query query; # ; # # query = new Query(); # query.addDataSource(tablenum(CustTable)); # # queryRun = new QueryRun(query); #} ENDSOURCE SOURCE #new #protected void new() #{ # super(); #} ENDSOURCE SOURCE #pack #public container pack() #{ # return [#CurrentVersion, this.queryRun().Pack()]; #} ENDSOURCE SOURCE #queryRun #// JBC - FA - KDOCR - 13/09/2010 #public QueryRun queryRun() #{ # Query query; # ; # # if(!queryRun) # { # query = new Query(); # query.addDataSource(tablenum(CustTable)); # # queryRun = new QueryRun(query); # } # # return queryRun; #} ENDSOURCE SOURCE #run #public void run() #{ # CustTable custTable; # ; # # while(queryRun.next()) # { # custTable = queryRun.get(tablenum(CustTable)); # # KlForUpdateCustomers::newcustTable(custTable).run(); # } #} ENDSOURCE SOURCE #showDefaultButton #public boolean showDefaultButton() #{ # return true; #} ENDSOURCE SOURCE #showQuerySelectButton #public boolean showQuerySelectButton() #{ # return true; #} ENDSOURCE SOURCE #showQueryValues #public boolean showQueryValues() #{ # return true; #} ENDSOURCE SOURCE #unpack #public boolean unpack(container _packedClass) #{ # Version version = RunBase::getVersion(_packedClass); # container queryPacked; # # switch (version) # { # case #CurrentVersion: # [version,queryPacked] = _packedClass; # if (queryIsPackedOk(queryPacked)) # { # queryRun = new QueryRun(queryPacked); # } # break; # default: # return false; # } # # return true; #} ENDSOURCE SOURCE #construct #public static KlForUpdateCustomersSingleTheadBatch construct() #{ # return new KlForUpdateCustomersSingleTheadBatch(); #} # ENDSOURCE SOURCE #main #public static void main(Args args) #{ # KlForUpdateCustomersSingleTheadBatch klForUpdateCustomersSingleTheadBatch; # ; # # KlForUpdateCustomersSingleTheadBatch = KlForUpdateCustomersSingleTheadBatch::construct(); # # if(KlForUpdateCustomersSingleTheadBatch.prompt()) # { # KlForUpdateCustomersSingleTheadBatch.run(); # } #} # ENDSOURCE ENDMETHODS ENDCLASS ***Element: CLS ; Microsoft Dynamics AX Class: KlForUpdateCustomersMultiThreadTask unloaded ; -------------------------------------------------------------------------------- CLSVERSION 1 CLASS #KlForUpdateCustomersMultiThreadTask PROPERTIES Name #KlForUpdateCustomersMultiThreadTask Extends #RunBaseBatch RunOn #Called from ENDPROPERTIES METHODS Version: 3 SOURCE #caption #public ClassDescription caption() #{ # ClassDescription ret; # # ret = 'Update Customers Multi Thread Task'; # # return ret; #} ENDSOURCE SOURCE #classDeclaration #class KlForUpdateCustomersMultiThreadTask extends RunBaseBatch #{ # CustTable custTable; # # #define.CurrentVersion(1) # #localmacro.CurrentList # custTable # #endmacro #} ENDSOURCE SOURCE #new #protected void new() #{ # super(); #} ENDSOURCE SOURCE #pack #public container pack() #{ # return [#CurrentVersion,#CurrentList]; #} ENDSOURCE SOURCE #parmCustTable #public CustTable parmCustTable(CustTable _custTable = custTable) #{ # ; # custTable = _custTable; # # return custTable; #} # ENDSOURCE SOURCE #run #public void run() #{ # ; # KlForUpdateCustomers::newcustTable(this.parmCustTable()).run(); #} ENDSOURCE SOURCE #unpack #public boolean unpack(container packedClass) #{ # int version = runbase::getVersion(packedClass); # # switch (version) # { # case #CurrentVersion: # [version,#CurrentList] = packedClass; # return true; # default : # return false; # } # # return false; #} ENDSOURCE SOURCE #construct #private static KlForUpdateCustomersMultiThreadTask construct() #{ # return new KlForUpdateCustomersMultiThreadTask(); #} # ENDSOURCE SOURCE #newcustTable #public static KlForUpdateCustomersMultiThreadTask newcustTable(CustTable _custTable) #{ # KlForUpdateCustomersMultiThreadTask klForUpdateCustomersMultiThreadTask; # ; # # klForUpdateCustomersMultiThreadTask = KlForUpdateCustomersMultiThreadTask::construct(); # klForUpdateCustomersMultiThreadTask.parmCustTable(_custTable); # # return klForUpdateCustomersMultiThreadTask; #} # ENDSOURCE ENDMETHODS ENDCLASS ***Element: CLS ; Microsoft Dynamics AX Class: KlForUpdateCustomersMultiThreadBatch unloaded ; -------------------------------------------------------------------------------- CLSVERSION 1 CLASS #KlForUpdateCustomersMultiThreadBatch PROPERTIES Name #KlForUpdateCustomersMultiThreadBatch Extends #RunBaseBatch RunOn #Called from ENDPROPERTIES METHODS Version: 3 SOURCE #caption #public ClassDescription caption() #{ # ClassDescription ret; # # ret = 'Update Customers Multi Thread Batch'; # # return ret; #} ENDSOURCE SOURCE #classDeclaration #class KlForUpdateCustomersMultiThreadBatch extends runBaseBatch #{ # QueryRun queryRun; # # #Define.CurrentVersion(1) #} ENDSOURCE SOURCE #initParmDefault #public void initParmDefault() #{ # Query query; # ; # # query = new Query(); # query.addDataSource(tablenum(CustTable)); # # queryRun = new QueryRun(query); #} ENDSOURCE SOURCE #new #protected void new() #{ # super(); #} ENDSOURCE SOURCE #pack #public container pack() #{ # return [#CurrentVersion, this.queryRun().Pack()]; #} ENDSOURCE SOURCE #queryRun #// JBC - FA - KDOCR - 13/09/2010 #public QueryRun queryRun() #{ # Query query; # ; # # if(!queryRun) # { # query = new Query(); # query.addDataSource(tablenum(CustTable)); # # queryRun = new QueryRun(query); # } # # return queryRun; #} ENDSOURCE SOURCE #run #public void run() #{ # BatchHeader batchHeader; # KlForUpdateCustomersMultiThreadTask klForUpdateCustomersMultiThreadTask; # CustTable custTable; # ; # # while(queryRun.next()) # { # custTable = queryRun.get(tablenum(CustTable)); # # if(this.isInBatch()) # { # // when in batch # // create multiple tasks # if(!batchHeader) # { # batchHeader = BatchHeader::construct(this.parmCurrentBatch().RecId); # } # # // create a new instance of the batch task class # klForUpdateCustomersMultiThreadTask = KlForUpdateCustomersMultiThreadTask::newcustTable(custTable); # # // add tasks to the batch header # batchHeader.addRuntimeTask(klForUpdateCustomersMultiThreadTask, this.parmCurrentBatch().RecId); # } # else # { # // when not in batch # KlForUpdateCustomers::newcustTable(custTable).run(); # } # } # # if(batchHeader) # { # // save the batchheader with added tasks # batchHeader.save(); # } #} ENDSOURCE SOURCE #showDefaultButton #public boolean showDefaultButton() #{ # return true; #} ENDSOURCE SOURCE #showQuerySelectButton #public boolean showQuerySelectButton() #{ # return true; #} ENDSOURCE SOURCE #showQueryValues #public boolean showQueryValues() #{ # return true; #} ENDSOURCE SOURCE #unpack #public boolean unpack(container _packedClass) #{ # Version version = RunBase::getVersion(_packedClass); # container queryPacked; # # switch (version) # { # case #CurrentVersion: # [version,queryPacked] = _packedClass; # if (queryIsPackedOk(queryPacked)) # { # queryRun = new QueryRun(queryPacked); # } # break; # default: # return false; # } # # return true; #} ENDSOURCE SOURCE #construct #public static klForUpdateCustomersMultiThreadBatch construct() #{ # return new klForUpdateCustomersMultiThreadBatch(); #} # ENDSOURCE SOURCE #main #public static void main(Args args) #{ # KlForUpdateCustomersMultiThreadBatch klForUpdateCustomersMultiThreadBatch; # ; # # klForUpdateCustomersMultiThreadBatch = KlForUpdateCustomersMultiThreadBatch::construct(); # # if(klForUpdateCustomersMultiThreadBatch.prompt()) # { # klForUpdateCustomersMultiThreadBatch.run(); # } #} # ENDSOURCE ENDMETHODS ENDCLASS ***Element: PRN ; Microsoft Dynamics AX Project : KlForMultiThreadedBatchExample unloaded ; -------------------------------------------------------------------------------- PROJECTVERSION 2 PROJECT #KlForMultiThreadedBatchExample SHARED PROPERTIES Name #KlForMultiThreadedBatchExample ENDPROPERTIES PROJECTCLASS ProjectNode GROUP #BussinessLogicClass PROPERTIES Name #BussinessLogicClass ProjectGroupType #All GroupMask # PreventEditProperties #No ENDPROPERTIES BEGINNODE FILETYPE 0 UTILTYPE 45 UTILOBJECTID 50001 NODETYPE 329 NAME #KlForUpdateCustomers ENDNODE ENDGROUP GROUP #OldFashionBatch PROPERTIES Name #OldFashionBatch ProjectGroupType #All GroupMask # PreventEditProperties #No ENDPROPERTIES BEGINNODE FILETYPE 0 UTILTYPE 45 UTILOBJECTID 50002 NODETYPE 329 NAME #KlForUpdateCustomersSingleTheadBatch ENDNODE ENDGROUP GROUP #MultiTaskBatch PROPERTIES Name #MultiTaskBatch ProjectGroupType #All GroupMask # PreventEditProperties #No ENDPROPERTIES BEGINNODE FILETYPE 0 UTILTYPE 45 UTILOBJECTID 50003 NODETYPE 329 NAME #KlForUpdateCustomersMultiThreadTask ENDNODE BEGINNODE FILETYPE 0 UTILTYPE 45 UTILOBJECTID 50004 NODETYPE 329 NAME #KlForUpdateCustomersMultiThreadBatch ENDNODE ENDGROUP ENDPROJECT ***Element: END