I am trying again to migrate one of my largest project which was originally created in CUBA 5.x or 6.x (don’t remember) then migrated to CUBA v7. I had some interfaces which were built on CUBA V6 and now converted to v7 (Vaadin 8) as preparation for migrating to the Jmix.
I have migrated my project to JMIX 1.3.1 that looks much better than I had get many issues that has been fixed/clarified through these threads here (1.1), here (1.2), and few more…
Now I have a few more issues that need to be resolved apart from some issues I found and fixed.
- I do not see the “SecurityContextAwareRunnable” anymore that I used to execute tasks. What is the alternative in JMIX?
private void updatePrAsync(PurchaseRequisition purchaseRequisition) {
// submit a task for asynchronous execution
// use SecurityContextAwareRunnable for passing security context to the new thread
executorService.submit(new SecurityContextAwareRunnable(() -> {
// some artificial delay
sleep();
// your business logic in a new transaction
}));
}
-
What is the new API in JMIX replacing CUBA?
- FtsField
Is it “import org.springframework.context.annotation.Role” for Role? Not sure what is for other APIs
- In CUBA, I used the following lines of codes to put the focus on precisely. This issue is, “requestFocus()” is not recognized in JMIX.
accountsTable.setSelected(e.getSource().getEditedEntity());
accountsTable.scrollTo(e.getSource().getEditedEntity());
accountsTable.requestFocus();
- I didn’t find this API, what’s new that replaces it?
com.haulmont.cuba.gui.components.mainwindow.FtsField
- How can I check if the current user has access to any particular screen? I have the following code in CUBA.
if (!userSessionSource.getUserSession().isScreenPermitted("erp_WorkflowTaskLineStatusInbox.browse")) {
//action
}
- SettingsWindow, no more exists?
public class ExtSettingsWindow extends SettingsWindow {
@Inject
private UserSettingService userSettingService;
- How can I get entity name list in JMIX while I used to get it in CUBA like below:
Do you recommend to get list of classes as follows?
> metadata.getClasses().stream()
But I didn’t find any option to exclude system-level meta-classes, thanks for suggesting.
- I do not see globalConfig and webConfig which was used in AppLogin screen.
There are many ways I have used this, e.g. sending link:
private String buildEditorLink(String entityName, UUID entityId) {
return globalConfig.getWebAppUrl() + "/open?screen=" + entityName + ".edit&item=" + entityName + "-" + entityId;
}
- I encrypt password programmatically but I don’t see the password encrypt API anymore, any alternative available?
@Inject
private PasswordEncryption passwordEncryption;
String passwordHash = passwordEncryption.getPasswordHash(user.getId(), password);
user.setPassword(passwordHash);
- The following option to get ItemDatasource from a table to set Datasource to a textField is not working anymore as you seem them in red:
I used to control view only/editable dynamically as follows but what is the way in JMIX to the red highlighted field in the image above?
demandPlanLineTable.addGeneratedColumn("quantityPd2", entity -> {
if (entity.getDemandPerspective().getDemandPerspectiveType().equals(DemandPerspectiveType.BASE_FORECAST)
|| entity.getDemandPerspective().getDemandPerspectiveType().equals(DemandPerspectiveType.DEMAND_PLAN)) {
// simple text cell, non editable
return new Table.PlainTextCell(entity.getQuantityPd2().toString());
}
TextField textField = componentsFactory.createComponent(TextField.class);
textField.setWidth("100%");
textField.setDatasource(demandPlanLineTable.getItemDatasource(entity), "quantityPd2");
return textField;
});