Skip to content

Commit

Permalink
Removed refresh on session
Browse files Browse the repository at this point in the history
  • Loading branch information
benchdoos committed Aug 3, 2018
1 parent ac57d85 commit 2d79e21
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@
import com.mmz.specs.connection.DaoConstants;
import com.mmz.specs.dao.ConstantsDaoImpl;
import com.mmz.specs.dao.NoticeDaoImpl;
import com.mmz.specs.model.*;
import com.mmz.specs.model.ConstantsEntity;
import com.mmz.specs.model.NoticeEntity;
import com.mmz.specs.model.UsersEntity;
import com.mmz.specs.service.ConstantsService;
import com.mmz.specs.service.ConstantsServiceImpl;
import com.mmz.specs.service.NoticeServiceImpl;
Expand Down Expand Up @@ -695,12 +697,6 @@ private void onEditDataButton(boolean select) {
mainWindowUtils.updateMessage("/img/gui/animated/sync.gif", "Открываем редактирование данных...");
new Thread(() -> {
try {
SessionUtils.refreshSession(session, DetailTitleEntity.class);
SessionUtils.refreshSession(session, MaterialEntity.class);
SessionUtils.refreshSession(session, DetailEntity.class);
SessionUtils.refreshSession(session, NoticeEntity.class);
SessionUtils.refreshSession(session, TechProcessEntity.class);

ImageIcon icon = new ImageIcon(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/img/gui/databaseEdit16.png")));
addTab("Редактирование данных", icon, new EditDataPanel(), select);
mainWindowUtils.updateMessage(null, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import com.mmz.specs.application.utils.SessionUtils;
import com.mmz.specs.application.utils.client.CommonWindowUtils;
import com.mmz.specs.application.utils.client.MainWindowUtils;
import com.mmz.specs.dao.DetailDaoImpl;
import com.mmz.specs.dao.DetailTitleDaoImpl;
import com.mmz.specs.dao.MaterialDaoImpl;
import com.mmz.specs.model.DetailEntity;
Expand Down Expand Up @@ -288,7 +287,7 @@ private void fillTitleList() {

private int getTitleUsage(DetailTitleEntity selectedValue) {
if (selectedValue != null) {
DetailService service = new DetailServiceImpl(new DetailDaoImpl(session));
DetailService service = new DetailServiceImpl(session);
final ArrayList<DetailEntity> detailsByTitle = (ArrayList<DetailEntity>) service.getDetailsByTitle(selectedValue);
if (detailsByTitle != null) {
return detailsByTitle.size();
Expand Down Expand Up @@ -321,10 +320,10 @@ private void initEditTitleTabButtons() {
final DetailTitleEntity selectedValue = titleList.getSelectedValue();
final int selectedIndex = titleList.getSelectedIndex();
if (selectedValue != null) {
DetailService service = new DetailServiceImpl(new DetailDaoImpl(session));
DetailService service = new DetailServiceImpl(session);
final ArrayList<DetailEntity> detailsByTitle = (ArrayList<DetailEntity>) service.getDetailsByTitle(selectedValue);
if (detailsByTitle.isEmpty()) {
new DetailTitleServiceImpl(new DetailTitleDaoImpl(session)).removeDetailTitle(selectedValue.getId());
new DetailTitleServiceImpl(session).removeDetailTitle(selectedValue.getId());

final DefaultListModel<DetailTitleEntity> model = (DefaultListModel<DetailTitleEntity>) titleList.getModel();
model.removeElement(selectedValue);
Expand Down Expand Up @@ -370,7 +369,7 @@ private void initEditMaterialTab() {
private void fillMaterialList() {
DefaultListModel<MaterialEntity> model = new DefaultListModel<>();

MaterialService service = new MaterialServiceImpl(new MaterialDaoImpl(session));
MaterialService service = new MaterialServiceImpl(session);
final ArrayList<MaterialEntity> materialListEntities = (ArrayList<MaterialEntity>) service.listMaterials();

Collections.sort(materialListEntities);
Expand Down

0 comments on commit 2d79e21

Please sign in to comment.