Hi, I checked the login-restriction sample project and i saw you have to specify the number of concurrent user sessions and license expiry date in code (LicenceConfig.java file) see below
I was thinking if can change these value from a screen which allows a user to enter his values then from this update the LicenceConfig.java file values according to user input. Something like this below
Here is the controller
public class LicenseSetting extends AbstractWindow {
@Inject
private LicenseService licenseService;
@Inject
private TextField session_txt;
@Inject
private DateField expiry_date;
int session_num =0;
Date expiry_Date =null;
@Override
public void ready() {
// TODO Auto-generated method stub
super.ready();
session_txt.addValueChangeListener(e->{
if(e.getValue() !=null)
{
session_num = (int) e.getValue();
}
});
expiry_date.addValueChangeListener(e->{
if(e.getValue() !=null)
{
expiry_Date = (Date) e.getValue();
}
});
}
public void onOkbtnClick() {
licenseService.changeUserSessionsExpiryDate(session_num, expiry_date);
}
public void onCancelbtnClick() {
}
}
Here is the service
@Override
public boolean changeUserSessionsExpiryDate(int session, Date expiry_date) {
// TODO Auto-generated method stub
try(Transaction tx = persistence.createTransaction())
{
long timeMilli = expiry_date.getTime();
//session - contains the value of allowed user sessions
//TimeMilli - contains the License expiryDate to Milliseconds
//How will i change/set the values to the LicenseConfig.java from the service
tx.commit();
}
return false;
}