use of org.adempiere.util.api.IRangeAwareParams in project metasfresh-webui-api by metasfresh.
the class WEBUI_M_HU_MoveToDirectWarehouse_Mass method prepare.
@Override
protected void prepare() {
final IRangeAwareParams parameterAsIParams = getParameterAsIParams();
p_M_Warehouse_ID = parameterAsIParams.getParameterAsInt("M_Warehouse_ID");
p_huWhereClause = parameterAsIParams.getParameterAsString("WhereClause");
p_MovementDate = parameterAsIParams.getParameterAsTimestamp("MovementDate");
p_Description = parameterAsIParams.getParameterAsString("Description");
}
use of org.adempiere.util.api.IRangeAwareParams in project metasfresh-webui-api by metasfresh.
the class ADProcessInstancesRepository method retrieveProcessInstance.
private ADProcessInstanceController retrieveProcessInstance(final DocumentId adPInstanceId) {
Check.assumeNotNull(adPInstanceId, "Parameter adPInstanceId is not null");
Check.assume(adPInstanceId.toInt() > 0, "adPInstanceId > 0");
//
// Load process info
final ProcessInfo processInfo = ProcessInfo.builder().setCtx(Env.getCtx()).setCreateTemporaryCtx().setAD_PInstance_ID(adPInstanceId.toInt()).build();
final Object processClassInstance = processInfo.newProcessClassInstanceOrNull();
try (final IAutoCloseable c = JavaProcess.temporaryChangeCurrentInstance(processClassInstance)) {
//
// Build the parameters document
final ProcessId processId = ProcessId.ofAD_Process_ID(processInfo.getAD_Process_ID());
final ProcessDescriptor processDescriptor = getProcessDescriptor(processId);
//
// Build the parameters (as document)
final DocumentEntityDescriptor parametersDescriptor = processDescriptor.getParametersDescriptor();
final Document parametersDoc = parametersDescriptor.getDataBinding().getDocumentsRepository().retrieveDocumentById(parametersDescriptor, adPInstanceId, NullDocumentChangesCollector.instance);
// TODO: handle the case when the process was already executed
// In that case we need to load the result and provide it to ProcessInstance constructor
//
// View informations
final IRangeAwareParams processInfoParams = processInfo.getParameterAsIParams();
final String viewIdStr = processInfoParams.getParameterAsString(ViewBasedProcessTemplate.PARAM_ViewId);
final ViewId viewId = Strings.isNullOrEmpty(viewIdStr) ? null : ViewId.ofViewIdString(viewIdStr);
//
return ADProcessInstanceController.builder().caption(processDescriptor.getCaption()).instanceId(adPInstanceId).parameters(parametersDoc).processClassInstance(processClassInstance).viewId(viewId).build();
}
}
Aggregations