Allocation alloc = buildAllocation(task, provider, providerRole); if (estAR != null){ alloc.setEstimatedResult(estAR); if(inventoryPlugin.publishAdd(alloc)) { return true; } else { logger.error("Unable to publish the allocation " + alloc); }  } } } return false;
Allocation alloc;    if (task.getPlanElement() == null) { alloc = buildAllocation(task, provider, providerRole); if (estAR != null){ alloc.setEstimatedResult(estAR); if(inventoryPlugin.publishAdd(alloc)) { return true; } else { logger.error("Unable to publish the allocation " + alloc); } } } else { alloc = (Allocation)task.getPlanElement(); if (estAR != null){ alloc.setEstimatedResult(estAR); if(inventoryPlugin.publishChange(alloc)) { return true; } else { logger.error("Unable to publish Change the allocation " + alloc); } } } } } return false;
    private boolean allocateTask(Task task) {	Organization provider = findBestSource(task);	if (provider != null) {	  if(verifyBeforeAllocation(task,provider)){	    AllocationResult estAR =  createPredictedAllocationResult(task,provider);	    Allocation alloc = buildAllocation(task, provider, providerRole);	    if (estAR != null){	      alloc.setEstimatedResult(estAR);	      if(inventoryPlugin.publishAdd(alloc)) {		return true;	      }	      else {		logger.error("Unable to publish the allocation " + alloc);	      }		   	    }	  } 	}	return false;    }