How do I pass Userr instance as a parameter. I have tried this but it's not working.
public Double getCurrentProfitAndLoss() {
Double currentProfitAndLoss = null;
Userr user = ( (OptionsUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getUserr();
user = Userr.findUserr(user.getId());
HomePageService homePageService = homePageServiceFactory.getObject();
System.out.println("homePageService object created");
try {
currentProfitAndLoss = homePageService.getCurrentProfitAndLoss(user);
} catch(Exception e) {
e.printStackTrace();
}
return currentProfitAndLoss;
}
But when I pass as a single property of Userr like this it works fine.
public Double getCurrentProfitAndLoss() {
Double currentProfitAndLoss = null;
Userr user = ( (OptionsUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getUserr();
user = Userr.findUserr(user.getId());
HomePageService homePageService = homePageServiceFactory.getObject();
System.out.println("homePageService object created");
try {
currentProfitAndLoss = homePageService.getCurrentProfitAndLoss(user.getId());
} catch(Exception e) {
e.printStackTrace();
}
return currentProfitAndLoss;
}
How do I pass user object?
This is the method accepting user object and I am not getting any error.
public class HomePageService {
public Double getCurrentProfitAndLoss(Userr user) {
System.out.println("iside HOmepageService");
Double currentProfitPercPA = StrategyExitReport.findCurrentProfitAndLossById(user);
System.out.println("iside currentProfitPercPA" + currentProfitPercPA);
return currentProfitPercPA;
}
}