Skip to content

Commit 447ab98

Browse files
author
chinna
committed
aded group services
1 parent 15e2de1 commit 447ab98

File tree

15 files changed

+271
-179
lines changed

15 files changed

+271
-179
lines changed

billrive-service/src/main/java/com/uhsarp/billrive/dao/GenericDAO.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
package com.uhsarp.billrive.dao;
66

77
import com.uhsarp.billrive.domain.Bill;
8-
import java.util.ArrayList;
8+
import com.uhsarp.billrive.domain.Group;
99
import java.util.List;
1010

1111
/**
@@ -15,5 +15,5 @@
1515
public interface GenericDAO {
1616

1717
List<Bill> getBills(int userId);
18-
18+
List<Group> getGroups(int userId);
1919
}

billrive-service/src/main/java/com/uhsarp/billrive/dao/Neo4jDAO.java

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
import java.util.ArrayList;
99
import java.util.List;
1010
import org.joda.time.DateTime;
11-
import org.springframework.stereotype.Service;
11+
import org.springframework.stereotype.Repository;
1212

1313
/**
1414
*
1515
* @author uhsarp
1616
*/
17-
@Service("neo4jDAO")
17+
@Repository("neo4jDAO")
1818
public class Neo4jDAO implements GenericDAO {
1919

2020
public List<Bill> getBills(int userId) {
@@ -38,13 +38,31 @@ public List<Bill> getBills(int userId) {
3838
BillFinances billFinances = new BillFinances(1,30,billItemEntry);
3939
BillFinances billFinances1 = new BillFinances(2,90,billItemEntry1);
4040
List<Bill> rtnval = new ArrayList<Bill>();
41-
41+
if(1 == userId)
42+
{
4243
Bill bill = new Bill(1,"Walmart", new DateTime(2013,2,3,1,1), userId, "Sample Notes", billFinances, userId);
44+
rtnval.add(bill);
45+
}
46+
else if(2==userId)
47+
{
4348
Bill bill1 = new Bill(2,"Costco", new DateTime(2014,2,3,1,1), userId, "Second sample Notes", billFinances1, userId);
44-
45-
rtnval.add(bill);
46-
rtnval.add(bill1);
49+
rtnval.add(bill1);
50+
}
4751
return rtnval;
4852
}
4953

54+
public List<Group> getGroups(int userId) {
55+
List<Friend> lsFriends = new ArrayList<Friend>();
56+
Friend sam = new Friend(10, "sam", "jumbo","sam@gmail.com", true );
57+
lsFriends.add(sam);
58+
Friend ken = new Friend(12, "ken", "dumbo", "ken@gmail.com", false);
59+
lsFriends.add(ken);
60+
61+
Group g1 = new Group(1, "LasVegas", "spring 2013", 2, lsFriends );
62+
List<Group> rtnval = new ArrayList<Group>();
63+
rtnval.add(g1);
64+
return rtnval;
65+
}
66+
67+
5068
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* To change this template, choose Tools | Templates
3+
* and open the template in the editor.
4+
*/
5+
package com.uhsarp.billrive.dao;
6+
7+
import com.uhsarp.billrive.domain.Bill;
8+
import com.uhsarp.billrive.domain.Group;
9+
import java.util.List;
10+
import org.springframework.stereotype.Repository;
11+
12+
/**
13+
*
14+
* @author Sravan
15+
*/
16+
@Repository("oracleDAO")
17+
public class OracleDAO implements GenericDAO{
18+
19+
public List<Bill> getBills(int userId) {
20+
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
21+
}
22+
23+
public List<Group> getGroups(int userId) {
24+
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
25+
}
26+
27+
28+
}

billrive-service/src/main/java/com/uhsarp/billrive/domain/Bill.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
public class Bill {
1414

1515
int id;
16-
String title;
16+
String title;//walmart
1717
DateTime date;
1818
int billPayerId;
1919
String notes;

billrive-service/src/main/java/com/uhsarp/billrive/domain/BillFinances.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
*/
1414
public class BillFinances {
1515

16-
int billPayerId;
17-
List<BillItemEntry> billItemEntry = new ArrayList<BillItemEntry>();
16+
int billPayerId;//2
17+
List<BillItemEntry> billItemEntry = new ArrayList<BillItemEntry>();//watermelon,napkins
1818
int billTotal;
1919

2020
public BillFinances(int billPayerId, int billTotal,List<BillItemEntry> billItemEntry) {

billrive-service/src/main/java/com/uhsarp/billrive/domain/BillItemEntry.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
public class BillItemEntry {
1414

1515
int itemDescriptionId;
16-
String itemDescription;
17-
ArrayList<UserIdAndLiableCost> userIdAndLiableCost = new ArrayList<UserIdAndLiableCost>();
16+
String itemDescription;//napkin
17+
ArrayList<UserIdAndLiableCost> userIdAndLiableCost = new ArrayList<UserIdAndLiableCost>();//2->3, 3->3, 4->3
1818

1919
public BillItemEntry(int itemDescriptionId, String itemDescription, ArrayList<UserIdAndLiableCost> userIdAndLiableCost) {
2020
this.itemDescriptionId = itemDescriptionId;
Lines changed: 70 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,70 @@
1-
/*
2-
* To change this template, choose Tools | Templates
3-
* and open the template in the editor.
4-
*/
5-
package com.uhsarp.billrive.domain;
6-
7-
/**
8-
*
9-
* @author uhsarp
10-
*/
11-
public class Friend {
12-
13-
public String getFriendId() {
14-
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
15-
}
16-
17-
}
1+
/*
2+
* To change this template, choose Tools | Templates
3+
* and open the template in the editor.
4+
*/
5+
package com.uhsarp.billrive.domain;
6+
7+
/**
8+
*
9+
* @author uhsarp
10+
*/
11+
public class Friend {
12+
int id;
13+
String firstName;
14+
String lastName;
15+
String emailId;
16+
17+
public Friend(int id, String firstName, String lastName, String emailId, boolean userActive) {
18+
this.id = id;
19+
this.firstName = firstName;
20+
this.lastName = lastName;
21+
this.emailId = emailId;
22+
this.userActive = userActive;
23+
}
24+
25+
public int getId() {
26+
return id;
27+
}
28+
29+
public void setId(int id) {
30+
this.id = id;
31+
}
32+
33+
public String getFirstName() {
34+
return firstName;
35+
}
36+
37+
public void setFirstName(String firstName) {
38+
this.firstName = firstName;
39+
}
40+
41+
public String getLastName() {
42+
return lastName;
43+
}
44+
45+
public void setLastName(String lastName) {
46+
this.lastName = lastName;
47+
}
48+
49+
public String getEmailId() {
50+
return emailId;
51+
}
52+
53+
public void setEmailId(String emailId) {
54+
this.emailId = emailId;
55+
}
56+
57+
public boolean isUserActive() {
58+
return userActive;
59+
}
60+
61+
public void setUserActive(boolean userActive) {
62+
this.userActive = userActive;
63+
}
64+
boolean userActive;
65+
66+
public String getFriendId() {
67+
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
68+
}
69+
70+
}
Lines changed: 74 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,74 @@
1-
/*
2-
* To change this template, choose Tools | Templates
3-
* and open the template in the editor.
4-
*/
5-
package com.uhsarp.billrive.domain;
6-
7-
/**
8-
*
9-
* @author uhsarp
10-
*/
11-
public class Group {
12-
13-
public String getGroupId() {
14-
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
15-
}
16-
17-
}
1+
/*
2+
* To change this template, choose Tools | Templates
3+
* and open the template in the editor.
4+
*/
5+
package com.uhsarp.billrive.domain;
6+
7+
import java.util.List;
8+
9+
/**
10+
*
11+
* @author uhsarp
12+
*/
13+
public class Group {
14+
15+
int idGroup;
16+
String title;
17+
18+
public int getIdGroup() {
19+
return idGroup;
20+
}
21+
22+
public Group(int idGroup, String title, String desc, int idOwner, List<Friend> lsMembers) {
23+
this.idGroup = idGroup;
24+
this.title = title;
25+
this.desc = desc;
26+
this.idOwner = idOwner;
27+
this.lsMembers = lsMembers;
28+
}
29+
30+
31+
32+
public void setIdGroup(int idGroup) {
33+
this.idGroup = idGroup;
34+
}
35+
36+
public String getTitle() {
37+
return title;
38+
}
39+
40+
public void setTitle(String title) {
41+
this.title = title;
42+
}
43+
44+
public String getDesc() {
45+
return desc;
46+
}
47+
48+
public void setDesc(String desc) {
49+
this.desc = desc;
50+
}
51+
52+
public int getIdOwner() {
53+
return idOwner;
54+
}
55+
56+
public void setIdOwner(int idOwner) {
57+
this.idOwner = idOwner;
58+
}
59+
String desc;
60+
int idOwner;
61+
List<Friend> lsMembers;
62+
63+
public List<Friend> getLsMembers() {
64+
return lsMembers;
65+
}
66+
67+
public void setLsMembers(List<Friend> lsMembers) {
68+
this.lsMembers = lsMembers;
69+
}
70+
public String getGroupId() {
71+
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
72+
}
73+
74+
}

billrive-service/src/main/java/com/uhsarp/billrive/services/BillService.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,14 @@ public Bill updateBill(Bill bill_p) {
4242
public void deleteBill(String billId_p) {
4343
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
4444
}
45+
46+
public GenericDAO getGenericDAO() {
47+
return genericDAO;
48+
}
49+
50+
public void setGenericDAO(GenericDAO genericDAO) {
51+
this.genericDAO = genericDAO;
52+
}
53+
4554

4655
}

billrive-service/src/main/java/com/uhsarp/billrive/services/GroupService.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44
*/
55
package com.uhsarp.billrive.services;
66

7+
import com.uhsarp.billrive.dao.GenericDAO;
78
import com.uhsarp.billrive.domain.Group;
9+
import java.util.ArrayList;
810
import java.util.List;
11+
import javax.annotation.Resource;
912
import org.springframework.stereotype.Service;
1013

1114
/**
@@ -14,7 +17,10 @@
1417
*/
1518
@Service("groupService")
1619
public class GroupService {
17-
20+
21+
@Resource(name= "neo4jDAO")
22+
GenericDAO genericDAO;
23+
1824
public void deleteGroup(String groupId_p) {
1925
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
2026
}
@@ -31,8 +37,10 @@ public Group getGroupById(String groupId_p) {
3137
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
3238
}
3339

34-
public List<Group> getGroups() {
35-
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
40+
public List<Group> getGroups(int userId) {
41+
List<Group> rtnval = new ArrayList<Group>();
42+
rtnval=genericDAO.getGroups(userId);
43+
return rtnval;
3644
}
3745

3846
}

0 commit comments

Comments
 (0)