ClassDiagram451 - bounswe/bounswe2025group5 GitHub Wiki
classDiagram
%% ---------------------------
%% Package: User Management
%% ---------------------------
class RegisteredUser {
- email: String
- username: String
- password: String
- userId: int
- posts: List~Post~
- badges: List~Badge~
- goals: List~WasteGoal~
+ login(email: String, password: String): boolean
+ resetPassword(email: String): void
+ deleteAccount(): boolean
+ logout(): void
+ createWasteGoal(name: String, duration: double, type: String, amount: double, unit: String): void
+ logWaste(amount: double, type: String, unit: String): void
+ deleteWasteGoal(goalId: int): boolean
+ completeWasteGoal(goalId: int): Badge
+ viewChallenges(): List~Challenge~
+ selectChallenge(challengeId: int): Challenge
+ follow(userId: int): boolean
+ unfollow(userId: int): boolean
}
class Moderator {
+ moderatePost(postId: int): void
+ reviewReports(reportId: int): void
+ approveRequestedChallenge(challengeId: int): int
}
RegisteredUser <|-- Moderator
%% Follow graph (self-association via Follow entity)
class Follow {
- followerId: int
- followeeId: int
- since: Date
}
RegisteredUser "1" -- "*" Follow : follows >
Follow "*" -- "1" RegisteredUser : > followee
%% ---------------------------
%% Package: Preferences & Profile
%% ---------------------------
class Profile {
- userName: String
- photo: Image
- biography: String
- displayedBadges: List~Badge~
- locale: String
+ getPhoto(): Image
+ setPhoto(photo: Image): boolean
+ getBiography(): String
+ setBiography(biography: String): String
+ editProfile(flag: String): void
+ saveBadges(badges: List~Badge~): List~Badge~
+ selectBadges(badges: List~Badge~): List~Badge~
+ updateDispBadges(badges: List~Badge~): void
}
RegisteredUser --> Profile : has
%% ---------------------------
%% Package: Post & Forum (with semantic search + kindness reminder cue)
%% ---------------------------
class Post {
- postId: int
- content: String
- attachments: List~String~
- tags: List~String~
- timestamp: Date
- authorUserId: int
- likeCount: int
- shareCount: int
- savedBy: List~int~
}
class Comment {
- commentId: int
- content: String
- timestamp: Date
- authorUserId: int
+ editComment(newContent: String): boolean
}
class Like {
- likeId: int
- userId: int
- postId: int
- timestamp: Date
}
class ForumFeed {
- feedId: int
- posts: List~Post~
+ getPosts(): List~Post~
+ createPost(content: String, attachments: List~String~, tags: List~String~): boolean
+ selectPost(postId: int): Post
+ deletePost(userId: int, postId: int): boolean
+ likePost(userId: int, postId: int): void
+ commentOnPost(userId: int, postId: int, comment: Comment): void
+ savePost(userId: int, postId: int): boolean
+ sharePost(userId: int, postId: int): boolean
+ reportPost(postId: int, reason: String): void
+ semanticSearch(prompt: String): List~Post~
+ showKindnessReminder(): void
}
Post "1" --> "*" Comment : has
Post "1" --> "*" Like : has
ForumFeed "1" --> "*" Post : contains
RegisteredUser --> ForumFeed : accesses
User --> "*" ForumFeed : views
%% ---------------------------
%% Package: Waste Tracking
%% ---------------------------
class WasteGoal {
- goalId: Integer
- date: LocalDateTime
- duration: int
- restrictionAmountGrams: double
- completed: Integer
- percentOfProgress: Double
+ visualize(): Image
+ checkCompletion(): boolean
}
class WasteLog {
- logId: int
- quantity: int
- date: LocalDateTime
- goalId: int
- userId: int
}
class WasteItem {
- id: Integer
- name: String
- displayName: String
- weightInGrams: double
}
class WasteType {
- id: Integer
- name: String
}
WasteGoal "1" -- "*" WasteLog : contains
WasteLog "*" -- "1" WasteItem : of
WasteGoal "*" -- "1" WasteType : has type
WasteItem "*" -- "1" WasteType : has type
RegisteredUser --> "*" WasteGoal : creates
RegisteredUser --> "*" WasteLog : logs
%% ---------------------------
%% Package: Reporting, Feedback & Challenges
%% ---------------------------
class Report {
- reportId: int
- postId: int
- reason: String
- reportDate: Date
- status: String
+ resolve(reportId: int): boolean
}
class Feedback {
- feedbackId: int
- userId: int
- type: String
- message: String
- createdAt: Date
- status: String
}
RegisteredUser --> "*" Report : submits
RegisteredUser --> "*" Feedback : submits
Moderator --> "*" Report : reviews
class Challenge {
- challengeId: int
- title: String
- description: String
- startDate: Date
- endDate: Date
- status: String
- participants: Map~int, double~
+ joinChallenge(challengeId: int): boolean
+ leaveChallenge(challengeId: int): boolean
+ requestChallenge(description: String, userId: int): int
+ getLoggedAmounts(userId: int, amount: double): void
+ updateLoggedAmounts(userId: int, loggedWaste: double): void
+ deleteUserProgress(userId: int): int
+ rewardWinners(): void
+ viewLeaderboard(leaderboardId: int): Leaderboard
}
class Leaderboard {
- leaderboardId: int
- type: String %% Plastic, Organic, Paper, Metal, Glass
- metric: String
- rankedUsers: List~int~
+ updateRanking(userId: int): void
}
Moderator --> "*" Challenge : approves
RegisteredUser --> "*" Challenge : participates
RegisteredUser --> "*" Challenge : requests
Challenge --> "1" Leaderboard : maintains
%% ---------------------------
%% Package: Badges (catalog + assignment)
%% ---------------------------
class Badge {
- badgeId: int
- name: String
- description: String
- criteria: String
}
class BadgeCatalog {
- badges: List~Badge~
+ listBadges(): List~Badge~
+ getBadge(badgeId: int): Badge
}
WasteGoal --> Badge : awards
Challenge --> Badge : awardsTop3
RegisteredUser --> "*" Badge : earns
Profile --> "*" Badge : displays
BadgeCatalog --> "*" Badge : contains
%% ---------------------------
%% Package: Notifications
%% ---------------------------
class Notification {
- notificationId: int
- userId: int
- type: String
- sourceId: int
- message: String
- timestamp: Date
- read: Boolean
+ markAsRead(notificationId: int): void
}
RegisteredUser --> "*" Notification : receives
%% ---------------------------
%% Package: Standardization (W3C Activity Streams 2.0)
%% ---------------------------
class Activity {
- activityId: int
- type: String %% "Create","Like","Share","Add(Save)","Join","Follow","Comment"
- actorId: int
- objectType: String
- objectId: int
- targetId: int
- timestamp: Date
}
RegisteredUser --> "*" Activity : performs
Activity --> Notification : triggers
%% ---------------------------
%% Cross-Package Associations
%% ---------------------------
User --> "*" Profile : views
(delete after review)
1) Structural Updates
- Removed:
Reward
class and all reward-related methods/fields.
- Added classes:
Feedback
β user feedback & suggestions (1.1.5.3).
Follow
β followerβfollowee relationship to support social notifications (1.2.4.4).
BadgeCatalog
β browse/describe badges (1.2.3.3).
Activity
β models actions per W3C Activity Streams 2.0 (1.2.6.1β1.2.6.2).
2) Incentives: Rewards β Badges
- Replaced rewards with badges to reflect new incentive model.
- Links & behavior:
WasteGoal β Badge
(milestone badges, 1.2.3.2).
Challenge β Badge
(awards top-3 at end, 1.2.3.4).
RegisteredUser β * Badge : earns
, Profile β * Badge : displays
(1.1.5.1β1.1.5.2).
- Introduced
BadgeCatalog
for listing and retrieval (1.2.3.3).
- Removed methods/fields:
redeemReward
, returnPoints
, WasteGoal.reward
, RegisteredUser.totalXp
.
3) Feedback Feature
- New:
Feedback
class with type
, message
, status
.
- Association:
RegisteredUser β * Feedback : submits
.
- Covers: 1.1.5.3 (feedback, improvements, bug reports).
4 -
5) Localization
- Profile enhancement:
Profile.locale : String
(e.g., "en"
, "tr"
).
- Satisfies: 1.2.7.1β1.2.7.2 (locale switch + default).
6) Standardization (W3C Activity Streams 2.0)
- New:
Activity
class with fields type
, actorId
, objectType
, objectId
, targetId
, timestamp
.
- Association:
RegisteredUser β * Activity : performs
.
- Integration:
Activity β Notification : triggers
.
- Meets: 1.2.6.1β1.2.6.2.
7) Forum & Post Enhancements
- Semantic search:
ForumFeed.semanticSearch(prompt)
(1.2.5.3).
- Kindness reminder:
ForumFeed.showKindnessReminder()
before posting/commenting (1.2.5.4).
- Sharing:
ForumFeed.sharePost(...)
+ Post.shareCount
.
8) Waste Tracking Precision
- Units captured explicitly:
- The waste goal and log classes are modified according to new implementation, waste item and waste type classes created.
9) Challenges & Leaderboards
- **Country-specific boards deleted
- Awarding top-3:
Challenge.rewardWinners()
clarified to assign badges (1.2.3.4).
10) Account & Profile Adjustments
- Delete account: Retained
deleteAccount()
; irreversible deletion handled in service layer (1.1.1.4).
- Social: Added
RegisteredUser.follow()
/ unfollow()
(1.2.4.4).