cuba-platform / documentation Goto Github PK
View Code? Open in Web Editor NEWCUBA Platform Documentation
Home Page: https://www.cuba-platform.com
License: Creative Commons Attribution 4.0 International
CUBA Platform Documentation
Home Page: https://www.cuba-platform.com
License: Creative Commons Attribution 4.0 International
Check connectionParams:
?useUnicode=true&characterEncoding=UTF-8
See also: http://stackoverflow.com/questions/43003625/cuba-on-tomcat-proxied-by-nginx/43016283?noredirect=1#comment73219918_43016283
Do not forget UberJAR options with X-Forwarded-For HTTP header
Configuration interfaces may be used as middleware beans' attributes, for example:
class MyBean {
protected MyConfiguration myConfig;
@PostConstruct
public void init() {
myConfig = configuration.getConfig(MyConfiguration.class);
}
public void doSomething() {
if (myConfig.isSomePropertyEnabled()) {
....
}
}
}
Thus,
ConfigPersisterImpl
is thead-safe,ConfigStorage
.Now it is not clear that after the service creation user should add some information about this service to the web-spring.xml file
https://doc.cuba-platform.com/manual-6.6/service_creation.html
https://doc.cuba-platform.com/manual-6.6/service_import.html
Document the recommended production settings:
The real question from a client: We want to deploy the portal app on a separate tomcat instance on a different physical server. What config needs to be set for it to know the location of the core app?
It is very hard now to find some app property if you don't know its FQN.
The suggestion is to group properties and add menu items (links to anchors - group headers)
Describe LibreOffice setup for Yarg reporting on Ubuntu
https://www.cuba-platform.com/discuss/t/deployment-and-reports-libreoffice-not-found/2933
Without inheritance from base service from app component
At the moment, we have to annotate new service implementation with @service annotation and exclude this class from component-scan:
<context:component-scan base-package="com.haulmont.cuba">
<context:exclude-filter type="regex" expression="com\.haulmont\.cuba\.web\.sys\.CustomMyServiceBean"/>
</context:component-scan>
Relates to
At the moment, it is implemented in com.haulmont.cuba.web.gui.WebWindow#showValidationErrors
and cannot be changed.
See: https://www.cuba-platform.com/support/topic/how-to-change-the-position-of-error-alert
New configuration property: cuba.gui.validationNotificationType
Default value: TRAY
Valid value: one of com.haulmont.cuba.gui.components.Frame.NotificationType
(TRAY, TRAY_HTML, HUMANIZED, HUMANIZED_HTML, WARNING, WARNING_HTML, ERROR, ERROR_HTML)
You can override default behaviour for concrete Window/Frame in showValidationErrors()
method:
@Override
public void showValidationErrors(ValidationErrors errors) {
super.showValidationErrors(errors);
}
write about clean Tomcat, full reassembling, etc
Time frame – if Start date is specified, Time frame defines the time window in seconds, during which the task will be launched after startDate + period * N time expires. If Time frame is not specified explicitly, it is equal to period / 2.
If Start date is not specified, Time frame is ignored, i.e. the task will be launched at any time after Period since the previous execution of the task expires.
Describe also cron scheduling with time frame
Describe which view will be used if not set explicitly
Add examples of using screen settings (saveSettings()
/ applySettings()
), e.g. CreditCardTransactionBrowser
screen controller.
Confluence
See example in com.haulmont.cuba.gui.exception.UniqueConstraintViolationHandler
RowLevelSecurityExceptionHandler_draft.txt
https://doc.cuba-platform.com/manual-6.6/integration_tests_mw.html
new Customer()
- creation of entities with new is dangerous and we show warning inspection in Ideanew ArrayList<>(Arrays.asList(
- verbose, use simple Arrays.asList(
cuba.confDir=${user.dir}/test-home/cuba/conf
cuba.logDir=${user.dir}/test-home/cuba/logs
cuba.tempDir=${user.dir}/test-home/cuba/temp
cuba.dataDir=${user.dir}/test-home/cuba/work
sales-app.properties
, test-app.properties
, since new projects always have app.properties
files inside of root packagehttps://doc.cuba-platform.com/manual-6.6/js_library_sample.html
SliderServerComponent should have the following constructor:
public SliderServerComponent() {
addFunction("valueChanged", arguments -> {
JsonArray array = arguments.getArray(0);
double[] values = new double[2];
values[0] = array.getNumber(0);
values[1] = array.getNumber(1);
getState(false).values = values;
listener.valueChanged(values);
});
}
Also we have to override the following method:
@Override
protected SliderState getState(boolean markAsDirty) {
return (SliderState) super.getState(markAsDirty);
}
All newbie developers and many experienced ones don't understand the meaning of managed entity state and purpose of em.merge
. For them em.merge call is "save entity changes to DB", like em.save()
.
Existing documentation pages (1, 2) are not enough. Too brief, people just don't get the sense without real code.
TODO: add examples, recommended scenarios, explanations of side effects.
What can be added:
em.merge
is doing under the hood. Side effects: optimistic lock checking. When we need to use em.merge
and when we don't need it. Code example of justified em.merge
usage.em.reload
usage.Any changes of the instance in
Managed
state will be saved to the database when the transaction that the EntityManager belongs to is committed.
Tomcat use blocking secure random generator, to enable non-blocking linux random source add option to bin/setenv.sh:
CATALINA_OPTS="$CATALINA_OPTS -Djava.security.egd=file:/dev/./urandom"
Current workaround, when the app context is started:
delete from sys_db_changelog where script_name like '%groovy' and create_ts > (now() - interval '1 hour')
Document how HD works:
If Instant Hot deploy is deactivated, one can run Run ->Hot deploy conf:
If Instant Hot deploy is active:
Help -> Settings, ->Context help
The 'Instant hot deploy' checkbox allows you to turn off hot deploy.
If hot deployment is enabled, Studio dynamically updates the UI of your deployed web application as you apply or save changes to views, screens, messages or the main menu. На самом деле Instant hot deploy работает не только для UI (see above)
Run ->Hot deploy conf
Hot deploy conf runs the deployConf Gradle task which by default copies all sources of the web module into the application server's configuration directory.
The task can be configured in build.gradle if necessary. This command is usually excessive because Studio can instantly deploy changed source files of the web module if the Instant hot deploy for Web Client checkbox in the Screens section is set.
In fact: not only Web module and not all sources.
Instant hot deploy for Web Client checkbox in the Screens section
- should be clarified.
UPDATE:
What works:
XML descriptors and screen controllers (including static methods), located in web and gui modules
Middleware service implementations, located in core module
What doesn't work:
Any classes of the global module, including middleware service interfaces
Other UI and middleware classes and beans, including their static methods, hot deployed ONLY IF some class from item 1 has also been changed. The reason for this is that class reloading is started by some signal: for screen controllers it is the screen reopening, for services - Studio generates special trigger file that is recognized by server and used to reload particular service class and all its dependencies.
See also https://www.cuba-platform.com/support/topic/hot-deploy-issue#comment-6654
This plugin doesn't require Ruby installed on the machine
.cuba-folders-pane .v-tree-node.emphasized {
font-weight: bold;
}
See: https://doc.cuba-platform.com/manual-6.8/application_folder.html
It should be .c-folders-pane instead of .cuba-folders-pane
Add examples of safe multi-threading.
Problem:
The run()
method runs in a separate thread, not in the UI thread. It must be considered in case:
Main rules:
run()
is a bad practice that can result in mystic Vaadin and Swing errors.run()
(including datasources, components, and added fields of screen controllers) must be synchronized,These means are:
The task is coded in functional style divided into 3 parts:
run()
performing a continuous action in a separate thread. It uses only prepared parameters and prepares some result which serves as a class-task parameter. Multiple results can be wrapped in POJO.done()
, handleException()
, handleTimeout()
.Passing parameters via the task constructor seems to be more type-safe than by getParams()
.
Example №2:
// Here:
// parameter - String searchString
// result - List<AddressSuggestion>
// state - addresses and components
@Named("searchString")
protected TextField searchStringField;
@Named("addressDs")
private CustomDatasource<GuiSuggestion> addressDs;
@Named("searchProgressBar")
private Label searchProgressBar;
protected List<AddressSuggestion> addresses;
protected BackgroundTaskWrapper<Void, List<AddressSuggestion>> backgroundTaskWrapper = new BackgroundTaskWrapper<>();
protected class AddressSearchTask extends BackgroundTask<Void, List<AddressSuggestion>> {
private String searchString;
public AddressSearchTask(String searchString) {
super(30);
this.searchString = searchString;
}
@Override
public List<AddressSuggestion> run(TaskLifeCycle<Void> taskLifeCycle) {
List<AddressSuggestion> matches = addressSearchService.search(searchString);
return matches;
}
@Override
public void canceled() {
addresses = Collections.emptyList();
addressDs.refresh();
setInSearch(false);
}
@Override
public void done(List<AddressSuggestion> result) {
addresses = result;
addressDs.refresh();
setInSearch(false);
}
}
protected void setInSearch(boolean inSearch) {
searchProgressBar.setVisible(inSearch);
}
...
// call
String searchString = searchStringField.getValue();
setInSearch(true);
backgroundTaskWrapper.restart(new AddressSearchTask(searchString));
Example №2
// Пример №2
// Расчёт цены заказа в фоновом потоке
// для сложного объекта-заказа, который редактируется на форме
// Т.к. во время выполнения задачи заказ может изменяться через компоненты редактирования
// - то нельзя передавать в задачу объект, хранящийся в датасорсе.
// Перед запуском задачи нужно создать объект-копию заказа, для которого и будет идти расчет
@Inject
protected Datasource<Order> orderDs;
@Inject
protected ProgressBar progressBar;
@Inject
protected Label priceLabel;
private class PriceCalcTask extends BackgroundTask<Void, Price> {
private Order orderCopy;
public PriceCalcTask(Order orderCopy) {
super(60, frame);
this.orderCopy = orderCopy;
}
@Override
public Price run(TaskLifeCycle<Void> taskLifeCycle) {
return priceService.calculatePrice(orderCopy);
}
@Override
public void done(Price result) {
assignPriceToOrder(orderCopy, result);
priceLabel.setValue(result.getTotal());
progressBar.setVisible(false);
}
@Override
public boolean handleException(Exception ex) {
showNotification("Failed to calculate price", NotificationType.WARNING);
progressBar.setVisible(false);
return true;
}
}
// вызов
progressBar.setVisible(true);
Order orderClone = deepClone(orderDs.getItem());
priceTaskWrapper.restart(new PriceCalcTask(orderClone));
For example:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.