Skip to content

Sequence Diagrams ‐ Waste Tracking and Scoring System

Selman Akman edited this page Oct 17, 2025 · 3 revisions

Log Waste Sequence Diagram

Diagram

image

Code

@startuml
actor User
participant ":WasteService" as WasteService
participant ":AchievementService" as AchievementService
participant ":User" as UserObj
participant ":WasteLog" as WasteLogObj
participant ":WasteCategory" as CategoryObj

User -> WasteService: logWaste(userID, categoryID, quantity, unit, date, location?, eventID?)
WasteService -> UserObj: getUser(userID)
alt User Authenticated
    UserObj --> WasteService: userData
    WasteService -> CategoryObj: getCategory(categoryID)
    alt Category Exists
        CategoryObj --> WasteService: categoryData(scorePerUnit, unit)
        alt Valid Input
            WasteService -> WasteLogObj: createWasteLog(userID, categoryID, quantity, unit, date, location?, eventID?)
            WasteLogObj --> WasteService: logCreated(logID)
            WasteService -> AchievementService: calculateScore(categoryID, quantity)
            AchievementService --> WasteService: score
            AchievementService -> UserObj: updateScore(userID, score)
            UserObj --> AchievementService: scoreUpdated()
            WasteService --> User: showConfirmation("Waste logged successfully, Score: " + score)
        else Invalid Input
            WasteService --> User: showError("Invalid quantity or unit")
        end
    else Category Not Found
        CategoryObj --> WasteService: error("Category not found")
        WasteService --> User: showError("Invalid category ID")
    end
else User Not Authenticated
    UserObj --> WasteService: error("User not found")
    WasteService --> User: showError("Please log in to log waste")
end

@enduml

View Waste Logs Sequence Diagram

Diagram

image

Code

@startuml
actor User
participant ":WasteService" as WasteService
participant ":User" as UserObj
participant ":WasteLog" as WasteLogObj

User -> WasteService: viewWasteLogs(userID, filters, eventID?)
WasteService -> UserObj: getUser(userID)
alt User Authenticated
    UserObj --> WasteService: userData
    WasteService -> WasteLogObj: getWasteLogs(userID, filters, eventID?)
    alt Logs Found
        WasteLogObj --> WasteService: logList(categoryID, quantity, date, eventID?)
        WasteService --> User: displayWasteLogs(logList)
    else No Logs Found
        WasteLogObj --> WasteService: emptyList
        WasteService --> User: showMessage("No waste logs found")
    end
else User Not Authenticated
    UserObj --> WasteService: error("User not found")
    WasteService --> User: showError("Please log in to view waste logs")
end

@enduml

Request Custom Waste Category Sequence Diagram

Diagram

image

Code

@startuml
actor User
participant ":WasteService" as WasteService
participant ":User" as UserObj
participant ":WasteCategory" as CategoryObj

User -> WasteService: requestCustomCategory(userID, name, unit)
WasteService -> UserObj: getUser(userID)
alt User Authenticated
    UserObj --> WasteService: userData
    alt Valid Input
        WasteService -> CategoryObj: createCustomCategory(name, unit, isCustom=true, isApproved=false)
        CategoryObj --> WasteService: categoryCreated(categoryID)
        WasteService --> User: showConfirmation("Custom category requested successfully")
    else Invalid Input
        WasteService --> User: showError("Invalid category name or unit")
    end
else User Not Authenticated
    UserObj --> WasteService: error("User not found")
    WasteService --> User: showError("Please log in to request a custom category")
end

@enduml

Approve Custom Waste Category Sequence Diagram

Diagram

image

Code

@startuml
actor Admin
participant ":WasteService" as WasteService
participant ":Admin" as AdminObj
participant ":WasteCategory" as CategoryObj

Admin -> WasteService: approveCustomCategory(adminID, categoryID, scorePerUnit)
WasteService -> AdminObj: verifyAdmin(adminID)
alt Admin Authorized
    AdminObj --> WasteService: adminData
    WasteService -> CategoryObj: getCategory(categoryID)
    alt Category Exists
        CategoryObj --> WasteService: categoryData(isCustom=true, isApproved=false)
        WasteService -> CategoryObj: updateCategory(categoryID, isApproved=true, scorePerUnit)
        CategoryObj --> WasteService: categoryUpdated()
        WasteService --> Admin: showConfirmation("Custom category approved successfully")
    else Category Not Found
        CategoryObj --> WasteService: error("Category not found")
        WasteService --> Admin: showError("Invalid category ID")
    end
else Unauthorized
    AdminObj --> WasteService: error("Admin not authorized")
    WasteService --> Admin: showError("Admin access required")
end

@enduml

Upload Waste Photo (Optional) Sequence Diagram

Diagram

image

Code

@startuml
actor User
participant ":WasteService" as WasteService
participant ":User" as UserObj
participant ":WasteLog" as WasteLogObj
participant ":Media" as MediaObj

User -> WasteService: uploadWastePhoto(userID, logID, image)
WasteService -> UserObj: getUser(userID)
alt User Authenticated
    UserObj --> WasteService: userData
    WasteService -> WasteLogObj: getWasteLog(logID, userID)
    alt Log Exists
        WasteLogObj --> WasteService: logData
        alt Valid Image
            WasteService -> MediaObj: storePhoto(logID, image)
            MediaObj --> WasteService: photoStored(photoURL)
            WasteService --> User: showConfirmation("Photo uploaded successfully")
        else Invalid Image
            WasteService --> User: showError("Invalid image file")
        end
    else Log Not Found
        WasteLogObj --> WasteService: error("Log not found")
        WasteService --> User: showError("Invalid log ID")
    end
else User Not Authenticated
    UserObj --> WasteService: error("User not found")
    WasteService --> User: showError("Please log in to upload a photo")
end

@enduml

View Waste Reduction Suggestions Sequence Diagram

Diagram

image

Code

@startuml
actor User
participant ":RecommendationService" as RecService
participant ":User" as UserObj
participant ":WasteLog" as WasteLogObj

User -> RecService: getWasteReductionSuggestions(userID, categoryID, eventID?)
RecService -> UserObj: getUser(userID)
alt User Authenticated
    UserObj --> RecService: userData
    RecService -> WasteLogObj: getSuggestions(categoryID, eventID?)
    alt Suggestions Found
        WasteLogObj --> RecService: suggestionList
        RecService --> User: displaySuggestions(suggestionList)
    else No Suggestions
        WasteLogObj --> RecService: emptyList
        RecService --> User: showMessage("No suggestions available")
    end
else User Not Authenticated
    UserObj --> RecService: error("User not found")
    RecService --> User: showError("Please log in to view suggestions")
end

@enduml

View Scoring System Sequence Diagram

Diagram

image

Code

@startuml
actor User
participant ":WasteService" as WasteService
participant ":User" as UserObj
participant ":WasteCategory" as CategoryObj

User -> WasteService: viewScoringSystem(userID)
WasteService -> UserObj: getUser(userID)
alt User Authenticated
    UserObj --> WasteService: userData
    WasteService -> CategoryObj: getScoringRules()
    alt Rules Found
        CategoryObj --> WasteService: ruleList(categoryID, scorePerUnit)
        WasteService --> User: displayScoringRules(ruleList)
    else No Rules Found
        CategoryObj --> WasteService: emptyList
        WasteService --> User: showMessage("No scoring rules available")
    end
else User Not Authenticated
    UserObj --> WasteService: error("User not found")
    WasteService --> User: showError("Please log in to view scoring system")
end

@enduml

Labs

Team Members

Weekly Reports

Ahmet Okta
Barathan Aslan
Berke Kartal
Mehmet Çağlar Kurt
Mehmet Emin Atak
Muhammet Berkay Keskin
Mustafa Taha Söylemez
Nilsu Tüysüz
Selman Akman
Ömer Faruk Bayram

Meetings

Milestones

Templates

Research on Git

Projects

Project Resources

Software Design Diagrams

Documentation(Manuals & Research Doc)

CMPE352 Archive

Projects

Project Resources

Software Design Diagrams

Documentation(Manuals & Research Doc)



Documentation(Individual Contributions and/or Milestone Report)

Individual Contributions

Meeting Notes

Clone this wiki locally