Subversion Repository Public Repository

TransPort_Tracking

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bestray.transtracking.service.impl;

import com.bestray.transporttracking.DataSourceObject;
import com.bestray.transtracking.dao.CodeDao;
import com.bestray.transtracking.dao.EmployeeDao;
import com.bestray.transtracking.dao.OwnerPaymentDao;
import com.bestray.transtracking.dao.VehicleOwnerDao;
import com.bestray.transtracking.dao.impl.CodeDaoImpl;
import com.bestray.transtracking.dao.impl.EmployeeDaoImpl;
import com.bestray.transtracking.dao.impl.OwnerPaymentDaoImpl;
import com.bestray.transtracking.dao.impl.VehicleOwnerDaoImpl;
import com.bestray.transtracking.dto.OwnerPaymentSearchDTO;
import com.bestray.transtracking.exceptions.TransTrackException;
import com.bestray.transtracking.service.VehicleOwnerPaymentService;
import com.bestray.trastrack.domain.OwnerPayment;
import com.bestray.trastrack.domain.OwnerPaymentBalanceSum;
import com.bestray.trastrack.domain.VehicleOwner;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author User1
 */
public class OwnerPaymentServiceImpl implements VehicleOwnerPaymentService{
    
    private OwnerPaymentDao ownerpayDao;
    private EmployeeDao employeeDao;
    private CodeDao codedao;
    private VehicleOwnerDao vownerDao;
    
    public OwnerPaymentServiceImpl() {
        ownerpayDao = new OwnerPaymentDaoImpl(DataSourceObject.getDataSourceObject());
        codedao = new CodeDaoImpl( DataSourceObject.getDataSourceObject());
         employeeDao = new EmployeeDaoImpl( DataSourceObject.getDataSourceObject());
         vownerDao = new VehicleOwnerDaoImpl( DataSourceObject.getDataSourceObject());
    }

    @Override
    public List<VehicleOwner> getVehicleOwnerList() throws TransTrackException {
        try {
             return ownerpayDao.findVehicleOwnerList();
        } catch (Exception ex) {
            Logger.getLogger(OwnerPaymentServiceImpl.class.getName()).log(Level.SEVERE, null, ex);
            throw new TransTrackException("Error in fetching  Vehicle Owner Details");
        }
    }

    @Override
    public boolean saveVehicleOwnerTransaction(OwnerPayment ownerPayment) throws TransTrackException {
        boolean flag = false; 
        try {
            if(ownerPayment.getId()!=null && ownerPayment.getId()>0){
          ownerpayDao.updatePayment(ownerPayment);
       }
        else{
            if(ownerPayment.getId()==null){
                ownerpayDao.savePayment(ownerPayment);
                flag = true;
            }
        }
        } catch (Exception e) {
            Logger.getLogger(OwnerPaymentServiceImpl.class.getName()).log(Level.SEVERE, null, e);
            throw new TransTrackException("Error in Saveing payment Entry");
        }
        return flag;
    }

    @Override
    public void deleteVehicleOwnerTransaction(Long valueOf) throws TransTrackException {
        try{
            ownerpayDao.deletePayment(valueOf);
                 
            }catch(Exception ex){
                 Logger.getLogger(OwnerPaymentServiceImpl.class.getName()).log(Level.SEVERE, null, ex);
                 
                 throw new TransTrackException("Error in Delete Transaction");
            }

    }
    
    @Override
    public OwnerPaymentBalanceSum getBalanceSum(Long ownerId) throws TransTrackException{
        try {
            return ownerpayDao.getBalanceSum(ownerId);
        } catch (Exception ex) {
            Logger.getLogger(OwnerPaymentServiceImpl.class.getName()).log(Level.SEVERE, null, ex);
            throw new TransTrackException("Error in fetching total balance");
        }
    }

    @Override
    public List<OwnerPayment> getSearchResult(OwnerPaymentSearchDTO search) throws TransTrackException {
        List<OwnerPayment> results = new ArrayList<OwnerPayment>();
        try{
       
             results = ownerpayDao.getSearchResults(search);
            for(OwnerPayment object :results){
                //object.setEmp(employeeDao.findEmplRegistraion(object.getPaid_by_id()));
                //object.setClient(clientdao.findClientRegistraion(object.getClient_id()));
                //object.setVehicle(vehicleService.getVehicleRegistrationDetails(object.getVehicleId()));
            }
             }catch(Exception e){
                    throw new TransTrackException("Error in Fetching Job Entry");
       }
         return results;
    }

    @Override
    public OwnerPayment getOwnerPaymentDetails(Long valueOf) throws TransTrackException {
        OwnerPayment collection ;
       try{
        
       collection = ownerpayDao.findPaymentDetails(valueOf);
        }catch(Exception e){
           throw new TransTrackException("Error in Fetching Client Collection");
       }
        return collection;
    }
    
    @Override
    public OwnerPaymentBalanceSum getPaymentBalanceSum(Long ownerId) throws TransTrackException {
    try {
    return ownerpayDao.getPaymentBalanceSum(ownerId);
    } catch (Exception ex) {
    Logger.getLogger(OwnerPaymentServiceImpl.class.getName()).log(Level.SEVERE, null, ex);
    throw new TransTrackException("Error in fetching total balance");
    }
    }
    
}

Commits for TransPort_Tracking/TransPortTracking/src/main/java/com/bestray/transtracking/service/impl/OwnerPaymentServiceImpl.java

Diff revisions: vs.
Revision Author Commited Message
1 girijabapi picture girijabapi Sat 28 Jul, 2018 05:29:14 +0000