Esempio n. 1
0
  public I_C_Queue_PackageProcessor createPackageProcessor(
      Properties ctx,
      Class<? extends IWorkpackageProcessor> packageProcessorClass,
      String trxName) {
    final I_C_Queue_PackageProcessor packageProcessorDef =
        InterfaceWrapperHelper.create(ctx, I_C_Queue_PackageProcessor.class, trxName);
    packageProcessorDef.setClassname(packageProcessorClass.getCanonicalName());
    InterfaceWrapperHelper.save(packageProcessorDef);

    return packageProcessorDef;
  }
  private IWorkPackageQueue getQueueForEnqueuing(
      final Properties ctx, final I_C_Queue_PackageProcessor packageProcessor) {
    final String internalNameToUse;
    if (Check.isEmpty(packageProcessor.getInternalName())) {
      internalNameToUse = packageProcessor.getClassname();
    } else {
      internalNameToUse = packageProcessor.getInternalName();
    }

    return WorkPackageQueue.createForEnqueuing(
        ctx, packageProcessor.getC_Queue_PackageProcessor_ID(), internalNameToUse);
  }
  @Override
  public IWorkPackageQueue getQueueForPackageProcessing(final I_C_Queue_Processor processor) {
    final List<I_C_Queue_PackageProcessor> packageProcessors =
        Services.get(IQueueDAO.class).retrieveWorkpackageProcessors(processor);
    final List<Integer> packageProcessorIds = new ArrayList<Integer>(packageProcessors.size());
    for (final I_C_Queue_PackageProcessor packageProcessor : packageProcessors) {
      packageProcessorIds.add(packageProcessor.getC_Queue_PackageProcessor_ID());
    }

    final Properties ctx = InterfaceWrapperHelper.getCtx(processor);
    final String priorityFrom = processor.getPriority();

    return WorkPackageQueue.createForQueueProcessing(ctx, packageProcessorIds, priorityFrom);
  }