Package open.dolphin.helper

Examples of open.dolphin.helper.DBTask


            return;
        }
       
        final AppointmentDelegater adl = new AppointmentDelegater();
       
        DBTask task = new DBTask<Void>(getContext()) {

            @Override
            protected Void doInBackground() throws Exception {
                adl.putAppointments(results);
                return null;
            }
           
            @Override
            public void succeeded(Void result) {
                setDirty(false);
            }
        };
       
        task.execute();
    }
View Full Code Here


        }

        final StampDelegater sdl = new StampDelegater();
        final KartePane thisPane = this;
       
        DBTask task = new DBTask<List<StampModel>>(parent.getContext()) {

            @Override
            protected List<StampModel> doInBackground() throws Exception {
                List<StampModel> list = sdl.getStamp(addList);
                return list;
            }
           
            @Override
            public void succeeded(List<StampModel> list) {
                logger.debug("stampInfoDropped succeeded");
                if (list != null) {
                   
                    ArrayList<ModuleModel> duplicateCheckList = new ArrayList<ModuleModel>();
                   
                    for (int i = 0; i < list.size(); i++) {
                        ModuleInfoBean stampInfo = addList.get(i);
                        StampModel theModel = list.get(i);
                        IInfoModel model = (IInfoModel) BeanUtils.xmlDecode(theModel.getStampBytes());
                        if (model != null) {
                            ModuleModel stamp = new ModuleModel();
                            stamp.setModel(model);
                            stamp.setModuleInfo(stampInfo);
                            stamp(stamp);
                           
                            duplicateCheckList.add(stamp);
                        }
                    }
                   
                    // スタンプ重複チェック
                    for (ModuleModel stamp : duplicateCheckList) {
                        int count = StampModifier.checkDuplicates(stamp, thisPane);
                        if (count > 0) break;
                    }
                } else {
                    showNoStampModelMessage();
                }
            }
        };
       
        task.execute();
    }
View Full Code Here

    private void applySerializedStamp(final ModuleInfoBean stampInfo) {
       
        final StampDelegater sdl = new StampDelegater();
        final KartePane thisPane = this;
       
        DBTask task = new DBTask<StampModel>(parent.getContext()) {

            @Override
            protected StampModel doInBackground() throws Exception {
                StampModel getStamp = sdl.getStamp(stampInfo.getStampId());
                return getStamp;
            }
           
            @Override
            public void succeeded(StampModel result) {
                logger.debug("applySerializedStamp succeeded");
                if (result != null) {
                    IInfoModel model = (IInfoModel) BeanUtils.xmlDecode(result.getStampBytes());
                    ModuleModel stamp = new ModuleModel();
                    stamp.setModel(model);
                    stamp.setModuleInfo(stampInfo);
                    stamp(stamp);
                    // 重複チェック
                    StampModifier.checkDuplicates(stamp, thisPane);
                } else {
                    showNoStampModelMessage();
                }
            }
        };

        task.execute();
    }
View Full Code Here

     */
    public void textStampInfoDropped(final ArrayList<ModuleInfoBean> addList) {
       
        final StampDelegater sdl = new StampDelegater();
       
        DBTask task = new DBTask<List<StampModel>>(parent.getContext()) {

            @Override
            protected List<StampModel> doInBackground() throws Exception {
                List<StampModel> list = sdl.getStamp(addList);
                return list;
            }
           
            @Override
            public void succeeded(List<StampModel> list) {
                logger.debug("textStampInfoDropped succeeded");
                if (list != null) {
                    for (int i = 0; i < list.size(); i++) {
                        StampModel theModel = list.get(i);
                        IInfoModel model = (IInfoModel) BeanUtils.xmlDecode(theModel.getStampBytes());
                        if (model != null) {
                            insertTextStamp(model.toString() + "\n");
                        }
                    }
                } else {
                    showNoStampModelMessage();
                }
            }
        };
       
        task.execute();
    }
View Full Code Here

     */
    private void applyTextStamp(final ModuleInfoBean stampInfo) {
       
        final StampDelegater sdl = new StampDelegater();
       
        DBTask task = new DBTask<StampModel>(parent.getContext()) {

            @Override
            protected StampModel doInBackground() throws Exception {
                StampModel getStamp = sdl.getStamp(stampInfo.getStampId());
                return getStamp;
            }
           
            @Override
            public void succeeded(StampModel result) {
                logger.debug("applyTextStamp succeeded");
                if (result != null) {
                    byte[] bytes = result.getStampBytes();
                    XMLDecoder d = new XMLDecoder(new BufferedInputStream(new ByteArrayInputStream(bytes)));

                    IInfoModel model = (IInfoModel) d.readObject();
                    if (model != null) {
                        insertTextStamp(model.toString());
                    }
                } else {
                    showNoStampModelMessage();
                }
            }
        };
       
        task.execute();
    }
View Full Code Here

     */
    private void applyOrcaSet(final ModuleInfoBean stampInfo) {
       
        final OrcaMasterDao dao = new OrcaMasterDao();
       
        DBTask task = new DBTask<List<ModuleModel>>(parent.getContext()) {

            @Override
            protected List<ModuleModel> doInBackground() throws Exception {
                List<ModuleModel> models = dao.getStamp(stampInfo);
                return models;
            }
           
            @Override
            public void succeeded(List<ModuleModel> models) {
                logger.debug("applyOrcaSet succeeded");
                if (models != null) {
                    for (ModuleModel stamp : models) {
                        stamp(stamp);
                    }
                }
            }
        };

        task.execute();
    }
View Full Code Here

        if (!ok) {
            return;
        }       
       
        DBTask task = new DBTask<ImageIcon>(parent.getContext()) {

            @Override
            protected ImageIcon doInBackground() throws Exception {
               
                URL url = new URL(entry.getUrl());
                BufferedImage importImage = ImageIO.read(url);
               
                int width = importImage.getWidth();
                int height = importImage.getHeight();
                int maxImageWidth = ClientContext.getInt("image.max.width");
                int maxImageHeight = ClientContext.getInt("image.max.height");
               
                if (width > maxImageWidth || height > maxImageHeight) {
                    importImage = ImageHelper.getFirstScaledInstance(importImage, maxImageWidth);
                }
               
                return new ImageIcon(importImage);
            }
           
            @Override
            public void succeeded(ImageIcon icon) {
              
                logger.debug("imageEntryDropped succeeded");
               
                if (icon != null) {
                   
                    SchemaModel schema = new SchemaModel();
                    schema.setIcon(icon);

                    // IInfoModel として ExtRef を保持している
                    ExtRefModel ref = new ExtRefModel();
                    ref.setContentType("image/jpeg");
                    ref.setTitle("Schema Image");
                    schema.setExtRef(ref);

                    stampId++;
                    String fileName = getDocId() + "-" + stampId + ".jpg";
                    schema.setFileName(fileName);
                    ref.setHref(fileName);
                   
                    final SchemaEditor editor = new SchemaEditorImpl();
                    editor.setSchema(schema);
                    editor.setEditable(true);
                    editor.addPropertyChangeListener(KartePane.this);
                   
                    SwingUtilities.invokeLater(new Runnable() {
                        @Override
                        public void run() {
                            editor.start();
                        }
                    });
                }
            }
        };
        task.execute();
    }
View Full Code Here

            if (ans != JOptionPane.YES_OPTION) return;
        }

        final StampDelegater sdl = new StampDelegater();

        DBTask task = new DBTask<List<StampModel>>(getContext()) {
            @Override
            protected List<StampModel> doInBackground() throws Exception {
                List<StampModel> result = sdl.getStamp(stampList);
                return result;
            }
            @Override
            protected void succeeded(List<StampModel> list) {
                logger.debug("importStampList succeeded");
                if (sdl.isNoError() && list != null) {
                    for (int i = list.size() - 1; i > -1; i--) {
                        insertStamp(list.get(i), insertRow);
                    }
                }
                // 病名を drop した場合,ここに入ってくる
                setDiagnosisCount();
            }
        };

        task.execute();
    }
View Full Code Here

            spec.setFromDate(past);
        }

        final DocumentDelegater ddl = new DocumentDelegater();

        DBTask task = new DBTask<List>(getContext()) {

            @Override
            protected List doInBackground() throws Exception {
                logger.debug("getDiagnosisHistory doInBackground");
                List result = ddl.getDiagnosisList(spec);
                return result;
            }

            @Override
            @SuppressWarnings("unchecked")
            protected void succeeded(List list) {
                logger.debug("getDiagnosisHistory succeeded");

                if (list == null) list = new ArrayList<RegisteredDiagnosisModel>();

                if (ddl.isNoError() && list.size() > 0) {
                    if (ascend) Collections.sort(list);
                    else Collections.sort(list, Collections.reverseOrder());
                }
                // addedDiagnosis がある場合は list に追加
                if (addedDiagnosis.size() > 0) {
                    if (ascend) {
                        for (RegisteredDiagnosisModel rd : addedDiagnosis) list.add(rd);
                    } else {
                        for (RegisteredDiagnosisModel rd : addedDiagnosis) list.add(0, rd);
                    }
                }
                // updateDiagnosis, DeletedDiagnosis はクリア
                updatedDiagnosis.clear();
                deletedDiagnosis.clear();

                // 新しく検索しなおしたリストをセット
                tableModel.setObjectList(list);
                setDiagnosisCount();

                // undo で最初に戻ったかどうか判定するため list を保存しておく
                initialDiagnosis.clear();
                for (RegisteredDiagnosisModel rd : (ArrayList<RegisteredDiagnosisModel>) list) {
                    initialDiagnosis.add(new DiagnosisLiteModel(rd));
                }

                // 最後に有効期限(disUseDate)が99999999以外に設定されていたら移行病名としてセット
                checkIkouByomei(list);
            }
        };
       
        task.execute();
    }
View Full Code Here

       
        final DocumentDelegater ddl = new DocumentDelegater();
        final DocumentModel saveModel = model;
        final Chart chart = this.getContext();

        DBTask task = new DBTask<String>(chart) {

            @Override
            protected String doInBackground() throws Exception {
                logger.debug("KarteSaveTask doInBackground");
                String ret = null;
                ddl.putKarte(saveModel);
               
                if (ddl.isNoError()) {
                    if (sendClaim) {
                        if (Project.getProjectStub().isUseOrcaApi()) {
                            OrcaApi api = OrcaApi.getInstance();
                            api.setContext(getContext());
                            api.send(saveModel);
                        } else {
                            claimSender.send(saveModel);
                        }
                    }
                    if (sendMml) {
                        sendMml(saveModel);
                    }
                } else {
                    ret = ddl.getErrorMessage();
                }
                return ret;
            }           

            @Override
            protected void succeeded(String errMsg) {
                logger.debug("KarteSaveTask succeeded");
                if (ddl.isNoError()) {
               
                    // 印刷
                    int copies = params.getPrintCount();
                    if (copies > 0) {
                        printPanel2(chart.getContext().getPageFormat(), copies, false);
                    }

                    // 編集不可に設定する
                    soaPane.setEditableProp(false);
                    if (getMode() == DOUBLE_MODE) pPane.setEditableProp(false);

                    // 状態遷移する
                    stateMgr.setSaved(true);

                    // Chart の状態を設定する
                    // Chart.setChartState しておけば,ChartImpl の fireChanged で PVT にも同じく反映される
                    // 今日のカルテをセーブした場合のみ chartState を変更する
                    // 今日受診していて,過去のカルテを修正しただけなのに診察完了になってしまうのを防ぐ

                    DocInfoModel docInfo = model.getDocInfo();
                    boolean isTodaysKarte = MMLDate.getDateTime("yyyy-MM-dd").equals(docInfo.getFirstConfirmDateTrimTime());
                    if (isTodaysKarte) {
                        if (docInfo.getStatus().equals(STATUS_TMP)) {
                            chart.setChartState(KarteState.OPEN_TEMP);
                        } else if (docInfo.getStatus().equals(STATUS_FINAL)) {
                            chart.setChartState(KarteState.OPEN_SAVE);
                        }
                    }
                    // 文書履歴の更新を通知する
                    chart.getDocumentHistory().getDocumentHistory(docInfo.getFirstConfirmDateTrimTime());

                    // save が終了したことを EditorFrame に知らせる
                    boundSupport.firePropertyChange(KarteEditor.SAVE_DONE, false, true);

                } else {
                    // errMsg を処理する
                    // エラーを表示する
                    JFrame parent = chart.getFrame();
                    String title = ClientContext.getString("karte.task.saveTitle");
                    JOptionPane.showMessageDialog(parent,
                            errMsg,
                            ClientContext.getFrameTitle(title),
                            JOptionPane.WARNING_MESSAGE);
                }
            }
        };
        task.execute();
    }
View Full Code Here

TOP

Related Classes of open.dolphin.helper.DBTask

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.