use of org.adempiere.util.lang.impl.TableRecordReference in project metasfresh-webui-api by metasfresh.
the class ADProcessPostProcessService method invalidateDocumentsAndViews.
private void invalidateDocumentsAndViews(final ViewId viewId, final ProcessExecutionResult processExecutionResult) {
final Supplier<IView> viewSupplier = Suppliers.memoize(() -> {
if (viewId == null) {
return null;
}
final IView view = viewsRepo.getViewIfExists(viewId);
if (view == null) {
logger.warn("No view found for {}. View invalidation will be skipped for {}", viewId, processExecutionResult);
}
return view;
});
//
// Refresh all
boolean viewInvalidateAllCalled = false;
if (processExecutionResult.isRefreshAllAfterExecution() && viewSupplier.get() != null) {
viewSupplier.get().invalidateAll();
viewInvalidateAllCalled = true;
}
//
// Refresh required document
final TableRecordReference recordToRefresh = processExecutionResult.getRecordToRefreshAfterExecution();
if (recordToRefresh != null) {
documentsCollection.invalidateDocumentByRecordId(recordToRefresh.getTableName(), recordToRefresh.getRecord_ID());
if (!viewInvalidateAllCalled && viewSupplier.get() != null) {
viewSupplier.get().notifyRecordsChanged(ImmutableSet.of(recordToRefresh));
}
}
}
use of org.adempiere.util.lang.impl.TableRecordReference in project metasfresh-webui-api by metasfresh.
the class WEBUI_PP_Order_IssueReceipt_Launcher method doIt.
@Override
protected String doIt() throws Exception {
final TableRecordReference ppOrderRef = TableRecordReference.of(I_PP_Order.Table_Name, getRecord_ID());
getResult().setRecordToOpen(ppOrderRef, PPOrderConstants.AD_WINDOW_ID_IssueReceipt.toInt(), OpenTarget.GridView);
return MSG_OK;
}
use of org.adempiere.util.lang.impl.TableRecordReference in project metasfresh-webui-api by metasfresh.
the class PickingTerminalViewInvalidationAdvisor method extractShipmentScheduleIds.
private Set<Integer> extractShipmentScheduleIds(final Set<TableRecordReference> recordRefs) {
if (recordRefs.isEmpty()) {
return ImmutableSet.of();
}
final Set<Integer> shipmentScheduleIds = new HashSet<>();
final Set<Integer> pickingCandidateIds = new HashSet<>();
for (TableRecordReference recordRef : recordRefs) {
final String tableName = recordRef.getTableName();
if (I_M_ShipmentSchedule.Table_Name.equals(tableName)) {
shipmentScheduleIds.add(recordRef.getRecord_ID());
} else if (I_M_Picking_Candidate.Table_Name.equals(tableName)) {
pickingCandidateIds.add(recordRef.getRecord_ID());
}
}
if (!pickingCandidateIds.isEmpty()) {
shipmentScheduleIds.addAll(pickingCandidateRepository.retrieveShipmentScheduleIdsForPickingCandidateIds(pickingCandidateIds));
}
return shipmentScheduleIds;
}
use of org.adempiere.util.lang.impl.TableRecordReference in project metasfresh-webui-api by metasfresh.
the class DebugRestController method postEvent.
@RequestMapping(value = "/eventBus/postEvent", method = RequestMethod.GET)
public void postEvent(//
@RequestParam(name = "topicName", defaultValue = "de.metas.event.GeneralNotifications") final String topicName, //
@RequestParam(name = "message", defaultValue = "test message") final String message, //
@RequestParam(name = "toUserId", defaultValue = "-1") final int toUserId, //
@RequestParam(name = "important", defaultValue = "false") final boolean important, //
@RequestParam(name = "targetType", required = false) final String targetTypeStr, //
@RequestParam(name = "targetDocumentType", required = false, defaultValue = "143") final String targetDocumentType, //
@RequestParam(name = "targetDocumentId", required = false) final String targetDocumentId) {
final Topic topic = Topic.builder().name(topicName).type(Type.LOCAL).build();
final Builder eventBuilder = Event.builder().setSummary("summary").setDetailPlain(message).putProperty(UserNotificationRepository.EVENT_PARAM_Important, important);
if (toUserId > 0) {
eventBuilder.addRecipient_User_ID(toUserId);
}
final TargetType targetType = Check.isEmpty(targetTypeStr) ? null : TargetType.forJsonValue(targetTypeStr);
if (targetType == TargetType.Window) {
final String targetTableName = documentCollection.getDocumentDescriptorFactory().getDocumentDescriptor(WindowId.fromJson(targetDocumentType)).getEntityDescriptor().getTableName();
final TableRecordReference targetRecord = TableRecordReference.of(targetTableName, Integer.parseInt(targetDocumentId));
eventBuilder.setRecord(targetRecord);
}
final Event event = eventBuilder.build();
Services.get(IEventBusFactory.class).getEventBus(topic).postEvent(event);
}
Aggregations