nus-yam/ex-repair huggingface dataset:
Program: 58487
Project: 58487
Buggy source:
/** 
 * This method is used in mobile application. It was in ExpenseController
 * @param request
 * @param response
 * @throws AxelorException
 */
@Transactional public void insertKMExpenses(ActionRequest request,ActionResponse response) throws AxelorException {
  User user=AuthUtils.getUser();
  if (user != null) {
    Expense expense=expenseServiceProvider.get().getOrCreateExpense(user);
    ExpenseLine expenseLine=new ExpenseLine();
    expenseLine.setDistance(new BigDecimal(request.getData().get("String_Node_Str").toString()));
    expenseLine.setFromCity(request.getData().get("String_Node_Str").toString());
    expenseLine.setToCity(request.getData().get("String_Node_Str").toString());
    expenseLine.setKilometricTypeSelect(new Integer(request.getData().get("String_Node_Str").toString()));
    expenseLine.setComments(request.getData().get("String_Node_Str").toString());
    expenseLine.setExpenseDate(LocalDate.parse(request.getData().get("String_Node_Str").toString()));
    Employee employee=user.getEmployee();
    if (employee != null) {
      expenseLine.setKilometricAllowParam(expenseServiceProvider.get().getListOfKilometricAllowParamVehicleFilter(expenseLine).get(0));
      expenseLine.setTotalAmount(Beans.get(KilometricService.class).computeKilometricExpense(expenseLine,employee));
      expenseLine.setUntaxedAmount(expenseLine.getTotalAmount());
    }
    expense.addGeneralExpenseLineListItem(expenseLine);
    Beans.get(ExpenseRepository.class).save(expense);
  }
}

Fixed version (ground truth):
/** 
 * This method is used in mobile application. It was in ExpenseController
 * @param request
 * @param response
 * @throws AxelorException
 */
@Transactional public void insertKMExpenses(ActionRequest request,ActionResponse response) throws AxelorException {
  User user=AuthUtils.getUser();
  if (user != null) {
    Expense expense=Beans.get(ExpenseService.class).getOrCreateExpense(user);
    ExpenseLine expenseLine=new ExpenseLine();
    expenseLine.setDistance(new BigDecimal(request.getData().get("String_Node_Str").toString()));
    expenseLine.setFromCity(request.getData().get("String_Node_Str").toString());
    expenseLine.setToCity(request.getData().get("String_Node_Str").toString());
    expenseLine.setKilometricTypeSelect(new Integer(request.getData().get("String_Node_Str").toString()));
    expenseLine.setComments(request.getData().get("String_Node_Str").toString());
    expenseLine.setExpenseDate(LocalDate.parse(request.getData().get("String_Node_Str").toString()));
    Employee employee=user.getEmployee();
    if (employee != null) {
      expenseLine.setKilometricAllowParam(Beans.get(ExpenseService.class).getListOfKilometricAllowParamVehicleFilter(expenseLine).get(0));
      expenseLine.setTotalAmount(Beans.get(KilometricService.class).computeKilometricExpense(expenseLine,employee));
      expenseLine.setUntaxedAmount(expenseLine.getTotalAmount());
    }
    expense.addGeneralExpenseLineListItem(expenseLine);
    Beans.get(ExpenseRepository.class).save(expense);
  }
}
Program: 58488
Project: 58488
Buggy source:
@Transactional public void insertTSLine(ActionRequest request,ActionResponse response){
  User user=AuthUtils.getUser();
  Project project=Beans.get(ProjectRepository.class).find(new Long(request.getData().get("String_Node_Str").toString()));
  Product product=Beans.get(ProductRepository.class).find(new Long(request.getData().get("String_Node_Str").toString()));
  LocalDate date=LocalDate.parse(request.getData().get("String_Node_Str").toString(),DateTimeFormatter.ISO_DATE);
  TimesheetRepository timesheetRepository=Beans.get(TimesheetRepository.class);
  TimesheetService timesheetService=Beans.get(TimesheetService.class);
  if (user != null) {
    Timesheet timesheet=timesheetRepository.all().filter("String_Node_Str",user.getId()).order("String_Node_Str").fetchOne();
    if (timesheet == null) {
      timesheet=timesheetService.createTimesheet(user,date,date);
    }
    BigDecimal hours=new BigDecimal(request.getData().get("String_Node_Str").toString());
    TimesheetLine line=timesheetService.createTimesheetLine(project,product,user,date,timesheet,hours,request.getData().get("String_Node_Str").toString());
    timesheetRepository.save(timesheet);
    response.setTotal(1);
    HashMap<String,Object> data=new HashMap<>();
    data.put("String_Node_Str",line.getId());
    response.setData(data);
  }
}

Fixed version (ground truth):
@Transactional public void insertTSLine(ActionRequest request,ActionResponse response){
  User user=AuthUtils.getUser();
  Project project=Beans.get(ProjectRepository.class).find(new Long(request.getData().get("String_Node_Str").toString()));
  Product product=Beans.get(ProductRepository.class).find(new Long(request.getData().get("String_Node_Str").toString()));
  LocalDate date=LocalDate.parse(request.getData().get("String_Node_Str").toString(),DateTimeFormatter.ISO_DATE);
  TimesheetRepository timesheetRepository=Beans.get(TimesheetRepository.class);
  TimesheetService timesheetService=Beans.get(TimesheetService.class);
  if (user != null) {
    Timesheet timesheet=timesheetRepository.all().filter("String_Node_Str",user.getId()).order("String_Node_Str").fetchOne();
    if (timesheet == null) {
      timesheet=Beans.get(TimesheetService.class).createTimesheet(user,date,date);
    }
    BigDecimal hours=new BigDecimal(request.getData().get("String_Node_Str").toString());
    TimesheetLine line=Beans.get(TimesheetService.class).createTimesheetLine(project,product,user,date,timesheet,hours,request.getData().get("String_Node_Str").toString());
    Beans.get(TimesheetRepository.class).save(timesheet);
    response.setTotal(1);
    HashMap<String,Object> data=new HashMap<>();
    data.put("String_Node_Str",line.getId());
    response.setData(data);
  }
}
Program: 58491
Project: 58491
Buggy source:
/** 
 * This method is used in mobile application. It was in ExpenseController
 * @param request
 * @param response
 * @throws AxelorException
 */
public void removeLines(ActionRequest request,ActionResponse response){
  Expense expense=request.getContext().asType(Expense.class);
  List<ExpenseLine> expenseLineList=expenseServiceProvider.get().getExpenseLineList(expense);
  try {
    if (expenseLineList != null && !expenseLineList.isEmpty()) {
      Iterator<ExpenseLine> expenseLineIter=expenseLineList.iterator();
      while (expenseLineIter.hasNext()) {
        ExpenseLine generalExpenseLine=expenseLineIter.next();
        if (generalExpenseLine.getKilometricExpense() != null && (expense.getKilometricExpenseLineList() != null && !expense.getKilometricExpenseLineList().contains(generalExpenseLine) || expense.getKilometricExpenseLineList() == null)) {
          expenseLineIter.remove();
        }
      }
    }
  }
 catch (  Exception e) {
    TraceBackService.trace(response,e);
  }
  response.setValue("String_Node_Str",expenseLineList);
}

Fixed version (ground truth):
/** 
 * This method is used in mobile application. It was in ExpenseController
 * @param request
 * @param response
 * @throws AxelorException
 */
public void removeLines(ActionRequest request,ActionResponse response){
  Expense expense=request.getContext().asType(Expense.class);
  List<ExpenseLine> expenseLineList=Beans.get(ExpenseService.class).getExpenseLineList(expense);
  try {
    if (expenseLineList != null && !expenseLineList.isEmpty()) {
      Iterator<ExpenseLine> expenseLineIter=expenseLineList.iterator();
      while (expenseLineIter.hasNext()) {
        ExpenseLine generalExpenseLine=expenseLineIter.next();
        if (generalExpenseLine.getKilometricExpense() != null && (expense.getKilometricExpenseLineList() != null && !expense.getKilometricExpenseLineList().contains(generalExpenseLine) || expense.getKilometricExpenseLineList() == null)) {
          expenseLineIter.remove();
        }
      }
    }
  }
 catch (  Exception e) {
    TraceBackService.trace(response,e);
  }
  response.setValue("String_Node_Str",expenseLineList);
}
Program: 58493
Project: 58493
Buggy source:
@Override protected void _computeHumanResourceCost(ProdHumanResource prodHumanResource,int priority,int bomLevel,CostSheetLine parentCostSheetLine) throws AxelorException {
  Employee employee=prodHumanResource.getEmployee();
  if (employee != null) {
    BigDecimal durationHours=new BigDecimal(prodHumanResource.getDuration() / 3600);
    costSheet.addCostSheetLineListItem(costSheetLineService.createWorkCenterCostSheetLine(prodHumanResource.getWorkCenter(),priority,bomLevel,parentCostSheetLine,durationHours,employee.getHourlyRate().multiply(durationHours),hourUnit));
  }
 else {
    super._computeHumanResourceCost(prodHumanResource,priority,bomLevel,parentCostSheetLine);
  }
}

Fixed version (ground truth):
@Override protected void _computeHumanResourceCost(ProdHumanResource prodHumanResource,int priority,int bomLevel,CostSheetLine parentCostSheetLine) throws AxelorException {
  Employee employee=prodHumanResource.getEmployee();
  if (employee != null) {
    BigDecimal durationHours=new BigDecimal(prodHumanResource.getDuration()).divide(BigDecimal.valueOf(3600),appProductionService.getNbDecimalDigitForUnitPrice(),BigDecimal.ROUND_HALF_EVEN);
    costSheet.addCostSheetLineListItem(costSheetLineService.createWorkCenterCostSheetLine(prodHumanResource.getWorkCenter(),priority,bomLevel,parentCostSheetLine,durationHours,employee.getHourlyRate().multiply(durationHours),hourUnit));
  }
 else {
    super._computeHumanResourceCost(prodHumanResource,priority,bomLevel,parentCostSheetLine);
  }
}
Program: 58494
Project: 58494
Buggy source:
public CostSheetLine createConsumedProductWasteCostSheetLine(Product product,Unit unit,int bomLevel,CostSheetLine parentCostSheetLine,BigDecimal consumptionQty,BigDecimal wasteRate) throws AxelorException {
  BigDecimal qty=consumptionQty.multiply(wasteRate).divide(new BigDecimal("String_Node_Str"));
  BigDecimal costPrice=unitConversionService.convert(product.getUnit(),unit,product.getCostPrice().multiply(qty));
  return this.createCostSheetLine(product.getName(),product.getCode(),bomLevel,qty.setScale(appProductionService.getNbDecimalDigitForBomQty(),RoundingMode.HALF_EVEN),costPrice.setScale(appProductionService.getNbDecimalDigitForUnitPrice(),RoundingMode.HALF_EVEN),product.getCostSheetGroup(),product,CostSheetLineRepository.TYPE_CONSUMED_PRODUCT_WASTE,unit,null,parentCostSheetLine);
}

Fixed version (ground truth):
public CostSheetLine createConsumedProductWasteCostSheetLine(Product product,Unit unit,int bomLevel,CostSheetLine parentCostSheetLine,BigDecimal consumptionQty,BigDecimal wasteRate) throws AxelorException {
  BigDecimal qty=consumptionQty.multiply(wasteRate).divide(new BigDecimal("String_Node_Str"),appProductionService.getNbDecimalDigitForBomQty(),BigDecimal.ROUND_HALF_EVEN);
  BigDecimal costPrice=unitConversionService.convert(product.getUnit(),unit,product.getCostPrice().multiply(qty));
  return this.createCostSheetLine(product.getName(),product.getCode(),bomLevel,qty.setScale(appProductionService.getNbDecimalDigitForBomQty(),RoundingMode.HALF_EVEN),costPrice.setScale(appProductionService.getNbDecimalDigitForUnitPrice(),RoundingMode.HALF_EVEN),product.getCostSheetGroup(),product,CostSheetLineRepository.TYPE_CONSUMED_PRODUCT_WASTE,unit,null,parentCostSheetLine);
}
Program: 58495
Project: 58495
Buggy source:
protected void _computeMachineCost(ProdProcessLine prodProcessLine,BigDecimal producedQty,Unit pieceUnit,int bomLevel,CostSheetLine parentCostSheetLine){
  WorkCenter workCenter=prodProcessLine.getWorkCenter();
  int costType=workCenter.getCostTypeSelect();
  if (costType == IWorkCenter.COST_PER_CYCLE) {
    costSheetLineService.createWorkCenterCostSheetLine(workCenter,prodProcessLine.getPriority(),bomLevel,parentCostSheetLine,this.getNbCycle(producedQty,prodProcessLine.getMaxCapacityPerCycle()),workCenter.getCostAmount(),cycleUnit);
  }
 else   if (costType == IWorkCenter.COST_PER_HOUR) {
    BigDecimal qty=new BigDecimal(prodProcessLine.getDurationPerCycle()).divide(new BigDecimal(3600),appProductionService.getNbDecimalDigitForUnitPrice(),BigDecimal.ROUND_HALF_EVEN).multiply(this.getNbCycle(producedQty,prodProcessLine.getMaxCapacityPerCycle()));
    BigDecimal costPrice=workCenter.getCostAmount().multiply(qty);
    costSheetLineService.createWorkCenterCostSheetLine(workCenter,prodProcessLine.getPriority(),bomLevel,parentCostSheetLine,qty,costPrice,hourUnit);
  }
 else   if (costType == IWorkCenter.COST_PER_PIECE) {
    BigDecimal costPrice=workCenter.getCostAmount().multiply(producedQty);
    costSheetLineService.createWorkCenterCostSheetLine(workCenter,prodProcessLine.getPriority(),bomLevel,parentCostSheetLine,producedQty,costPrice,pieceUnit);
  }
}

Fixed version (ground truth):
protected void _computeMachineCost(ProdProcessLine prodProcessLine,BigDecimal producedQty,Unit pieceUnit,int bomLevel,CostSheetLine parentCostSheetLine){
  WorkCenter workCenter=prodProcessLine.getWorkCenter();
  int costType=workCenter.getCostTypeSelect();
  if (costType == IWorkCenter.COST_PER_CYCLE) {
    costSheetLineService.createWorkCenterCostSheetLine(workCenter,prodProcessLine.getPriority(),bomLevel,parentCostSheetLine,this.getNbCycle(producedQty,prodProcessLine.getMaxCapacityPerCycle()),workCenter.getCostAmount(),cycleUnit);
  }
 else   if (costType == IWorkCenter.COST_PER_HOUR) {
    BigDecimal qty=new BigDecimal(prodProcessLine.getDurationPerCycle()).divide(new BigDecimal(3600),appProductionService.getNbDecimalDigitForUnitPrice(),BigDecimal.ROUND_HALF_EVEN).multiply(this.getNbCycle(producedQty,prodProcessLine.getMaxCapacityPerCycle()));
    qty=qty.setScale(QTY_MAX_SCALE,BigDecimal.ROUND_HALF_EVEN);
    BigDecimal costPrice=workCenter.getCostAmount().multiply(qty);
    costSheetLineService.createWorkCenterCostSheetLine(workCenter,prodProcessLine.getPriority(),bomLevel,parentCostSheetLine,qty,costPrice,hourUnit);
  }
 else   if (costType == IWorkCenter.COST_PER_PIECE) {
    BigDecimal costPrice=workCenter.getCostAmount().multiply(producedQty);
    costSheetLineService.createWorkCenterCostSheetLine(workCenter,prodProcessLine.getPriority(),bomLevel,parentCostSheetLine,producedQty,costPrice,pieceUnit);
  }
}
Program: 58496
Project: 58496
Buggy source:
private static long daysBetween(LocalDate date1,LocalDate date2){
  if (date2.isBefore(date1)) {
    return Duration.between(date1,date2).toDays() - 1;
  }
 else {
    return Duration.between(date1,date2).toDays() + 1;
  }
}

Fixed version (ground truth):
private static long daysBetween(LocalDate date1,LocalDate date2){
  if (date2.isBefore(date1)) {
    return DAYS.between(date1,date2) - 1;
  }
 else {
    return DAYS.between(date1,date2) + 1;
  }
}
Program: 58498
Project: 58498
Buggy source:
@Override protected void configure(){
  install(new JpaModule("String_Node_Str",true,true));
  install(new AuthModule());
}

Fixed version (ground truth):
@Override protected void configure(){
  install(new JpaModule("String_Node_Str",true,true));
}
Program: 58499
Project: 58499
Buggy source:
public Associations getAssociations(){
  return associations;
}

Fixed version (ground truth):
public Associations getAssociations(){
  if (isVirtual() && associations.getAdditionalEntries() != null) {
    for (ListIterator<Element> it=associations.getAdditionalEntries().listIterator(); it.hasNext(); ) {
      if (PRODUCT_BUNDLE_TAG.equals(it.next().getTagName())) {
        it.remove();
        break;
      }
    }
  }
  return associations;
}
Program: 58500
Project: 58500
Buggy source:
@Override @Transactional protected void process(){
  try {
    PrestaShopBatch prestaShopBatch=(PrestaShopBatch)model;
    Integer size=prestaShopBatch.getBatchList().size();
    Batch batchObj;
    if (size == 1) {
      batchObj=prestaShopServiceExport.exportPrestShop(null,batch);
    }
 else {
      ZonedDateTime endDate=prestaShopBatch.getBatchList().get(size - 2).getEndDate();
      batchObj=prestaShopServiceExport.exportPrestShop(endDate,batch);
    }
    batchRepo.save(batchObj);
  }
 catch (  Exception e) {
    incrementAnomaly();
    LOG.error("String_Node_Str",batch.getId());
  }
}

Fixed version (ground truth):
@Override @Transactional protected void process(){
  try {
    PrestaShopBatch prestaShopBatch=(PrestaShopBatch)model;
    Integer size=prestaShopBatch.getBatchList().size();
    ZonedDateTime fromDate=(size <= 1 ? null : prestaShopBatch.getBatchList().get(size - 2).getStartDate());
    batchRepo.save(prestaShopServiceExport.exportPrestShop(fromDate,batch));
    incrementDone();
  }
 catch (  Exception e) {
    incrementAnomaly();
    LOG.error("String_Node_Str",batch.getId());
  }
}
Program: 58501
Project: 58501
Buggy source:
public void runCalculation(ActionRequest request,ActionResponse response){
  Mrp mrp=request.getContext().asType(Mrp.class);
  try {
    mrpService.runCalculation(mrpRepository.find(mrp.getId()));
  }
 catch (  Exception e) {
    TraceBackService.trace(response,e);
    mrpService.reset(mrpRepository.find(mrp.getId()));
  }
 finally {
    response.setReload(true);
  }
}

Fixed version (ground truth):
public void runCalculation(ActionRequest request,ActionResponse response){
  Mrp mrp=request.getContext().asType(Mrp.class);
  MrpService mrpService=mrpServiceProvider.get();
  MrpRepository mrpRepository=mrpRepositoryProvider.get();
  try {
    mrpService.runCalculation(mrpRepository.find(mrp.getId()));
  }
 catch (  Exception e) {
    TraceBackService.trace(response,e);
    mrpService.reset(mrpRepository.find(mrp.getId()));
  }
 finally {
    response.setReload(true);
  }
}
Program: 58502
Project: 58502
Buggy source:
public void generateAllProposals(ActionRequest request,ActionResponse response) throws AxelorException {
  Mrp mrp=request.getContext().asType(Mrp.class);
  mrpService.generateProposals(mrpRepository.find(mrp.getId()));
  response.setReload(true);
}

Fixed version (ground truth):
public void generateAllProposals(ActionRequest request,ActionResponse response) throws AxelorException {
  Mrp mrp=request.getContext().asType(Mrp.class);
  MrpService mrpService=mrpServiceProvider.get();
  MrpRepository mrpRepository=mrpRepositoryProvider.get();
  mrpService.generateProposals(mrpRepository.find(mrp.getId()));
  response.setReload(true);
}
Program: 58503
Project: 58503
Buggy source:
/** 
 * Prints the weekly breakdown MRP birt report and shows it to the user.
 * @param request
 * @param response
 */
public void printWeeks(ActionRequest request,ActionResponse response){
  Mrp mrp=request.getContext().asType(Mrp.class);
  mrp=mrpRepository.find(mrp.getId());
  String name=I18n.get("String_Node_Str") + "String_Node_Str" + mrp.getId();
  try {
    String fileLink=ReportFactory.createReport(IReport.MRP_WEEKS,name).addParam("String_Node_Str",mrp.getId()).addParam("String_Node_Str",ReportSettings.getPrintingLocale(null)).addParam("String_Node_Str",mrpService.findMrpEndDate(mrp).atStartOfDay().toString()).addFormat(ReportSettings.FORMAT_PDF).generate().getFileLink();
    response.setView(ActionView.define(name).add("String_Node_Str",fileLink).map());
  }
 catch (  Exception e) {
    TraceBackService.trace(response,e);
  }
}

Fixed version (ground truth):
/** 
 * Prints the weekly breakdown MRP birt report and shows it to the user.
 * @param request
 * @param response
 */
public void printWeeks(ActionRequest request,ActionResponse response){
  Mrp mrp=request.getContext().asType(Mrp.class);
  MrpService mrpService=mrpServiceProvider.get();
  MrpRepository mrpRepository=mrpRepositoryProvider.get();
  mrp=mrpRepository.find(mrp.getId());
  String name=I18n.get("String_Node_Str") + "String_Node_Str" + mrp.getId();
  try {
    String fileLink=ReportFactory.createReport(IReport.MRP_WEEKS,name).addParam("String_Node_Str",mrp.getId()).addParam("String_Node_Str",ReportSettings.getPrintingLocale(null)).addParam("String_Node_Str",mrpService.findMrpEndDate(mrp).atStartOfDay().toString()).addFormat(ReportSettings.FORMAT_PDF).generate().getFileLink();
    response.setView(ActionView.define(name).add("String_Node_Str",fileLink).map());
  }
 catch (  Exception e) {
    TraceBackService.trace(response,e);
  }
}
Program: 58504
Project: 58504
Buggy source:
protected void _computeToConsumeProduct(BillOfMaterial billOfMaterial,int bomLevel,CostSheetLine parentCostSheetLine) throws AxelorException {
  if (billOfMaterial.getBillOfMaterialSet() != null) {
    for (    BillOfMaterial billOfMaterialLine : billOfMaterial.getBillOfMaterialSet()) {
      Product product=billOfMaterialLine.getProduct();
      if (product != null) {
        CostSheetLine costSheetLine=costSheetLineService.createConsumedProductCostSheetLine(product,billOfMaterialLine.getUnit(),bomLevel,parentCostSheetLine,billOfMaterialLine.getQty());
        BigDecimal wasteRate=billOfMaterialLine.getWasteRate();
        if (wasteRate != null && wasteRate.compareTo(BigDecimal.ZERO) > 0) {
          costSheetLineService.createConsumedProductWasteCostSheetLine(product,billOfMaterialLine.getUnit(),bomLevel,parentCostSheetLine,billOfMaterialLine.getQty(),wasteRate);
        }
        if (!billOfMaterialLine.getDefineSubBillOfMaterial()) {
          this._computeCostPrice(billOfMaterialLine,bomLevel,costSheetLine);
        }
      }
    }
  }
}

Fixed version (ground truth):
protected void _computeToConsumeProduct(BillOfMaterial billOfMaterial,int bomLevel,CostSheetLine parentCostSheetLine) throws AxelorException {
  if (billOfMaterial.getBillOfMaterialSet() != null) {
    for (    BillOfMaterial billOfMaterialLine : billOfMaterial.getBillOfMaterialSet()) {
      Product product=billOfMaterialLine.getProduct();
      if (product != null) {
        CostSheetLine costSheetLine=costSheetLineService.createConsumedProductCostSheetLine(product,billOfMaterialLine.getUnit(),bomLevel,parentCostSheetLine,billOfMaterialLine.getQty());
        BigDecimal wasteRate=billOfMaterialLine.getWasteRate();
        if (wasteRate != null && wasteRate.compareTo(BigDecimal.ZERO) > 0) {
          costSheetLineService.createConsumedProductWasteCostSheetLine(product,billOfMaterialLine.getUnit(),bomLevel,parentCostSheetLine,billOfMaterialLine.getQty(),wasteRate);
        }
        if (billOfMaterialLine.getDefineSubBillOfMaterial()) {
          this._computeCostPrice(billOfMaterialLine,bomLevel,costSheetLine);
        }
      }
    }
  }
}
Program: 58505
Project: 58505
Buggy source:
@Override public String getStockMoveLineDomain(LogisticalFormLine logisticalFormLine){
  long partnerId=0;
  List<String> domainList=new ArrayList<>();
  LogisticalForm logisticalForm=logisticalFormLine.getLogisticalForm();
  if (logisticalForm != null) {
    Partner deliverToCustomerPartner=logisticalForm.getDeliverToCustomerPartner();
    if (deliverToCustomerPartner != null) {
      partnerId=deliverToCustomerPartner.getId();
    }
  }
  domainList.add(String.format("String_Node_Str",partnerId));
  domainList.add(String.format("String_Node_Str",StockMoveRepository.TYPE_OUTGOING));
  domainList.add(String.format("String_Node_Str",StockMoveRepository.STATUS_PLANNED));
  domainList.add("String_Node_Str");
  domainList.add("String_Node_Str");
  List<StockMoveLine> fullySpreadStockMoveLineList=Beans.get(LogisticalFormService.class).getFullySpreadStockMoveLineList(logisticalForm);
  if (!fullySpreadStockMoveLineList.isEmpty()) {
    String idListString=StringTool.getIdListString(fullySpreadStockMoveLineList);
    domainList.add(String.format("String_Node_Str",idListString));
  }
  return domainList.stream().map(domain -> String.format("String_Node_Str",domain)).collect(Collectors.joining("String_Node_Str"));
}

Fixed version (ground truth):
@Override public String getStockMoveLineDomain(LogisticalFormLine logisticalFormLine){
  long partnerId=0;
  List<String> domainList=new ArrayList<>();
  LogisticalForm logisticalForm=logisticalFormLine.getLogisticalForm();
  if (logisticalForm != null) {
    Partner deliverToCustomerPartner=logisticalForm.getDeliverToCustomerPartner();
    if (deliverToCustomerPartner != null) {
      partnerId=deliverToCustomerPartner.getId();
    }
  }
  domainList.add(String.format("String_Node_Str",partnerId));
  domainList.add(String.format("String_Node_Str",StockMoveRepository.TYPE_OUTGOING));
  domainList.add(String.format("String_Node_Str",StockMoveRepository.STATUS_PLANNED,StockMoveRepository.STATUS_REALIZED));
  domainList.add("String_Node_Str");
  domainList.add("String_Node_Str");
  List<StockMoveLine> fullySpreadStockMoveLineList=Beans.get(LogisticalFormService.class).getFullySpreadStockMoveLineList(logisticalForm);
  if (!fullySpreadStockMoveLineList.isEmpty()) {
    String idListString=StringTool.getIdListString(fullySpreadStockMoveLineList);
    domainList.add(String.format("String_Node_Str",idListString));
  }
  return domainList.stream().map(domain -> String.format("String_Node_Str",domain)).collect(Collectors.joining("String_Node_Str"));
}
Program: 58506
Project: 58506
Buggy source:
@Override public void createToProduceProdProductList(ManufOrder manufOrder){
  BigDecimal manufOrderQty=manufOrder.getQty();
  BillOfMaterial billOfMaterial=manufOrder.getBillOfMaterial();
  BigDecimal qty=billOfMaterial.getQty().multiply(manufOrderQty).setScale(appProductionService.getNbDecimalDigitForBomQty(),RoundingMode.HALF_EVEN);
  manufOrder.addToProduceProdProductListItem(new ProdProduct(manufOrder.getProduct(),billOfMaterial.getQty().multiply(manufOrderQty),billOfMaterial.getUnit()));
  if (appProductionService.getAppProduction().getManageResidualProductOnBom() && billOfMaterial.getProdResidualProductList() != null) {
    for (    ProdResidualProduct prodResidualProduct : billOfMaterial.getProdResidualProductList()) {
      Product product=productVariantService.getProductVariant(manufOrder.getProduct(),prodResidualProduct.getProduct());
      qty=prodResidualProduct.getQty().multiply(manufOrderQty).setScale(appProductionService.getNbDecimalDigitForBomQty(),RoundingMode.HALF_EVEN);
      manufOrder.addToProduceProdProductListItem(new ProdProduct(product,qty,prodResidualProduct.getUnit()));
    }
  }
}

Fixed version (ground truth):
@Override public void createToProduceProdProductList(ManufOrder manufOrder){
  BigDecimal manufOrderQty=manufOrder.getQty();
  BillOfMaterial billOfMaterial=manufOrder.getBillOfMaterial();
  BigDecimal qty=billOfMaterial.getQty().multiply(manufOrderQty).setScale(2,RoundingMode.HALF_EVEN);
  manufOrder.addToProduceProdProductListItem(new ProdProduct(manufOrder.getProduct(),qty,billOfMaterial.getUnit()));
  if (appProductionService.getAppProduction().getManageResidualProductOnBom() && billOfMaterial.getProdResidualProductList() != null) {
    for (    ProdResidualProduct prodResidualProduct : billOfMaterial.getProdResidualProductList()) {
      Product product=productVariantService.getProductVariant(manufOrder.getProduct(),prodResidualProduct.getProduct());
      qty=prodResidualProduct.getQty().multiply(manufOrderQty).setScale(appProductionService.getNbDecimalDigitForBomQty(),RoundingMode.HALF_EVEN);
      manufOrder.addToProduceProdProductListItem(new ProdProduct(product,qty,prodResidualProduct.getUnit()));
    }
  }
}
Program: 58507
Project: 58507
Buggy source:
@Override @Transactional(rollbackOn={AxelorException.class,Exception.class}) public ManufOrder generateManufOrder(Product product,BigDecimal qtyRequested,int priority,boolean isToInvoice,BillOfMaterial billOfMaterial,LocalDateTime plannedStartDateT) throws AxelorException {
  if (billOfMaterial == null) {
    billOfMaterial=this.getBillOfMaterial(product);
  }
  Company company=billOfMaterial.getCompany();
  BigDecimal qty=qtyRequested.divide(billOfMaterial.getQty());
  ManufOrder manufOrder=this.createManufOrder(product,qty,priority,IS_TO_INVOICE,company,billOfMaterial,plannedStartDateT);
  manufOrder=manufOrderWorkflowService.plan(manufOrder);
  return manufOrderRepo.save(manufOrder);
}

Fixed version (ground truth):
@Override @Transactional(rollbackOn={AxelorException.class,Exception.class}) public ManufOrder generateManufOrder(Product product,BigDecimal qtyRequested,int priority,boolean isToInvoice,BillOfMaterial billOfMaterial,LocalDateTime plannedStartDateT) throws AxelorException {
  if (billOfMaterial == null) {
    billOfMaterial=this.getBillOfMaterial(product);
  }
  Company company=billOfMaterial.getCompany();
  BigDecimal qty=qtyRequested.divide(billOfMaterial.getQty(),2,RoundingMode.HALF_EVEN);
  ManufOrder manufOrder=this.createManufOrder(product,qty,priority,IS_TO_INVOICE,company,billOfMaterial,plannedStartDateT);
  manufOrder=manufOrderWorkflowService.plan(manufOrder);
  return manufOrderRepo.save(manufOrder);
}
Program: 58508
Project: 58508
Buggy source:
@Override public void createToConsumeProdProductList(ManufOrder manufOrder){
  BigDecimal manufOrderQty=manufOrder.getQty();
  BillOfMaterial billOfMaterial=manufOrder.getBillOfMaterial();
  if (billOfMaterial.getBillOfMaterialSet() != null) {
    for (    BillOfMaterial billOfMaterialLine : billOfMaterial.getBillOfMaterialSet()) {
      if (!billOfMaterialLine.getHasNoManageStock()) {
        Product product=productVariantService.getProductVariant(manufOrder.getProduct(),billOfMaterialLine.getProduct());
        BigDecimal qty=billOfMaterialLine.getQty().multiply(manufOrderQty).setScale(appProductionService.getNbDecimalDigitForBomQty(),RoundingMode.HALF_EVEN);
        manufOrder.addToConsumeProdProductListItem(new ProdProduct(product,qty,billOfMaterialLine.getUnit()));
      }
    }
  }
}

Fixed version (ground truth):
@Override public void createToConsumeProdProductList(ManufOrder manufOrder){
  BigDecimal manufOrderQty=manufOrder.getQty();
  BillOfMaterial billOfMaterial=manufOrder.getBillOfMaterial();
  if (billOfMaterial.getBillOfMaterialSet() != null) {
    for (    BillOfMaterial billOfMaterialLine : billOfMaterial.getBillOfMaterialSet()) {
      if (!billOfMaterialLine.getHasNoManageStock()) {
        Product product=productVariantService.getProductVariant(manufOrder.getProduct(),billOfMaterialLine.getProduct());
        BigDecimal qty=billOfMaterialLine.getQty().multiply(manufOrderQty).setScale(2,RoundingMode.HALF_EVEN);
        manufOrder.addToConsumeProdProductListItem(new ProdProduct(product,qty,billOfMaterialLine.getUnit()));
      }
    }
  }
}
Program: 58509
Project: 58509
Buggy source:
/** 
 * Function returning both the paymentMode and the paymentCondition
 * @param request
 * @param response
 */
public void fillPaymentModeAndCondition(ActionRequest request,ActionResponse response){
  Invoice invoice=request.getContext().asType(Invoice.class);
  try {
    PaymentMode paymentMode=InvoiceToolService.getPaymentMode(invoice);
    PaymentCondition paymentCondition=InvoiceToolService.getPaymentCondition(invoice);
    response.setValue("String_Node_Str",paymentMode);
    response.setValue("String_Node_Str",paymentCondition);
  }
 catch (  Exception e) {
    TraceBackService.trace(response,e);
  }
}

Fixed version (ground truth):
/** 
 * Function returning both the paymentMode and the paymentCondition
 * @param request
 * @param response
 */
public void fillPaymentModeAndCondition(ActionRequest request,ActionResponse response){
  Invoice invoice=request.getContext().asType(Invoice.class);
  if (invoice.getOperationTypeSelect() != null) {
    try {
      PaymentMode paymentMode=InvoiceToolService.getPaymentMode(invoice);
      PaymentCondition paymentCondition=InvoiceToolService.getPaymentCondition(invoice);
      response.setValue("String_Node_Str",paymentMode);
      response.setValue("String_Node_Str",paymentCondition);
    }
 catch (    Exception e) {
      TraceBackService.trace(response,e);
    }
  }
}
Program: 58510
Project: 58510
Buggy source:
@Inject public BankOrderServiceHRImpl(BankOrderRepository bankOrderRepo,InvoicePaymentRepository invoicePaymentRepo,BankOrderLineService bankOrderLineService,EbicsService ebicsService,InvoicePaymentToolService invoicePaymentToolService){
  super(bankOrderRepo,invoicePaymentRepo,bankOrderLineService,ebicsService,invoicePaymentToolService);
}

Fixed version (ground truth):
@Inject public BankOrderServiceHRImpl(BankOrderRepository bankOrderRepo,InvoicePaymentRepository invoicePaymentRepo,BankOrderLineService bankOrderLineService,EbicsService ebicsService,InvoicePaymentToolService invoicePaymentToolService,AccountConfigBankPaymentService accountConfigBankPaymentService,SequenceService sequenceService){
  super(bankOrderRepo,invoicePaymentRepo,bankOrderLineService,ebicsService,invoicePaymentToolService,accountConfigBankPaymentService,sequenceService);
}
Program: 58511
Project: 58511
Buggy source:
/** 
 * Check and raise an exception if the provided stock move is involved in an ongoing inventory.
 * @param stockMove
 * @throws AxelorException
 */
private void checkOngoingInventory(StockMove stockMove) throws AxelorException {
  List<StockLocation> stockLocationList=new ArrayList<>();
  if (stockMove.getFromStockLocation().getTypeSelect() != StockLocationRepository.TYPE_VIRTUAL) {
    stockLocationList.add(stockMove.getFromStockLocation());
  }
  if (stockMove.getToStockLocation().getTypeSelect() != StockLocationRepository.TYPE_VIRTUAL) {
    stockLocationList.add(stockMove.getToStockLocation());
  }
  if (stockLocationList.isEmpty()) {
    return;
  }
  List<Product> productList=stockMove.getStockMoveLineList().stream().map(StockMoveLine::getProduct).collect(Collectors.toList());
  if (productList.isEmpty()) {
    return;
  }
  InventoryLineRepository inventoryLineRepo=Beans.get(InventoryLineRepository.class);
  InventoryLine inventoryLine=inventoryLineRepo.all().filter("String_Node_Str" + "String_Node_Str" + "String_Node_Str").bind("String_Node_Str",InventoryRepository.STATUS_IN_PROGRESS).bind("String_Node_Str",InventoryRepository.STATUS_COMPLETED).bind("String_Node_Str",stockLocationList).bind("String_Node_Str",productList).fetchOne();
  if (inventoryLine != null) {
    throw new AxelorException(inventoryLine,IException.INCONSISTENCY,I18n.get(IExceptionMessage.STOCK_MOVE_19),inventoryLine.getInventory().getInventorySeq());
  }
}

Fixed version (ground truth):
/** 
 * Check and raise an exception if the provided stock move is involved in an ongoing inventory.
 * @param stockMove
 * @throws AxelorException
 */
private void checkOngoingInventory(StockMove stockMove) throws AxelorException {
  List<StockLocation> stockLocationList=new ArrayList<>();
  if (stockMove.getFromStockLocation().getTypeSelect() != StockLocationRepository.TYPE_VIRTUAL) {
    stockLocationList.add(stockMove.getFromStockLocation());
  }
  if (stockMove.getToStockLocation().getTypeSelect() != StockLocationRepository.TYPE_VIRTUAL) {
    stockLocationList.add(stockMove.getToStockLocation());
  }
  if (stockLocationList.isEmpty()) {
    return;
  }
  List<Product> productList=stockMove.getStockMoveLineList().stream().map(StockMoveLine::getProduct).filter(Objects::nonNull).collect(Collectors.toList());
  if (productList.isEmpty()) {
    return;
  }
  InventoryLineRepository inventoryLineRepo=Beans.get(InventoryLineRepository.class);
  InventoryLine inventoryLine=inventoryLineRepo.all().filter("String_Node_Str" + "String_Node_Str" + "String_Node_Str").bind("String_Node_Str",InventoryRepository.STATUS_IN_PROGRESS).bind("String_Node_Str",InventoryRepository.STATUS_COMPLETED).bind("String_Node_Str",stockLocationList).bind("String_Node_Str",productList).fetchOne();
  if (inventoryLine != null) {
    throw new AxelorException(inventoryLine,IException.INCONSISTENCY,I18n.get(IExceptionMessage.STOCK_MOVE_19),inventoryLine.getInventory().getInventorySeq());
  }
}
Program: 58512
Project: 58512
Buggy source:
private void computeWeights(StockMove stockMove) throws AxelorException {
  boolean weightsRequired=checkWeightsRequired(stockMove);
  StockConfig stockConfig=stockMove.getCompany().getStockConfig();
  Unit endUnit=stockConfig != null ? stockConfig.getCustomsWeightUnit() : null;
  if (weightsRequired && endUnit == null) {
    throw new AxelorException(stockMove,IException.NO_VALUE,I18n.get(IExceptionMessage.STOCK_MOVE_17));
  }
  List<StockMoveLine> stockMoveLineList=stockMove.getStockMoveLineList();
  if (stockMoveLineList == null) {
    return;
  }
  for (  StockMoveLine stockMoveLine : stockMoveLineList) {
    Product product=stockMoveLine.getProduct();
    if (!ProductRepository.PRODUCT_TYPE_STORABLE.equals(product.getProductTypeSelect())) {
      continue;
    }
    Unit startUnit=product.getWeightUnit();
    BigDecimal netWeight=product.getNetWeight();
    if (startUnit != null && netWeight.compareTo(BigDecimal.ZERO) != 0) {
      UnitConversionService unitConversionService=Beans.get(UnitConversionService.class);
      netWeight=unitConversionService.convert(startUnit,endUnit,netWeight);
      BigDecimal totalNetWeight=netWeight.multiply(stockMoveLine.getRealQty());
      stockMoveLine.setNetWeight(netWeight);
      stockMoveLine.setTotalNetWeight(totalNetWeight);
    }
 else     if (weightsRequired) {
      throw new AxelorException(stockMove,IException.NO_VALUE,I18n.get(IExceptionMessage.STOCK_MOVE_18));
    }
  }
}

Fixed version (ground truth):
private void computeWeights(StockMove stockMove) throws AxelorException {
  boolean weightsRequired=checkWeightsRequired(stockMove);
  StockConfig stockConfig=stockMove.getCompany().getStockConfig();
  Unit endUnit=stockConfig != null ? stockConfig.getCustomsWeightUnit() : null;
  if (weightsRequired && endUnit == null) {
    throw new AxelorException(stockMove,IException.NO_VALUE,I18n.get(IExceptionMessage.STOCK_MOVE_17));
  }
  List<StockMoveLine> stockMoveLineList=stockMove.getStockMoveLineList();
  if (stockMoveLineList == null) {
    return;
  }
  for (  StockMoveLine stockMoveLine : stockMoveLineList) {
    Product product=stockMoveLine.getProduct();
    if (product == null || !ProductRepository.PRODUCT_TYPE_STORABLE.equals(product.getProductTypeSelect())) {
      continue;
    }
    Unit startUnit=product.getWeightUnit();
    BigDecimal netWeight=product.getNetWeight();
    if (startUnit != null && netWeight.compareTo(BigDecimal.ZERO) != 0) {
      UnitConversionService unitConversionService=Beans.get(UnitConversionService.class);
      netWeight=unitConversionService.convert(startUnit,endUnit,netWeight);
      BigDecimal totalNetWeight=netWeight.multiply(stockMoveLine.getRealQty());
      stockMoveLine.setNetWeight(netWeight);
      stockMoveLine.setTotalNetWeight(totalNetWeight);
    }
 else     if (weightsRequired) {
      throw new AxelorException(stockMove,IException.NO_VALUE,I18n.get(IExceptionMessage.STOCK_MOVE_18));
    }
  }
}
Program: 58513
Project: 58513
Buggy source:
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public void updateDebtRecoveryHistory(DebtRecovery debtRecovery,Set<Message> debtRecoveryMessageSet){
  if (!debtRecovery.getDebtRecoveryHistoryList().isEmpty()) {
    debtRecovery.getDebtRecoveryHistoryList().get(debtRecovery.getDebtRecoveryHistoryList().size() - 1).setDebtRecoveryMessageSet(debtRecoveryMessageSet);
  }
}

Fixed version (ground truth):
@Transactional(rollbackOn={AxelorException.class,Exception.class}) public void updateDebtRecoveryHistory(DebtRecovery debtRecovery,Set<Message> debtRecoveryMessageSet){
  if (!debtRecovery.getDebtRecoveryHistoryList().isEmpty()) {
    debtRecovery.getDebtRecoveryHistoryList().sort(Comparator.comparing(debtRecoveryHistory -> debtRecovery.getDebtRecoveryMethodLine().getDebtRecoveryLevel().getName()));
    DebtRecoveryHistory debtRecoveryHistory=debtRecovery.getDebtRecoveryHistoryList().get(debtRecovery.getDebtRecoveryHistoryList().size() - 1);
    debtRecoveryHistory.clearDebtRecoveryMessageSet();
    debtRecoveryMessageSet.forEach(debtRecoveryHistory::addDebtRecoveryMessageSetItem);
  }
}
Program: 58514
Project: 58514
Buggy source:
@Override public Set<Long> getContentLocationIds(Location location){
  List<Location> locations=new ArrayList<Location>();
  locations.add(location);
  locationIdSet.add(location.getId());
  findLocationIds(locations);
  return locationIdSet;
}

Fixed version (ground truth):
@Override public Set<Long> getContentLocationIds(Location location){
  List<Location> locations=new ArrayList<Location>();
  if (location != null) {
    locations.add(location);
    locationIdSet.add(location.getId());
    findLocationIds(locations);
  }
 else {
    locationIdSet.add(0l);
  }
  return locationIdSet;
}
Program: 58515
Project: 58515
Buggy source:
public void generateProjectFromPartner(ActionRequest request,ActionResponse response){
  Partner partner=Beans.get(PartnerRepository.class).find(Long.valueOf(request.getContext().get("String_Node_Str").toString()));
  User user=AuthUtils.getUser();
  Project project=projectService.generateProject(null,partner.getName() + "String_Node_Str",user,user.getActiveCompany(),partner);
  response.setValues(project);
}

Fixed version (ground truth):
public void generateProjectFromPartner(ActionRequest request,ActionResponse response){
  Partner partner=Beans.get(PartnerRepository.class).find(Long.valueOf(request.getContext().get("String_Node_Str").toString()));
  User user=AuthUtils.getUser();
  Project project=Beans.get(ProjectService.class).generateProject(null,partner.getName() + "String_Node_Str",user,user.getActiveCompany(),partner);
  response.setValues(project);
}
Program: 58516
Project: 58516
Buggy source:
public void createPlanning(ActionRequest request,ActionResponse response){
  Project project=request.getContext().asType(Project.class);
  List<ProjectPlanning> projectPlannings=projectService.createPlanning(project);
  response.setView(ActionView.define(I18n.get("String_Node_Str")).model(ProjectPlanning.class.getName()).add("String_Node_Str","String_Node_Str").add("String_Node_Str","String_Node_Str").add("String_Node_Str","String_Node_Str").domain("String_Node_Str").context("String_Node_Str",projectPlannings.stream().map(it -> it.getId()).collect(Collectors.toList())).map());
}

Fixed version (ground truth):
public void createPlanning(ActionRequest request,ActionResponse response){
  Project project=request.getContext().asType(Project.class);
  List<ProjectPlanning> projectPlannings=Beans.get(ProjectService.class).createPlanning(project);
  response.setView(ActionView.define(I18n.get("String_Node_Str")).model(ProjectPlanning.class.getName()).add("String_Node_Str","String_Node_Str").add("String_Node_Str","String_Node_Str").add("String_Node_Str","String_Node_Str").domain("String_Node_Str").context("String_Node_Str",projectPlannings.stream().map(it -> it.getId()).collect(Collectors.toList())).map());
}
Program: 58517
Project: 58517
Buggy source:
public void generateQuotation(ActionRequest request,ActionResponse response){
  Project project=request.getContext().asType(Project.class);
  try {
    SaleOrder order=projectService.generateQuotation(project);
    response.setView(ActionView.define("String_Node_Str").model(SaleOrder.class.getName()).add("String_Node_Str","String_Node_Str").context("String_Node_Str",String.valueOf(order.getId())).map());
  }
 catch (  Exception e) {
    TraceBackService.trace(response,e);
  }
}

Fixed version (ground truth):
public void generateQuotation(ActionRequest request,ActionResponse response){
  Project project=request.getContext().asType(Project.class);
  try {
    SaleOrder order=Beans.get(ProjectService.class).generateQuotation(project);
    response.setView(ActionView.define("String_Node_Str").model(SaleOrder.class.getName()).add("String_Node_Str","String_Node_Str").context("String_Node_Str",String.valueOf(order.getId())).map());
  }
 catch (  Exception e) {
    TraceBackService.trace(response,e);
  }
}
Program: 58518
Project: 58518
Buggy source:
public void selectTeam(ActionRequest request,ActionResponse response){
  Project project=request.getContext().asType(Project.class);
  project=Beans.get(ProjectRepository.class).find(project.getId());
  try {
    projectService.cascadeUpdateTeam(project,project.getTeam(),project.getSynchronisable());
    response.setReload(true);
  }
 catch (  Exception e) {
    TraceBackService.trace(response,e);
  }
}

Fixed version (ground truth):
public void selectTeam(ActionRequest request,ActionResponse response){
  Project project=request.getContext().asType(Project.class);
  project=Beans.get(ProjectRepository.class).find(project.getId());
  try {
    Beans.get(ProjectService.class).cascadeUpdateTeam(project,project.getTeam(),project.getSynchronisable());
    response.setReload(true);
  }
 catch (  Exception e) {
    TraceBackService.trace(response,e);
  }
}
Program: 58519
Project: 58519
Buggy source:
private void setView(){
  MetaJsonField panel=getJsonField("String_Node_Str","String_Node_Str");
  panel.setSequence(-103);
  panel.setHiddenInGrid(true);
  panel.setIsWkf(true);
  panel.setWidgetAttrs("String_Node_Str");
  saveJsonField(panel);
  MetaJsonField status=workflow.getStatusField();
  status.setSequence(-102);
  status.setSelection(getSelectName());
  status.setWidget(null);
  status.setIsWkf(true);
  status.setWidgetAttrs("String_Node_Str");
  if (workflow.getDisplayTypeSelect() == 0) {
    status.setWidget("String_Node_Str");
  }
  saveJsonField(workflow.getStatusField());
  MetaJsonField trackFlow=getJsonField("String_Node_Str","String_Node_Str");
  trackFlow.setSequence(-101);
  trackFlow.setTitle("String_Node_Str");
  trackFlow.setWidgetAttrs("String_Node_Str");
  trackFlow.setOnClick(WkfTrackingService.ACTION_OPEN_TRACK);
  trackFlow.setIsWkf(true);
  trackFlow.setHiddenInGrid(true);
  saveJsonField(trackFlow);
  MetaJsonField wkfEnd=getJsonField("String_Node_Str","String_Node_Str");
  wkfEnd.setSequence(-1);
  wkfEnd.setHiddenInGrid(true);
  wkfEnd.setIsWkf(true);
  wkfEnd.setWidgetAttrs("String_Node_Str");
  saveJsonField(panel);
  setTrackOnSave(workflow,false);
}

Fixed version (ground truth):
private void setView(){
  MetaJsonField panel=getJsonField("String_Node_Str","String_Node_Str");
  panel.setSequence(-103);
  panel.setVisibleInGrid(false);
  panel.setIsWkf(true);
  panel.setWidgetAttrs("String_Node_Str");
  saveJsonField(panel);
  MetaJsonField status=workflow.getStatusField();
  status.setSequence(-102);
  status.setSelection(getSelectName());
  status.setWidget(null);
  status.setIsWkf(true);
  status.setWidgetAttrs("String_Node_Str");
  if (workflow.getDisplayTypeSelect() == 0) {
    status.setWidget("String_Node_Str");
  }
  saveJsonField(workflow.getStatusField());
  MetaJsonField trackFlow=getJsonField("String_Node_Str","String_Node_Str");
  trackFlow.setSequence(-101);
  trackFlow.setTitle("String_Node_Str");
  trackFlow.setWidgetAttrs("String_Node_Str");
  trackFlow.setOnClick(WkfTrackingService.ACTION_OPEN_TRACK);
  trackFlow.setIsWkf(true);
  trackFlow.setVisibleInGrid(false);
  saveJsonField(trackFlow);
  MetaJsonField wkfEnd=getJsonField("String_Node_Str","String_Node_Str");
  wkfEnd.setSequence(-1);
  wkfEnd.setVisibleInGrid(false);
  wkfEnd.setIsWkf(true);
  wkfEnd.setWidgetAttrs("String_Node_Str");
  saveJsonField(panel);
  setTrackOnSave(workflow,false);
}