Skip to content

Commit

Permalink
5656-app - EDI-Tweaks
Browse files Browse the repository at this point in the history
- minor fix regarding updates to C_OLCands in the webui when they are cleared for processing
#5656
  • Loading branch information
metas-ts committed Oct 16, 2019
1 parent 75a33cf commit 8fc82c2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of the
* License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-2.0.html>.
Expand All @@ -37,8 +37,8 @@
import org.adempiere.server.rpl.trx.spi.IReplicationIssueAware;
import org.adempiere.server.rpl.trx.spi.IReplicationIssueSolver;

import de.metas.util.Check;
import de.metas.util.Services;
import lombok.NonNull;

public class ReplicationTrxLinesProcessor implements ITrxItemChunkProcessor<I_EXP_ReplicationTrxLine, IReplicationTrxLinesProcessorResult>
{
Expand All @@ -49,9 +49,8 @@ public class ReplicationTrxLinesProcessor implements ITrxItemChunkProcessor<I_EX

private List<I_EXP_ReplicationTrxLine> currentTrxLines;

public void setParams(final IReplicationIssueSolverParams params)
public void setParams(@NonNull final IReplicationIssueSolverParams params)
{
Check.assumeNotNull(params, "params not null");
this.params = params;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.Iterator;
import java.util.Map;

import org.adempiere.ad.dao.ICompositeQueryUpdater;
import org.adempiere.ad.dao.IQueryBL;
import org.adempiere.ad.dao.IQueryBuilder;
import org.adempiere.ad.trx.api.ITrx;
Expand All @@ -42,7 +43,6 @@
import org.apache.commons.collections4.IteratorUtils;
import org.compiere.SpringContextHolder;

import de.metas.i18n.IMsgBL;
import de.metas.ordercandidate.api.OLCandValidatorService;
import de.metas.process.JavaProcess;
import de.metas.process.ProcessExecutionResult.ShowProcessLogs;
Expand All @@ -65,7 +65,7 @@ public class C_OLCand_Update_IsImportedWithIssues extends JavaProcess
// services
private final OLCandValidatorService olCandValidatorService = SpringContextHolder.instance.getBean(OLCandValidatorService.class);
private final IReplicationIssueSolverBL replicationIssueSolverBL = Services.get(IReplicationIssueSolverBL.class);
private final IMsgBL msgBL = Services.get(IMsgBL.class);
private final IQueryBL queryBL = Services.get(IQueryBL.class);

@Override
protected void prepare()
Expand Down Expand Up @@ -118,13 +118,11 @@ protected String doIt() throws Exception
final IReplicationIssueSolverParams replicationIssueSolverParams = replicationIssueSolverBL.createParams(params);
final IReplicationTrxLinesProcessorResult result = replicationIssueSolverBL.solveReplicationIssues(rplTrx, issueAwareType, issueSolver, replicationIssueSolverParams);

final ICompositeQueryUpdater<I_C_OLCand> updater = queryBL.createCompositeQueryUpdater(I_C_OLCand.class)
.addSetColumnValue(I_C_OLCand.COLUMNNAME_IsImportedWithIssues, false);

// task 08770: each individual line was solved. Now we can flag all OLCands as cleared, so they can all be processed at once.
final IQueryBuilder<I_C_OLCand> queryBuilder = createOLCandQueryBuilder();
queryBuilder
.create()
.updateDirectly()
.addSetColumnValue(I_C_OLCand.COLUMNNAME_IsImportedWithIssues, false)
.execute();
createOLCandQueryBuilder().create().update(updater);

return "@Updated@ #" + result.getReplicationIssueAwareCount();
}
Expand Down Expand Up @@ -171,7 +169,7 @@ private boolean validateReplicationTrx(final Mutable<Integer> candidatesUpdated)

private IQueryBuilder<I_C_OLCand> createOLCandQueryBuilder()
{
final IQueryBuilder<I_C_OLCand> queryBuilder = Services.get(IQueryBL.class).createQueryBuilder(I_C_OLCand.class, getCtx(), get_TrxName())
final IQueryBuilder<I_C_OLCand> queryBuilder = queryBL.createQueryBuilder(I_C_OLCand.class, getCtx(), get_TrxName())
.addOnlyActiveRecordsFilter()
.addEqualsFilter(I_C_OLCand.COLUMNNAME_Processed, false)
.addEqualsFilter(I_C_OLCand.COLUMNNAME_EXP_ReplicationTrx_ID, p_EXP_ReplicationTrx_ID);
Expand Down

0 comments on commit 8fc82c2

Please sign in to comment.