Package cli_fmw.delegate.directory.simple

Examples of cli_fmw.delegate.directory.simple.DirectorySimpleItem


       
        itemList.clear();
        if (directory != null) {
            Selector iie = directory.getItems();
            for (int i = 0; i < iie.size(); i++) {
                DirectorySimpleItem item = (DirectorySimpleItem) iie.get(i);
                if (satisfyFilter(item)) {
                    itemList.add(item);
                }
            }
        }
View Full Code Here


    protected abstract DirectorySimpleItem getNewItem(String title);

    private void btDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btDeleteActionPerformed
        try {
            if (jTable1.getSelectedRowCount() > 0) {
                DirectorySimpleItem item = ((TableModelDirectoryEdit) jTable1.getModel()).getItemAt(jTable1.getSelectedRowSorted());
                try {
                    SelectorEditableExceptional iie = currentDirectory.getItems();
                    for (int i = 0; i < iie.size(); i++) {
                        if (iie.get(i) == item) {
                            iie.remove(i);
View Full Code Here

}//GEN-LAST:event_btDeleteActionPerformed

    private void btChangeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btChangeActionPerformed
        try {
            DirectorySimpleItem item = ((TableModelDirectoryEdit) jTable1.getModel()).getItemAt(jTable1.getSelectedRowSorted());
            DialogDirectorySimpleM dialog = new DialogDirectorySimpleM((Frame) getContainer(), currentDirectory, item.getTitle());
            dialog.setVisible(true);
            if (dialog.getDlgResult() == ModalDialog.DLG_OK) {
                DirectorySimpleItem selectedItem = dialog.getSelectedItem();
                if (item == selectedItem) {
                    MessageBox.showWarning(MessageBox.W_SAME_DIRECTORY_ITEM);
                    return;
                }
                currentDirectory.replace(item, selectedItem);
View Full Code Here

        try {
            String result = JOptionPane.showInputDialog("Введите название");
            if (result == null) {
                return;
            }
            DirectorySimpleItem newItem = directoryTypes.initNewItem(result);
            directoryTypes.getItems().append(newItem);
            updateList();
            lstTypes.setSelectedValue(newItem, true);
        } catch (ClipsException ex) {
            MessageBox.showException(ex);
View Full Code Here

            MessageBox.showException(ex);
        }
}//GEN-LAST:event_btDeleteTypeActionPerformed

private void renameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_renameActionPerformed
        DirectorySimpleItem item = (DirectorySimpleItem) lstTypes.getSelectedValue();
        String result = JOptionPane.showInputDialog("Введите название");
        if (result == null) {
            return;
        }
        try {
            item.setTitle(result);//GEN-LAST:event_renameActionPerformed
        } catch (ClipsException ex) {
            MessageBox.showException(ex);
        }
}                                     
View Full Code Here

    protected void removeFromExtraCache(DirectoryTextTemplateTreeItem item) {
        if(item instanceof DirectoryTextTemplateTreeItem) {
            DirectoryTextTemplateTreeItem tree = item;
            Iterator<DirectorySimpleItem> keys = cache.keySet().iterator();
            while(keys.hasNext()) {
                DirectorySimpleItem key = keys.next();
                if(tree.inType(key)) {
                    cache.get(key).remove(tree);
                }
            }
        }       
View Full Code Here

    protected void addToExtraCache(DirectoryTextTemplateTreeItem item) {
        if(item instanceof DirectoryTextTemplateTreeItem) {
            DirectoryTextTemplateTreeItem tree = item;
            Iterator<DirectorySimpleItem> keys = cache.keySet().iterator();
            while(keys.hasNext()) {
                DirectorySimpleItem key = keys.next();
                if(tree.inType(key)) {
                    keys.remove();
                }
            }
        }     
View Full Code Here

                } catch (NumberFormatException ex) {
                    System.out.println("Предупреждение : Дата рождения пациента некорректна " + dbf.getName() + " lnum=(" + c.lnumber + ")");
                    out.println("Предупреждение : Дата рождения пациента некорректна " + dbf.getName() + " lnum=(" + c.lnumber + ")");
                }
                String insurAreaExtKey = fields.get(Col.INSUR_AREA).get().trim();
                DirectorySimpleItem area = dirRegionIdCode.getItemFromExtKey(insurAreaExtKey);
                c.insurAreaID = area == null ? 0 : area.getID();

                /* Если страховая компания местная то приоритетным полем
                 является INSUR_ORG, если не местная то приоритетной
                 является запись в KADR_DOP */
                DirectoryInsurerItem insPrior;
                DirectoryInsurerItem ins;
                if (insurAreaExtKey.equals("61")) {
                    insPrior = dirInsurer.getItemFromExtKey(fields.get(Col.INSUR_ORG).get().trim());
                    ins = dopIns.get(c.lnumber);
                } else {
                    ins = dirInsurer.getItemFromExtKey(fields.get(Col.INSUR_ORG).get().trim());
                    insPrior = dopIns.get(c.lnumber);
                }
                if (insPrior != null) {
                    c.insurOrgID = insPrior.getID();
                } else if (ins != null) {
                    c.insurOrgID = ins.getID();
                } else {
                    c.insurOrgID = 0;
                }
                String klRegion = fields.get(Col.KLREGION).get().trim();
                String klItem = fields.get(Col.KLITEM).get().trim();
                String klStreet = fields.get(Col.KLSTREET).get().trim();
                c.house = fields.get(Col.HOUSE).get().trim();
                c.letter = fields.get(Col.LETTER).get().trim().toUpperCase();
                c.room = fields.get(Col.ROOM).get().trim();
                DirectorySimpleItem status = dirSocialStatus.getItemFromExtKey(fields.get(Col.SOCSTATUS).get().trim());
                if (status != null && status.getID() == SocialStatus.STATUS_OFNA) {
                    status = dirSocialStatus.getItemFromID(SocialStatus.STATUS_NOT_WORKING);
                }
                if (status != null && status.getID() == SocialStatus.STATUS_PRESCHOOL_UNDISCIPLINED) {
                    status = dirSocialStatus.getItemFromID(SocialStatus.STATUS_PRESCHOOL_DISCIPLINED);
                }
                c.socStatusID = status == null ? 0 : status.getID();
                if (c.socStatusID == null) {
                    c.socStatusID = 0;
                }
                DirectoryDistrictItem district = dirDistrict.getItemFromTitle(fields.get(Col.UCH).get().trim());
                c.districtID = district == null ? 0 : district.getID();


                String work = fields.get(Col.IDWORK).get().trim();
                if (work.isEmpty() || work.equals("0")) {
                    c.job = "";
                } else {
                    c.job = jobMap.get(work);
                    if (c.job == null) {
                        c.job = "";
                    }
                }
                String prof = fields.get(Col.PROF).get().trim();
                if (prof.isEmpty()) {
                    c.appointmentID = 0;
                } else {
                    c.appointmentID = dirApp.getItemFromTitle(Converter.firstUpper(prof, false)).getID();
                }


                c.inn = fields.get(Col.INN).get().trim();
                c.polSeria = fields.get(Col.POLSERIA).get().trim();
                c.polNumber = fields.get(Col.POLNUMBER).get().trim();
                DirectorySimpleItem doctype = dirDocumentType.getItemFromExtKey(fields.get(Col.DOCUMENT).get().trim());
                c.docTypeID = doctype == null ? 0 : doctype.getID();
                if (c.docTypeID == null) {
                    c.docTypeID = ClientDocumentType.TYPE_PASSPORT_RF;
                }
                c.docSeria = fields.get(Col.DOCSERIA).get().trim();
                c.docNumber = fields.get(Col.DOCNUMBER).get().trim();
View Full Code Here

                    System.out.println("Предупреждение : Дата рождения пациента некорректна " + dbf.getName() + " snils=(" + c.snils + ")");
                    out.println("Предупреждение : Дата рождения пациента некорректна " + dbf.getName() + " snils=(" + c.snils + ")");
                }

                //документ, удостоверяющий личность
                DirectorySimpleItem doctype = dirDocumentType.getItemFromExtKey(fields.get(Col.C_DOC).get().trim());
                if (doctype == null) {
                    c.docTypeId = 0;
                    System.out.println("Предупреждение : не найден тип документа " + dbf.getName() + " snils=(" + c.snils + ")");
                    out.println("Предупреждение : не найден тип документа " + dbf.getName() + " snils=(" + c.snils + ")");
                }
                else {
                    c.docTypeId = doctype.getID();
                }
                c.docSN = fields.get(Col.SN_DOC).get().trim();

                //адрес, регистрация
                c.address = fields.get(Col.ADRES).get().trim();
                c.building = fields.get(Col.DOM).get().trim();
                c.corpus = fields.get(Col.KOR).get().trim();
                c.flat = fields.get(Col.KV).get().trim();
                c.okatoReg = fields.get(Col.OKATO_REG).get().trim();

                //льготность
                Integer flag = null;
                try {
                    flag = Integer.parseInt(fields.get(Col.S_EDV).get().trim());
                    if (flag < 0 || flag > 1) {
                        throw new NumberFormatException();
                    }
                } catch (NumberFormatException ex) {
                    flag = null;
                    System.out.println("Предупреждение : признак получения НСУ некорректен " + dbf.getName() + " snils=(" + c.snils + ")");
                    out.println("Предупреждение : признак получения НСУ некорректен " + dbf.getName() + " snils=(" + c.snils + ")");
                }
                c.flagNSU = flag;
                c.nsuBegin = null;
                try {
                    Calendar nsuBegin = ((DateField)fields.get(Col.DB_EDV)).getCalendar();
                    if (Comparator.dataEqual(nullDate, nsuBegin.getTime())) {
                        c.nsuBegin = null;
                    }
                    else {
                        c.nsuBegin = nsuBegin.getTime();
                    }
                } catch (NumberFormatException ex) {
                    System.out.println("Предупреждение : Дата начала действия права на получение НСУ некорректна " + dbf.getName() + " snils=(" + c.snils + ")");
                    out.println("Предупреждение : Дата начала действия права на получение НСУ некорректна " + dbf.getName() + " snils=(" + c.snils + ")");
                }
                c.nsuEnd = null;
                try {
                    Calendar nsuEnd = ((DateField)fields.get(Col.DE_EDV)).getCalendar();
                    if (Comparator.dataEqual(nullDate, nsuEnd.getTime())) {
                        c.nsuEnd = null;
                    }
                    else {
                        c.nsuEnd = nsuEnd.getTime();
                    }
                } catch (NumberFormatException ex) {
                    System.out.println("Предупреждение : Дата окончания действия права на получение НСУ некорректна " + dbf.getName() + " snils=(" + c.snils + ")");
                    out.println("Предупреждение : Дата окончания действия права на получение НСУ некорректна " + dbf.getName() + " snils=(" + c.snils + ")");
                }
                DirectorySimpleItem exemp1 = dirExemption.getItemFromExtKey(fields.get(Col.C_KAT1).get().trim());
                if (exemp1 == null) {
                    c.exemp1Id = 0;
                }
                else {
                    c.exemp1Id = exemp1.getID();
                }
                DirectorySimpleItem exemp2 = dirExemption.getItemFromExtKey(fields.get(Col.C_KAT2).get().trim());
                if (exemp2 == null) {
                    c.exemp2Id = 0;
                }
                else {
                    c.exemp2Id = exemp2.getID();
                }

                if (c.exemp1Id == 0 && c.exemp2Id == 0) {
                    System.out.println("Предупреждение : не найдена категория льготности " + dbf.getName() + " snils=(" + c.snils + ")");
                    out.println("Предупреждение : не найдена категория льготности " + dbf.getName() + " snils=(" + c.snils + ")");
                }
                else if (c.exemp1Id != 0 && c.exemp2Id != 0) {
                    System.out.println("Предупреждение : указаны две категории льготности " + dbf.getName() + " snils=(" + c.snils + ")");
                    out.println("Предупреждение : указаны две категории льготности " + dbf.getName() + " snils=(" + c.snils + ")");
                }

                //даты включения в регистр и исключения из регистра
                c.regBegin = null;
                try {
                    Calendar regBegin = ((DateField)fields.get(Col.DATE_RSB)).getCalendar();
                    if (Comparator.dataEqual(nullDate, regBegin.getTime())) {
                        c.regBegin = null;
                    }
                    else {
                        c.regBegin = regBegin.getTime();
                    }
                } catch (NumberFormatException ex) {
                    System.out.println("Предупреждение : Дата включения в региональный Регистр некорректна " + dbf.getName() + " snils=(" + c.snils + ")");
                    out.println("Предупреждение : Дата включения в региональный Регистр некорректна " + dbf.getName() + " snils=(" + c.snils + ")");
                }
                c.regEnd = null;
                try {
                    Calendar regEnd = ((DateField)fields.get(Col.DATE_RSE)).getCalendar();
                    if (Comparator.dataEqual(nullDate, regEnd.getTime())) {
                        c.regEnd = null;
                    }
                    else {
                        c.regEnd = regEnd.getTime();
                    }
                } catch (NumberFormatException ex) {
                    System.out.println("Предупреждение : Дата исключения из регионального Регистра некорректна " + dbf.getName() + " snils=(" + c.snils + ")");
                    out.println("Предупреждение : Дата исключения из регионального Регистра некорректна " + dbf.getName() + " snils=(" + c.snils + ")");
                }

                //признак "особый случай"
                c.dType = fields.get(Col.D_TYPE).get().trim();

                c.c_reg = fields.get(Col.C_REG).get().trim();

                clientList.add(c);
            } catch (IOException ex) {
                closeDBF(dbf);
                throw new ClipsException("Ошибка при чтении данных из файла " + dbf.getName() + " (строка " + i + ")", ex);
            } catch (xBaseJException ex) {
                closeDBF(dbf);
                throw new ClipsException("Ошибка при чтении данных из файла " + dbf.getName() + " (строка " + i + ")", ex);
            }
        }
        closeDBF(dbf);
        GregorianCalendar gc2 = new GregorianCalendar();
        long mc = gc2.getTimeInMillis() - gc1.getTimeInMillis();
        System.out.println("Закончилось чтение льготников из файла. Work time: " + mc + " ms");
        out.println("Закончилось чтение льготников из файла. Work time: " + mc + " ms");

       
        File fileDoc = new File(cfg.getLastDBFImportPath(), "C_REGL.DBF");
        DBF dbfDoc = createDBF(fileDoc);
        HashMap<ColDoc, Field> docFields = new HashMap<ColDoc, Field>();
        try {
            for (int i = 0; i < ColDoc.values().length; i++) {
                ColDoc col = ColDoc.values()[i];
                docFields.put(col, dbfDoc.getField(col.toString()));
            }
        } catch (xBaseJException ex) {
            throw new ClipsException("Ошибка при чтении данных из файла " + dbfDoc.getName(), ex);
        }
        recordCount = dbfDoc.getRecordCount();

        gc1 = new GregorianCalendar();
        ArrayList<FacilityDocumentDetails> docList = new ArrayList<FacilityDocumentDetails>(recordCount);

        Set<String> snilsSet = new HashSet<String>();

        for (int i = 0; i < recordCount; i++) {
            try {
                dbfDoc.read();
                if ((counter%500) == 0) {
                    try {
                        UserInfo.get().disturbServer();
                    } catch (Throwable ex) {
                        //пофиг
                    }
                }
                if ((i%1000) == 0) {
                    System.out.println("Обновление данных о документах льготности : " +  i/((float)recordCount)*100 + "% (" + i + ") запись");
                    gc2 = new GregorianCalendar();
                    mc = gc2.getTimeInMillis() - gc1.getTimeInMillis();
                    System.out.println("Work time: " + mc + " ms");
                }
                if (dbfDoc.deleted()) {
                    continue;
                }
                FacilityDocumentDetails d = new FacilityDocumentDetails();

                String snils = docFields.get(ColDoc.SS).get().trim();

                Integer uType = snilsMap.get(snils);
                if (snilsSet.contains(snils) && uType != null && uType != FacilityClient.CHANGES_IN_INFO) {
                    throw new ClipsException("Повторяющийся СНИЛС " + dbfDoc.getName() + " snils=(" + snils + ")" + " строка=" + i);
                }
                snilsSet.add(snils);
               
                d.snils = snils;

                DirectorySimpleItem exemp = dirExemption.getItemFromExtKey(docFields.get(ColDoc.C_KAT).get().trim());
                if (exemp == null) {
                    d.exempId = 0;
                    System.out.println("Предупреждение : не найден тип льготности " + dbfDoc.getName() + " snils=(" + d.snils + ")");
                    out.println("Предупреждение : не найден тип льготности " + dbfDoc.getName() + " snils=(" + d.snils + ")");
                }
                else {
                    d.exempId = exemp.getID();
                }
                d.docType = docFields.get(ColDoc.NAME_DL).get().trim();
                d.docSN = docFields.get(ColDoc.SN_DL).get().trim();

                d.gspBegin = null;
View Full Code Here

        try {
            int[] rows = tableServiceList.getSelectedRowsSorted();
            if (rows.length > 0) {
                if (packetService != null) {
                    if (rows.length < packetService.getPacketItemCount()) {
                        DirectorySimpleItem medexamType = packetService.getmedexamType();
                        if (medexamType.getID() != 0) {
                            MessageBox.showWarning("Невозможно расформировать пакет " + medexamType.getTitle());
                            return;
                        }
                        if (MessageBox.showConfirmYesNo(MessageBox.C_DEL_SERV_FROM_PACK) ==
                                MessageBox.ANSWER_NO) {
                            return;
View Full Code Here

TOP

Related Classes of cli_fmw.delegate.directory.simple.DirectorySimpleItem

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.