We created our Customers by extending your Users. Then, we have created our own generic view from Customer Browse so that it can display all the details about a given Customer. For this functionality, we have overridden the controller by extending the AbstractLookup.
Controller
package com.company.demo.web.customer;
import com.haulmont.cuba.gui.components.AbstractLookup;
import com.haulmont.cuba.gui.components.actions.EditAction;
import javax.inject.Named;
import java.util.Map;
public class CustomerBrowse extends AbstractLookup {
@Named("customersTable.edit")
private EditAction customerDetailsView;
@Override
public void init(Map<String, Object> params) {
customerDetailsView.setWindowId("demo$Customer.edit");
}
}
We have also modified our main screen so that now it displays the userSession right after the log in, by overriding the controller for the usersession.
controller
package com.company.demo.web.usersession;
import com.haulmont.cuba.gui.app.security.session.browse.SessionBrowser;
import com.haulmont.cuba.gui.components.Component;
import com.haulmont.cuba.core.entity.Entity;
import com.haulmont.cuba.gui.components.TextField;
import org.apache.commons.lang.StringUtils;
import javax.inject.Inject;
import java.util.HashMap;
import java.util.Map;
public class ExtSessionBrowser extends SessionBrowser {
public ExtSessionBrowser() {
super();
}
@Override
public void init(Map<String, Object> params) {
super.init(params);
}
@Override
public void refresh() {
super.refresh();
Map<String, Object> fieldValues = new HashMap<>();
String userLoginStr = userLogin.getValue();
if (!StringUtils.isEmpty(userLoginStr))
fieldValues.put("userLogin", userLoginStr.toLowerCase());
String userNameStr = userName.getValue();
if (!StringUtils.isEmpty(userNameStr))
fieldValues.put("userName", userNameStr.toLowerCase());
String userAddressStr = userAddress.getValue();
if (!StringUtils.isEmpty(userAddressStr))
fieldValues.put("userAddress", userAddressStr.toLowerCase());
String userInfoStr = userInfo.getValue();
if (!StringUtils.isEmpty(userInfoStr))
fieldValues.put("userInfo", userInfoStr.toLowerCase());
sessionsDs.refresh(fieldValues);
}
@Override
public void clearTextFields() {
super.clearTextFields();
}
@Override
public void message() {
super.message();
}
@Override
public void kill() {
super.kill();
}
}
We would now want to replicate the Customer Details view but only for the userSession not for all the Customers.
How can we do that since the controller for the usersession browser view already extends SessionBrowser and cannot extend AbstractLookup at the same time? Thank you.