Rev 26 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 26 | Rev 27 | ||
---|---|---|---|
Line 55... | Line 55... | ||
55 | * relType: A filled DAO
|
55 | * relType: A filled DAO
|
56 | * @return Boolean indicating success or error in saving the
|
56 | * @return Boolean indicating success or error in saving the
|
57 | * relationshipType
|
57 | * relationshipType
|
58 | */
|
58 | */
|
59 | @Override |
59 | @Override |
60 | public boolean saveRelationshipType(RelationshipType relType) |
60 | public boolean saveOrUpdateRelType(RelationshipType relType) |
61 | {
|
61 | {
|
62 | try
|
62 | try
|
63 | {
|
63 | {
|
64 | session.save(relType); |
64 | session.saveOrUpdate(relType); |
65 | return true; |
65 | return true; |
66 | }
|
66 | }
|
67 | catch (Exception e) |
67 | catch (Exception e) |
68 | {
|
68 | {
|
69 | transaction.rollback(); |
69 | transaction.rollback(); |
Line 81... | Line 81... | ||
81 | @Override |
81 | @Override |
82 | public boolean deleteRelationshipType(int relTypeID) |
82 | public boolean deleteRelationshipType(int relTypeID) |
83 | {
|
83 | {
|
84 | try
|
84 | try
|
85 | {
|
85 | {
|
- | 86 | RelationshipType relType = (RelationshipType) session.get( |
|
86 | User user = (User) session.get(RelationshipType.class, relTypeID); |
87 | RelationshipType.class, relTypeID); |
87 | session.delete(user); |
88 | session.delete(relType); |
88 | return true; |
89 | return true; |
89 | }
|
90 | }
|
90 | catch (Exception e) |
91 | catch (Exception e) |
91 | {
|
92 | {
|
92 | transaction.rollback(); |
93 | transaction.rollback(); |
93 | // TODO: Logging
|
94 | // TODO: Logging
|
94 | return false; |
95 | return false; |
95 | }
|
96 | }
|
96 | }
|
97 | }
|
- | 98 | ||
- | 99 | /**
|
|
- | 100 | * Used to get a relationship type by ID
|
|
- | 101 | */
|
|
- | 102 | @Override |
|
- | 103 | public RelationshipType listRelTypeById(int relTypeID) |
|
- | 104 | {
|
|
- | 105 | RelationshipType relType = null; |
|
- | 106 | try
|
|
- | 107 | {
|
|
- | 108 | relType = (RelationshipType) session.get(RelationshipType.class, |
|
- | 109 | relTypeID); |
|
- | 110 | }
|
|
- | 111 | catch (Exception e) |
|
- | 112 | {
|
|
- | 113 | e.printStackTrace(); |
|
- | 114 | // TODO: Logging
|
|
- | 115 | }
|
|
- | 116 | return relType; |
|
- | 117 | }
|
|
97 | }
|
118 | }
|