/
Apathy21
/
company
Обзор
Документация
Войти
/
Apathy21
/
company
Код
Запросы
0
Задачи
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
MainService/src/main/java/org/example/vm/BranchOfficeAddressVM.java
33 строки
1 KB
alexeev509
Skeletop company app realization
13 сен 2024, 19:21
13 сен 2024, 19:21
2a02e11
Код
Авторство
О чём код?
package org.example.vm; import org.example.Entity.Address; import org.example.Entity.BranchOffice; import org.example.Entity.Company; import org.example.service.AddressService; import org.zkoss.bind.annotation.ExecutionArgParam; import org.zkoss.bind.annotation.Init; import org.zkoss.zk.ui.select.annotation.VariableResolver; import org.zkoss.zk.ui.select.annotation.WireVariable; @VariableResolver(org.zkoss.zkplus.cdi.DelegatingVariableResolver.class) public class BranchOfficeAddressVM { @WireVariable private AddressService addressService; private Address curAddress; @Init // @Transactional public void init(@ExecutionArgParam("branchOffice") BranchOffice branchOffice) { // #note: Maybe it isn't the best decision. In one way we could use branchOffice.getAddress(); // and create select request to db. If we have not a lot of branchOffice's (in our Business logic) // it is applicable. But if we have millions on branchOffice's - it can be hit to performance. curAddress = addressService.getAddressByBranchOfficeId(branchOffice.getAddress().getId()); } public Address getCurAddress() { return curAddress; } }