Example usage for com.vaadin.server VaadinService getCurrent

List of usage examples for com.vaadin.server VaadinService getCurrent

Introduction

In this page you can find the example usage for com.vaadin.server VaadinService getCurrent.

Prototype

public static VaadinService getCurrent() 

Source Link

Document

Gets the currently used Vaadin service.

Usage

From source file:com.cms.utils.FileUtils.java

public static String getParthTemplateImportStock() {
    String path = VaadinService.getCurrent().getBaseDirectory().getAbsolutePath();
    path = path + "/VAADIN/filetemplate/" + "importstock.docx";
    //xuat file       
    return path;/*from   w  w w .  j  a va 2s. c  o  m*/
}

From source file:com.cms.utils.FileUtils.java

public static String getParthExportFileImportStock() {
    String path = VaadinService.getCurrent().getBaseDirectory().getAbsolutePath();

    String filePath = path + "/VAADIN/filetemplate/" + RandomStringUtils.randomAlphabetic(12) + ".docx";
    return filePath;
}

From source file:com.example.sudoku.ButtonListener.java

@Override
public void buttonClick(Button.ClickEvent event) {
    try {/*from ww  w .  j  a va2s . c o m*/
        String basepath = VaadinService.getCurrent().getBaseDirectory().getAbsolutePath();
        fis = new FileInputStream(basepath + "/files/" + level);
        isr = new InputStreamReader(fis);
        BufferedReader br = new BufferedReader(isr);
        String sCurrentLine;

        int row = 0;
        int col = 0;
        while ((sCurrentLine = br.readLine()) != null) {

            String[] field = sCurrentLine.split(" ");

            col = 0;
            for (String s : field) {
                // set to ReadOnly to false to allow for update
                board.setReadOnly(col, row, false);
                board.setValue(col, row, s, s.equals("0") ? false : true);
                col++;
            }
            row++;
        }

        // update the tiles for display
        for (col = 0; col < 9; col++) {
            for (row = 0; row < 9; row++) {
                Label label = (Label) ((DragAndDropWrapper) grid.getComponent(col, row)).getData();
                label.setPropertyDataSource(board.getCellElement(col, row));

            }
        }
        Notification.show(level + " mode set succesfully", Notification.Type.WARNING_MESSAGE);

    } catch (FileNotFoundException ex) {
        Logger.getLogger(UploadReceiver.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(UploadReceiver.class.getName()).log(Level.SEVERE, null, ex);
    }

}

From source file:com.foc.vaadin.FocWebVaadinWindow.java

License:Apache License

public String getPathInfo() {
    VaadinRequest vaadinRequest = VaadinService.getCurrent().getCurrentRequest();
    String path = vaadinRequest != null ? vaadinRequest.getPathInfo() : null;
    return path;/*from   ww  w .j a v  a  2 s .c o m*/
}

From source file:com.gnts.pem.txn.sbi.SBIBuilding.java

private void updateEvaluationDetails() {
    try {//from  w ww  .  j a  v a  2  s. co m
        boolean valid = false;
        TPemCmEvalDetails evalobj = new TPemCmEvalDetails();
        evalNumber = tfEvaluationNumber.getValue();
        customer = tfCustomerName.getValue();
        propertyType = "BUILDING";
        String basepath = VaadinService.getCurrent().getBaseDirectory().getAbsolutePath();

        File file = new File(
                basepath + "/WEB-INF/PEM-DOCS/" + evalNumber + "_" + customer + "_" + propertyType + ".doc");
        FileInputStream fin = new FileInputStream(file);
        byte fileContent[] = new byte[(int) file.length()];
        fin.read(fileContent);
        fin.close();
        evalobj.setDocId(headerid);
        evalobj.setEvalDoc(fileContent);
        evalobj.setDocStatus(Common.DOC_PENDING);
        evalobj.setDocDate(dfDateofValuation.getValue());
        evalobj.setEvalNo(tfEvaluationNumber.getValue());
        evalobj.setEvalDate(dfDateofValuation.getValue());
        evalobj.setValuationBy(tfValuatedBy.getValue());
        MPemCmBank bankid = new MPemCmBank();
        bankid.setBankId(selectedBankid);
        evalobj.setBankId(bankid);
        evalobj.setDoctype(screenName);
        evalobj.setCompanyId(selectCompanyid);
        evalobj.setBankBranch((String) slBankBranch.getValue());
        evalobj.setEvalPurpose(tfEvaluationPurpose.getValue());
        evalobj.setEvalDate(dfDateofValuation.getValue());
        evalobj.setCheckedBy(tfVerifiedBy.getValue());
        evalobj.setCheckedDt(dfVerifiedDate.getValue());
        evalobj.setInspectionDt(dfDateofValuation.getValue());
        evalobj.setInspectionBy(tfValuatedBy.getValue());
        evalobj.setLastUpdateDt(new Date());
        evalobj.setLastUpdtedBy(loginusername);
        evalobj.setCustName(tfCustomerName.getValue());

        if (tfDynamicEvaluation1.getValue() != null && tfDynamicEvaluation1.getValue().trim().length() > 0) {
            evalobj.setCustomLbl1(tfDynamicEvaluation1.getCaption());
            evalobj.setCustomValue1(tfDynamicEvaluation1.getValue());
        }
        if (tfDynamicEvaluation2.getValue() != null && tfDynamicEvaluation2.getValue().trim().length() > 0) {
            evalobj.setCustomValue2(tfDynamicEvaluation2.getCaption());
            evalobj.setCustomValue2(tfDynamicEvaluation2.getValue());
        }
        beanEvaluation.saveorUpdateEvalDetails(evalobj);
        uiflowdata.setEvalDtls(evalobj);

        try {
            BigDecimal totalAbstract = new BigDecimal(0.00);
            BigDecimal test = new BigDecimal("0.00");
            BigDecimal test1 = new BigDecimal("0.00");
            BigDecimal test2 = new BigDecimal("0.00");
            BigDecimal test3 = new BigDecimal("0.00");
            BigDecimal test4 = new BigDecimal("0.00");
            BigDecimal test5 = new BigDecimal("0.00");
            try {
                test = new BigDecimal(
                        uiflowdata.getTotalExtraItem().replaceFirst("\\.0+$", "").replaceAll("[^0-9]", ""));

            } catch (Exception e) {
                test = new BigDecimal("0.00");
            }
            try {
                test1 = new BigDecimal(
                        tfFairMarketRate.getValue().replaceFirst("\\.0+$", "").replaceAll("[^0-9]", ""));
            } catch (Exception e) {
                test1 = new BigDecimal("0.00");
            }
            try {
                test2 = new BigDecimal(
                        uiflowdata.getTotalAdditional().replaceFirst("\\.0+$", "").replaceAll("[^0-9]", ""));
            } catch (Exception e) {
                test2 = new BigDecimal("0.00");
            }
            try {
                test3 = new BigDecimal(
                        uiflowdata.getTotalMiscellaneous().replaceFirst("\\.0+$", "").replaceAll("[^0-9]", ""));

            } catch (Exception e) {
                test3 = new BigDecimal("0.00");
            }
            try {
                test4 = new BigDecimal(
                        uiflowdata.getTotalServices().replaceFirst("\\.0+$", "").replaceAll("[^0-9]", ""));
            } catch (Exception e) {
                test4 = new BigDecimal("0.00");
            }
            try {
                test5 = new BigDecimal(
                        uiflowdata.getTotalValuation().replaceFirst("\\.0+$", "").replaceAll("[^0-9]", ""));
            } catch (Exception e) {
                test5 = new BigDecimal("0.00");
            }
            totalAbstract = totalAbstract.add(test).add(test1).add(test2).add(test3).add(test4).add(test5);

            uiflowdata.setTotalAbstractvalue(XMLUtil.IndianFormat(new BigDecimal(totalAbstract.toString())));
            String numberOnly = totalAbstract.toString().replaceAll("[^\\d.]", "");
            if (numberOnly.trim().length() == 0) {
                numberOnly = "0";
            }
            uiflowdata.setAmountInWords(beanEvaluation.getAmountInWords(numberOnly));
            evalobj.setPropertyValue(Double.valueOf(numberOnly));
            //beanEvaluation.saveorUpdateEvalDetails(evalobj);
            uiflowdata.setEvalDtls(evalobj);
            if (tfEvaluationNumber.isValid() && slBankBranch.isValid() && tfEvaluationPurpose.isValid()
                    && dfDateofValuation.isValid() && tfCustomerName.isValid()
                    && tfAdopetdMarketRate.isValid()) {

                if (count == 0) {
                    beanEvaluation.saveorUpdateEvalDetails(evalobj);

                    valid = true;
                }
                lblNotificationIcon.setIcon(new ThemeResource("img/success_small.png"));
                lblSaveNotification.setValue("Successfully Submitted");
            }

            if (valid) {
                /*populateAndConfig(false);
                resetAllFieldsFields();*/
                btnSubmit.setEnabled(false);
            } else {
                btnSubmit.setComponentError(new UserError("Form is invalid"));
            }

        } catch (Exception e) {

        }

    } catch (Exception e) {
        lblNotificationIcon.setIcon(new ThemeResource("img/failure.png"));
        lblSaveNotification.setValue("Submit failed, please check the data and try again ");
        logger.info("Error on SaveApproveReject Status function--->" + e);
    }
}

From source file:com.gnts.pem.txn.sbi.SBIConstruction.java

private void updateEvaluationDetails() {
    try {//from  w w w. jav  a2 s . c om
        boolean valid = false;
        TPemCmEvalDetails evalobj = new TPemCmEvalDetails();
        evalNumber = tfEvaluationNumber.getValue();
        customer = tfCustomerName.getValue();
        propertyType = "CONSTRUCTION";
        String basepath = VaadinService.getCurrent().getBaseDirectory().getAbsolutePath();
        File file = new File(
                basepath + "/WEB-INF/PEM-DOCS/" + evalNumber + "_" + customer + "_" + propertyType + ".doc");
        FileInputStream fin = new FileInputStream(file);
        byte fileContent[] = new byte[(int) file.length()];
        fin.read(fileContent);
        fin.close();
        evalobj.setDocId(headerid);
        evalobj.setEvalDoc(fileContent);
        evalobj.setDocStatus(Common.DOC_PENDING);
        evalobj.setDocDate(dfDateofValuation.getValue());
        evalobj.setEvalNo(tfEvaluationNumber.getValue());
        evalobj.setEvalDate(dfDateofValuation.getValue());
        evalobj.setValuationBy(tfValuatedBy.getValue());
        MPemCmBank bankid = new MPemCmBank();
        bankid.setBankId(selectedBankid);
        evalobj.setBankId(bankid);
        evalobj.setDoctype(screenName);
        evalobj.setCompanyId(selectCompanyid);
        evalobj.setBankBranch((String) slBankBranch.getValue());
        evalobj.setEvalPurpose(tfEvaluationPurpose.getValue());
        evalobj.setEvalDate(dfDateofValuation.getValue());
        evalobj.setCheckedBy(tfVerifiedBy.getValue());
        evalobj.setCheckedDt(dfVerifiedDate.getValue());
        evalobj.setInspectionDt(dfDateofValuation.getValue());
        evalobj.setInspectionBy(tfValuatedBy.getValue());
        evalobj.setLastUpdateDt(new Date());
        evalobj.setLastUpdtedBy(loginusername);
        evalobj.setCustName(tfCustomerName.getValue());

        if (tfDynamicEvaluation1.getValue() != null && tfDynamicEvaluation1.getValue().trim().length() > 0) {
            evalobj.setCustomLbl1(tfDynamicEvaluation1.getCaption());
            evalobj.setCustomValue1(tfDynamicEvaluation1.getValue());
        }
        if (tfDynamicEvaluation2.getValue() != null && tfDynamicEvaluation2.getValue().trim().length() > 0) {
            evalobj.setCustomValue2(tfDynamicEvaluation2.getCaption());
            evalobj.setCustomValue2(tfDynamicEvaluation2.getValue());
        }

        BigDecimal construction = new BigDecimal(0.00);
        BigDecimal totalFair = new BigDecimal(0.00);
        BigDecimal fairMarket = new BigDecimal(0.00);
        BigDecimal totalRealizable = new BigDecimal(0.00);
        BigDecimal totalDistress = new BigDecimal(0.00);
        BigDecimal totalGuide = new BigDecimal(0.00);
        BigDecimal test = new BigDecimal("0.00");
        BigDecimal test1 = new BigDecimal("0.00");
        BigDecimal test2 = new BigDecimal("0.00");
        BigDecimal test3 = new BigDecimal("0.00");
        BigDecimal test4 = new BigDecimal("0.00");

        try {
            test = new BigDecimal(
                    tfCostConstruction.getValue().replaceFirst("\\.0+$", "").replaceAll("[^0-9]", ""));

        } catch (Exception e) {
            test = new BigDecimal("0.00");

        }
        try {
            test1 = new BigDecimal(
                    tfFairMarketRate.getValue().replaceFirst("\\.0+$", "").replaceAll("[^0-9]", ""));

        } catch (Exception e) {

            test1 = new BigDecimal("0.00");
        }

        try {
            test4 = new BigDecimal(
                    tfGuidelineRate.getValue().replaceFirst("\\.0+$", "").replaceAll("[^0-9]", ""));

        } catch (Exception e) {

            test4 = new BigDecimal("0.00");
        }
        try {
            construction = construction.add(test);
            fairMarket = fairMarket.add(test1);
            totalFair = totalFair.add(test1).add(construction);
            uiflowdata.setTotalExtraItem(XMLUtil.IndianFormat(new BigDecimal(totalFair.toString())));

            totalGuide = totalGuide.add(test4);
            uiflowdata.setTotalServices(XMLUtil.IndianFormat(new BigDecimal(totalGuide.toString())));

            uiflowdata.setTotalAbstractvalue(XMLUtil.IndianFormat(new BigDecimal(totalFair.toString())));
            String numberOnly = totalFair.toString().replaceAll("[^\\d.]", "");
            if (numberOnly.trim().length() == 0) {
                numberOnly = "0";
            }
            uiflowdata.setAmountInWords(beanEvaluation.getAmountInWords(numberOnly));
            String numberOnly1 = tfGuidelineRate.getValue().replaceAll("[^0-9]", "");
            uiflowdata.setAmountWordsGuideline(beanEvaluation.getAmountInWords(numberOnly1));
            evalobj.setPropertyValue(Double.valueOf(numberOnly));
            beanEvaluation.saveorUpdateEvalDetails(evalobj);
            uiflowdata.setEvalDtls(evalobj);
            if (tfEvaluationNumber.isValid() && slBankBranch.isValid() && tfEvaluationPurpose.isValid()
                    && dfDateofValuation.isValid()) {

                if (count == 0) {
                    beanEvaluation.saveorUpdateEvalDetails(evalobj);

                    valid = true;
                }
                lblNotificationIcon.setIcon(new ThemeResource("img/success_small.png"));
                lblSaveNotification.setValue("Successfully Submitted");
            }

            if (valid) {
                /*populateAndConfig(false);
                resetAllFieldsFields();*/
                btnSubmit.setEnabled(false);
            } else {
                btnSubmit.setComponentError(new UserError("Form is invalid"));
            }
        } catch (Exception e) {

            logger.info("Error-->" + e);
        }

    } catch (Exception e) {
        lblNotificationIcon.setIcon(new ThemeResource("img/failure.png"));
        lblSaveNotification.setValue("Submit failed, please check the data and try again ");
        logger.info("Error on SaveApproveReject Status function--->" + e);
    }
}

From source file:com.gnts.pem.txn.sbi.SBIConstructionBuilding.java

private void updateEvaluationDetails() {
    System.out.println("Inside Update Evaluation");
    try {//  w w  w .j  a va 2  s  .  co m
        boolean valid = false;
        TPemCmEvalDetails evalobj = new TPemCmEvalDetails();
        evalNumber = tfEvaluationNumber.getValue();
        customer = tfCustomerName.getValue();
        propertyType = "UNDERCONSTRUTIONBUILDING";

        evalobj.setDocId(headerid);
        evalobj.setDocStatus(Common.DOC_PENDING);
        evalobj.setDocDate(dfDateofValuation.getValue());
        evalobj.setEvalNo(tfEvaluationNumber.getValue());
        evalobj.setEvalDate(dfDateofValuation.getValue());
        evalobj.setValuationBy(tfValuatedBy.getValue());
        MPemCmBank bankid = new MPemCmBank();
        bankid.setBankId(selectedBankid);
        evalobj.setBankId(bankid);
        evalobj.setDoctype(screenName);
        evalobj.setCompanyId(selectCompanyid);
        evalobj.setBankBranch((String) tfBankBranch.getValue());
        evalobj.setEvalPurpose(tfEvaluationPurpose.getValue());
        evalobj.setEvalDate(dfDateofValuation.getValue());
        evalobj.setCheckedBy(tfVerifiedBy.getValue());
        evalobj.setCheckedDt(dfVerifiedDate.getValue());
        evalobj.setInspectionDt(dfDateofValuation.getValue());
        evalobj.setInspectionBy(tfValuatedBy.getValue());
        evalobj.setLastUpdateDt(new Date());
        evalobj.setLastUpdtedBy(loginusername);
        evalobj.setCustName(tfCustomerName.getValue());

        if (tfDynamicEvaluation1.getValue() != null && tfDynamicEvaluation1.getValue().trim().length() > 0) {
            evalobj.setCustomLbl1(tfDynamicEvaluation1.getCaption());
            evalobj.setCustomValue1(tfDynamicEvaluation1.getValue());
        }
        if (tfDynamicEvaluation2.getValue() != null && tfDynamicEvaluation2.getValue().trim().length() > 0) {
            evalobj.setCustomValue2(tfDynamicEvaluation2.getCaption());
            evalobj.setCustomValue2(tfDynamicEvaluation2.getValue());
        }
        try {
            BigDecimal totalAbstract = new BigDecimal(0.00);
            BigDecimal test = new BigDecimal("0.00");
            BigDecimal test1 = new BigDecimal("0.00");
            BigDecimal test2 = new BigDecimal("0.00");
            BigDecimal test3 = new BigDecimal("0.00");
            BigDecimal test4 = new BigDecimal("0.00");
            BigDecimal test5 = new BigDecimal("0.00");
            try {
                test = new BigDecimal(
                        uiflowdata.getTotalExtraItem().replaceFirst("\\.0+$", "").replaceAll("[^0-9]", ""));

            } catch (Exception e) {
                test = new BigDecimal("0.00");
            }
            try {
                test1 = new BigDecimal(
                        uiflowdata.getMarketValue().replaceFirst("\\.0+$", "").replaceAll("[^0-9]", ""));
            } catch (Exception e) {
                test1 = new BigDecimal("0.00");
            }
            try {
                test2 = new BigDecimal(
                        uiflowdata.getTotalAdditional().replaceFirst("\\.0+$", "").replaceAll("[^0-9]", ""));
            } catch (Exception e) {
                test2 = new BigDecimal("0.00");
            }
            try {
                test3 = new BigDecimal(
                        uiflowdata.getTotalMiscellaneous().replaceFirst("\\.0+$", "").replaceAll("[^0-9]", ""));

            } catch (Exception e) {
                test3 = new BigDecimal("0.00");
            }
            try {
                test4 = new BigDecimal(
                        uiflowdata.getTotalServices().replaceFirst("\\.0+$", "").replaceAll("[^0-9]", ""));
            } catch (Exception e) {
                test4 = new BigDecimal("0.00");
            }
            try {
                test5 = new BigDecimal(
                        uiflowdata.getTotalValuation().replaceFirst("\\.0+$", "").replaceAll("[^0-9]", ""));
            } catch (Exception e) {
                test5 = new BigDecimal("0.00");
            }
            totalAbstract = totalAbstract.add(test).add(test1).add(test2).add(test3).add(test4).add(test5);

            uiflowdata.setTotalAbstractvalue(XMLUtil.IndianFormat(new BigDecimal(totalAbstract.toString())));
            String numberOnly = totalAbstract.toString().replaceAll("[^\\d.]", "");
            if (numberOnly.trim().length() == 0) {
                numberOnly = "0";
            }
            uiflowdata.setAmountInWords(beanEvaluation.getAmountInWords(numberOnly));
            String numberOnly1 = tfGuidelineRate.getValue().replaceAll("[^0-9]", "");
            uiflowdata.setAmountWordsGuideline(beanEvaluation.getAmountInWords(numberOnly1));
            /*List<CmCommonSetup> bill = BillGenerator.getEndValueDetails(numberOnly,headerid,loginusername,selectedBankid,selectCompanyid);
            //   bill.setBillNo(Long.toString(beanEvaluation.getNextSequnceId("seq_pem_evaldtls_docid")));
               uiflowdata.setBillDtls(bill);
                       
               TPemCmBillDtls billDtls=BillGenerator.getBillDetails(numberOnly, headerid, loginusername, selectedBankid, selectCompanyid,currencyId);
               uiflowdata.setBill(billDtls);*/
            evalobj.setPropertyValue(Double.valueOf(numberOnly));
            BigDecimal realizable = new BigDecimal(0.00);
            BigDecimal distress = new BigDecimal(0.00);
            BigDecimal real = new BigDecimal("0.00");
            BigDecimal distre = new BigDecimal("0.00");

            try {
                real = new BigDecimal(
                        totalAbstract.toString().replaceFirst("\\.0+$", "").replaceAll("[^0-9]", ""));
            } catch (Exception e) {
                real = new BigDecimal("0.00");

            }
            try {
                distre = new BigDecimal(
                        totalAbstract.toString().replaceFirst("\\.0+$", "").replaceAll("[^0-9]", ""));
            } catch (Exception e) {
                distre = new BigDecimal("0.00");

            }
            try {
                realizable = real.multiply(new BigDecimal(95)).divide(new BigDecimal(100));
                realizable = realizable.subtract(realizable.remainder(new BigDecimal(1000)));
                tfRealizabletRate.setValue(realizable.toString());
                uiflowdata.setRealizablevalue(XMLUtil.IndianFormat(new BigDecimal(realizable.toString())));

                distress = (distre.multiply(new BigDecimal(85))).divide(new BigDecimal(100));
                distress = distress.subtract(distress.remainder(new BigDecimal(1000)));
                tfDistressRate.setValue(distress.toString());
                uiflowdata.setDistressvalue(XMLUtil.IndianFormat(new BigDecimal(distress.toString())));
            } catch (Exception e) {

            }

        } catch (Exception e) {

        }
        evalNumber = tfEvaluationNumber.getValue();
        customer = tfCustomerName.getValue();
        propertyType = "UNDERCONSTRUTIONBUILDING";
        ByteArrayOutputStream recvstram = XMLUtil.doMarshall(uiflowdata);
        XMLUtil.getWordDocument(recvstram, evalNumber + "_" + customer + "_" + propertyType, strXslFile);
        String basepath = VaadinService.getCurrent().getBaseDirectory().getAbsolutePath();
        System.out.println("Inside Update Evaluation basepath" + basepath + "/WEB-INF/PEM-DOCS/" + evalNumber
                + "_" + customer + "_" + propertyType + ".doc");
        File file = new File(
                basepath + "/WEB-INF/PEM-DOCS/" + evalNumber + "_" + customer + "_" + propertyType + ".doc");
        FileInputStream fin = new FileInputStream(file);
        byte fileContent[] = new byte[(int) file.length()];
        fin.read(fileContent);
        fin.close();
        evalobj.setEvalDoc(fileContent);
        //   beanEvaluation.saveorUpdateEvalDetails(evalobj);
        uiflowdata.setEvalDtls(evalobj);
        if (tfEvaluationNumber.isValid() && tfBankBranch.isValid() && tfEvaluationPurpose.isValid()
                && dfDateofValuation.isValid()) {

            if (count == 0) {
                beanEvaluation.saveorUpdateEvalDetails(evalobj);

                valid = true;
            }
            lblNotificationIcon.setIcon(new ThemeResource("img/success_small.png"));
            lblSaveNotification.setValue("Successfully Submitted");
        }

        if (valid) {
            /*populateAndConfig(false);
            resetAllFieldsFields();*/
            btnSubmit.setEnabled(false);
        } else {
            btnSubmit.setComponentError(new UserError("Form is invalid"));
        }
    } catch (Exception e) {
        lblNotificationIcon.setIcon(new ThemeResource("img/failure.png"));
        lblSaveNotification.setValue("Submit failed, please check the data and try again ");
        logger.info("Error on SaveApproveReject Status function--->" + e);
    }
}

From source file:com.gnts.pem.txn.sbi.SBIFlat.java

private void updateEvaluationDetails() {

    try {//from   w  ww.j  a v a  2s.  c  o  m
        boolean valid = false;
        TPemCmEvalDetails evalobj = new TPemCmEvalDetails();
        evalNumber = tfEvaluationNumber.getValue();
        customer = tfCustomerName.getValue();
        propertyType = "FLAT";
        String basepath = VaadinService.getCurrent().getBaseDirectory().getAbsolutePath();
        File file = new File(
                basepath + "/WEB-INF/PEM-DOCS/" + evalNumber + "_" + customer + "_" + propertyType + ".doc");
        FileInputStream fin = new FileInputStream(file);
        byte fileContent[] = new byte[(int) file.length()];
        fin.read(fileContent);
        fin.close();
        evalobj.setDocId(headerid);
        evalobj.setEvalDoc(fileContent);
        evalobj.setDocStatus(Common.DOC_PENDING);
        evalobj.setEvalNo(tfEvaluationNumber.getValue());
        evalobj.setValuationBy(tfValuatedBy.getValue());
        MPemCmBank bankid = new MPemCmBank();
        bankid.setBankId(selectedBankid);
        evalobj.setBankId(bankid);
        evalobj.setDoctype(screenName);
        evalobj.setCompanyId(selectCompanyid);
        evalobj.setBankBranch((String) slBankBranch.getValue());
        evalobj.setEvalPurpose(tfEvaluationPurpose.getValue());
        evalobj.setEvalDate(dfDateofValuation.getValue());
        evalobj.setCheckedBy(tfVerifiedBy.getValue());
        evalobj.setCheckedDt(dfVerifiedDate.getValue());
        evalobj.setInspectionDt(dfDateofValuation.getValue());
        evalobj.setInspectionBy(tfValuatedBy.getValue());
        evalobj.setLastUpdateDt(new Date());
        evalobj.setLastUpdtedBy(loginusername);
        evalobj.setCustName(tfCustomerName.getValue());

        if (tfDynamicEvaluation1.getValue() != null && tfDynamicEvaluation1.getValue().trim().length() > 0) {
            evalobj.setCustomLbl1(tfDynamicEvaluation1.getCaption());
            evalobj.setCustomValue1(tfDynamicEvaluation1.getValue());
        }
        if (tfDynamicEvaluation2.getValue() != null && tfDynamicEvaluation2.getValue().trim().length() > 0) {
            evalobj.setCustomValue2(tfDynamicEvaluation2.getCaption());
            evalobj.setCustomValue2(tfDynamicEvaluation2.getValue());
        }
        String numberOnly = tfCostOfConstAsAtSite.getValue().replaceAll("[^\\d.]", "");
        uiflowdata.setAmountInWords(beanEvaluation.getAmountInWords(numberOnly));
        if (numberOnly.trim().length() == 0) {
            numberOnly = "0";
        }
        evalobj.setPropertyValue(Double.valueOf(numberOnly));
        //beanEvaluation.saveorUpdateEvalDetails(evalobj);
        uiflowdata.setEvalDtls(evalobj);
        if (tfEvaluationNumber.isValid() && slBankBranch.isValid() && tfEvaluationPurpose.isValid()
                && dfDateofValuation.isValid()) {

            if (count == 0) {
                beanEvaluation.saveorUpdateEvalDetails(evalobj);

                valid = true;
            }
            lblNotificationIcon.setIcon(new ThemeResource("img/success_small.png"));
            lblSaveNotification.setValue("Successfully Submitted");
        }

        if (valid) {
            /*populateAndConfig(false);
            resetAllFieldsFields();*/
            btnSubmit.setEnabled(false);
        } else {
            btnSubmit.setComponentError(new UserError("Form is invalid"));
        }
    } catch (Exception e) {
        lblNotificationIcon.setIcon(new ThemeResource("img/failure.png"));
        lblSaveNotification.setValue("Submit failed, please check the data and try again ");
        logger.info("Error on SaveApproveReject Status function--->" + e);
    }
}

From source file:com.gnts.pem.txn.sbi.SBILand.java

public SBILand() {
    loginusername = UI.getCurrent().getSession().getAttribute("loginUserName").toString();
    screenName = UI.getCurrent().getSession().getAttribute("screenName").toString();
    selectedFormName = screenName;/*from ww  w  .jav a  2 s  . com*/
    VerticalLayout clArgumentLayout = (VerticalLayout) UI.getCurrent().getSession().getAttribute("clLayout");
    selectCompanyid = Long.valueOf(UI.getCurrent().getSession().getAttribute("loginCompanyId").toString());
    String[] splitlist = screenName.split("-");
    for (String str : splitlist) {
        List<MPemCmBank> list = beanbank.getBankDtlsList(selectCompanyid, null, str);

        for (MPemCmBank obj : list) {
            selectedBankid = obj.getBankId();
        }
        break;
    }

    HorizontalLayout hlHeaderLayout = (HorizontalLayout) UI.getCurrent().getSession().getAttribute("hlLayout");
    buildView(clArgumentLayout, hlHeaderLayout);
    basepath = VaadinService.getCurrent().getBaseDirectory().getAbsolutePath();
    basepath1 = basepath + "/VAADIN/themes/gerp/img/Upload.jpg";
    basepath2 = basepath + "/VAADIN/themes/gerp/img/Upload2.jpg";

}

From source file:com.gnts.pem.txn.sbi.SBILand.java

private void updateEvaluationDetails() {
    try {/*from  w  w  w  .j  a  v  a2  s . c om*/
        boolean valid = false;
        TPemCmEvalDetails evalobj = new TPemCmEvalDetails();
        evalNumber = tfEvaluationNumber.getValue();
        customer = tfCustomerName.getValue();
        propertyType = "LAND";
        String basepath = VaadinService.getCurrent().getBaseDirectory().getAbsolutePath();
        File file = new File(
                basepath + "/WEB-INF/PEM-DOCS/" + evalNumber + "_" + customer + "_" + propertyType + ".doc");
        FileInputStream fin = new FileInputStream(file);
        byte fileContent[] = new byte[(int) file.length()];
        fin.read(fileContent);
        fin.close();
        evalobj.setDocId(headerid);
        evalobj.setEvalDoc(fileContent);
        evalobj.setDocStatus(Common.DOC_PENDING);
        evalobj.setEvalNo(tfEvaluationNumber.getValue());
        evalobj.setValuationBy(tfValuatedBy.getValue());
        MPemCmBank bankid = new MPemCmBank();
        bankid.setBankId(selectedBankid);
        evalobj.setBankId(bankid);
        evalobj.setDoctype(screenName);
        evalobj.setCompanyId(selectCompanyid);
        evalobj.setBankBranch((String) slBankBranch.getValue());
        evalobj.setEvalPurpose(tfEvaluationPurpose.getValue());
        evalobj.setEvalDate(dfDateofValuation.getValue());
        evalobj.setCheckedBy(tfVerifiedBy.getValue());
        evalobj.setCheckedDt(dfVerifiedDate.getValue());
        evalobj.setLastUpdateDt(new Date());
        evalobj.setLastUpdtedBy(loginusername);
        evalobj.setCustName(tfCustomerName.getValue());

        if (tfDynamicEvaluation1.getValue() != null && tfDynamicEvaluation1.getValue().trim().length() > 0) {
            evalobj.setCustomLbl1(tfDynamicEvaluation1.getCaption());
            evalobj.setCustomValue1(tfDynamicEvaluation1.getValue());
        }
        if (tfDynamicEvaluation2.getValue() != null && tfDynamicEvaluation2.getValue().trim().length() > 0) {
            evalobj.setCustomValue2(tfDynamicEvaluation2.getCaption());
            evalobj.setCustomValue2(tfDynamicEvaluation2.getValue());
        }

        String numberOnly = tfFairMarketRate.getValue().replaceAll("[^\\d.]", "");
        uiflowdata.setAmountInWords(beanEvaluation.getAmountInWords(numberOnly));
        if (numberOnly.trim().length() == 0) {
            numberOnly = "0";
        }
        evalobj.setPropertyValue(Double.valueOf(numberOnly));
        //beanEvaluation.saveorUpdateEvalDetails(evalobj);
        uiflowdata.setEvalDtls(evalobj);
        if (tfEvaluationNumber.isValid() && slBankBranch.isValid() && tfEvaluationPurpose.isValid()
                && dfDateofValuation.isValid()) {

            if (count == 0) {
                beanEvaluation.saveorUpdateEvalDetails(evalobj);

                valid = true;
            }
            lblNotificationIcon.setIcon(new ThemeResource("img/success_small.png"));
            lblSaveNotification.setValue("Successfully Submitted");
        }

        if (valid) {
            /*populateAndConfig(false);
            resetAllFieldsFields();*/
            btnSubmit.setEnabled(false);
        } else {
            btnSubmit.setComponentError(new UserError("Form is invalid"));
        }
    } catch (Exception e) {
        lblNotificationIcon.setIcon(new ThemeResource("img/failure.png"));
        lblSaveNotification.setValue("Submit failed, please check the data and try again ");
        logger.info("Error on SaveApproveReject Status function--->" + e);
    }
}