How can I display only the entities from CompanyReport that belong to the logged-in user?
each user belong to a customer. Each Customer have many Reports.
This is my Solution but not work:
@ViewComponent
private CollectionLoader<CompanyReport> companyReportsDl;
@Autowired
private CurrentAuthentication currentAuthentication;
@Subscribe
public void onInit(final InitEvent event) {
User user = (User) currentAuthentication.getUser();
Customer customer = user.getCustomer();
if (customer != null){
companyReportsDl.setCondition(PropertyCondition.equal("cusId", customer.getCusID()));
}else {
companyReportsDl.setCondition(PropertyCondition.equal("cusId", ""));
}
companyReportsDl.load();
}