Package framework.beans.client.clientDocument

Examples of framework.beans.client.clientDocument.ClientDocument


            if (address2 != null) {
                manager.remove(address2);
                System.out.println("          remove address2. cl1 has already address1");
            }
        }
        ClientDocument doc1 = dst.getClientDocument();
        ClientDocument doc2 = src.getClientDocument();
        if (doc1 == null) {
            if (doc2 != null) {
                dst.setClientDocument(doc2);
                System.out.println("          cl1 set doc2");
            }
View Full Code Here


    @Override
    public ClientDocumentDetails getClientDocument() throws ClipsServerException {
        checkCommandAccessibility(COMMAND_READ);
        Client entity = getExistentEntity();
        ClientDocument doc = entity.getClientDocument();
        if (doc == null) {
            doc = new ClientDocument();
        }
        return doc.getDetails(this);
    }
View Full Code Here

    public ModificationInfo setClientDocument(ClientDocumentDetails details) throws ClipsServerException {
        checkCommandAccessibility(COMMAND_MODIFY);

        Client entity = getExistentEntity();
        AuditDoc<Client> auditDoc = new AuditDoc<Client>(entity, getCollaborator());
        ClientDocument doc = entity.getClientDocument();
       
        if (details.typeID == 0) {
            if (doc != null) {
                entity.setClientDocument(null);
                saveEntity(entity);
                removeEntity(doc);
            }
        }
        else {
            boolean newDoc = false;
            if (doc == null) {
                doc = new ClientDocument();
                newDoc = true;
            }

            doc.setNumber(details.number);
            doc.setSeries(details.series);
            doc.setDate(details.date);
            doc.setDoctype(findEntity(ClientDocumentType.class, details.typeID));
            doc.setGivenPlace(details.enterpriseID == 0 ? null : findEntity(DocumentGivenPlace.class, details.enterpriseID));

            saveEntity(doc);
            if(newDoc) {
                entity.setClientDocument(doc);
                saveEntity(entity);
View Full Code Here

            Client representative = null;
            if (sr.getPolis().getNumber().equals(Polis.FICTIVE_POLIS_NUMBER)) {
                representative = client.getRepresentative();
            }

            ClientDocument doc;
            Polis polis;
            if (representative != null) {
                rd.p_status = client.getRepresentativeStatus().getId();
                rd.p_fam = representative.getSurname() == null ? 0 : representative.getSurname().getId();
                rd.p_nam = representative.getName() == null ? 0 : representative.getName().getId();
                rd.p_fnam = representative.getPathronymic() == null ? 0 : representative.getPathronymic().getId();
                rd.pred = 1;
                doc = representative.getClientDocument();
                polis = ClientBean.findPolisOMI(representative, manager);
            } else {
                rd.p_status = 0;
                rd.p_fam = 0;
                rd.p_nam = 0;
                rd.p_fnam = 0;
                rd.pred = 0;
                doc = client.getClientDocument();
                polis = sr.getPolis();
            }
            rd.pol_ser = polis.getSeries();
            rd.pol_num = polis.getNumber();
            if (rd.pol_num.equals(Polis.FICTIVE_POLIS_NUMBER)) {
                rd.pol_num = "";
                rd.pol_ser = "";
            }
            if (address != null) {
                AddressObject country = address.getAddressObject();
                while (country.getParent() != null) {
                    country = country.getParent();
                }
                rd.c_oksm = country.getKladrCode();
            } else {
                //Если указан российский пасспорт считаем что гражданство российское
                if (doc != null && doc.getDoctype().getId() == ClientDocumentType.TYPE_PASSPORT_RF) {
                    rd.c_oksm = "643";
                } else {
                    rd.c_oksm = "";
                }
            }
            rd.type_doc = doc != null ? doc.getDoctype().getId() : 0;
            rd.doc_ser = doc != null ? doc.getSeries() : "";
            rd.doc_num = doc != null ? doc.getNumber() : "";
            //Обрезание до 20 символов
            if (rd.doc_num.length() > 20) {
                rd.doc_num = rd.doc_num.substring(0, 20);
            }
           
View Full Code Here

    private void replaceClientDocumentType(DirectoryEntity entityWhat, DirectoryEntity entityWith) {
        //ClientDocument
        List entityList = findEntityList(ClientDocument.class, "doctype", entityWhat);
        for (int i = 0; i < entityList.size(); i++) {
            ClientDocument cdt = (ClientDocument) entityList.get(i);
            cdt.setDoctype((ClientDocumentType) entityWith);
            manager.merge(cdt);
        }
        removeEntity(entityWhat);
        manager.flush();
    }
View Full Code Here

    private void replaceDocumentGivenPlace(DirectoryEntity entityWhat, DirectoryEntity entityWith) {
        //DocumentGivenPlace
        List<ClientDocument> entityList = findEntityList(ClientDocument.class, "enterprise", entityWhat);
        for (int i = 0; i < entityList.size(); i++) {
            ClientDocument p  = (ClientDocument) entityList.get(i);
            p.setGivenPlace((DocumentGivenPlace) entityWith);
            manager.merge(p);
        }
        removeEntity(entityWhat);
        manager.flush();
    }
View Full Code Here

                }
                if (ex != null) {
                    data.exemptionID = ex.getExtKey();
                }

                ClientDocument doc = client.getClientDocument();
                if (doc != null) {
                    ClientDocumentType type = doc.getDoctype();
                    if (type != null) {
                        data.docTypeID = type.getExtKey();
                    }
                    String docSN ="";
                    if (doc.getSeries() != null) {
                        docSN = doc.getSeries();
                    }
                    if (doc.getNumber() != null) {
                        docSN = docSN + " " + doc.getNumber();
                    }
                    data.docSN = docSN.trim();
                }
                else {
                    ClientDocumentType type = fc.getDocumentType();
View Full Code Here

TOP

Related Classes of framework.beans.client.clientDocument.ClientDocument

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.