Skip to content

CMPE352‐Sequence Diagrams ‐ Tips and Recommendations

Selman Akman edited this page Oct 15, 2025 · 1 revision

View Tips Sequence Diagram

Diagram

image

Code

@startuml
actor User
participant ":System" as System
participant ":Tip" as Tip
participant "Database" as DB

User -> System: viewTips(categoryID)

System -> Tip: viewTips(categoryID)

Tip -> DB: queryTipsByCategory(categoryID)

alt Tips Found
    DB --> Tip: return tipsList
    Tip --> System: return tipsList
    System --> User: display tipsList
else No Tips Found
    DB --> Tip: return emptyList or error
    Tip --> System: return emptyList or errorMessage
    System --> User: display "No tips found"
end alt

@enduml

Search Tips Sequence Diagram

Diagram

image

Code

@startuml
actor User
participant "System" as System
participant "Tip" as Tip
participant "Database" as DB

User -> System: searchTips(query)
System -> Tip: searchTips(query)

alt Valid Query
Tip -> DB: queryTipsByKeyword(query)
alt Tips Found
DB --> Tip: List
Tip --> System: List
System --> User: displaySearchResults(List)
else No Tips Found
DB --> Tip: emptyList
Tip --> System: emptyList
System --> User: displayMessage("No tips found")
end alt
else Invalid Query
Tip --> System: errorMessage
System --> User: displayMessage("Invalid search query")
end alt

@enduml

Submit Tips Sequence Diagram

Diagram

image

Code

@startuml
actor User
participant ":System" as System
participant ":User" as UserClass
participant ":Tip" as Tip
participant "Database" as DB

User -> System: submitTips(content, category)

' Check if User is authenticated
System -> UserClass: getUserID()
alt User Authenticated
    UserClass --> System: return userID
    
    System -> Tip: submitTips(content, category, userID)
    
    alt Valid Input
        Tip -> DB: saveTip(content, category, userID)
        alt Tip Saved Successfully
            DB --> Tip: return tipID
            Tip --> System: return tipID
            System --> User: display "Tip submitted successfully"
        else Database Error
            DB --> Tip: return error
            Tip --> System: return errorMessage
            System --> User: display "Failed to submit tip"
        end alt
    else Invalid Input
        Tip --> System: return errorMessage
        System --> User: display "Invalid content or category"
    end alt
else User Not Authenticated
    UserClass --> System: return error
    System --> User: display "Please log in to submit tips"
end alt

@enduml

Save Tips Sequence Diagram

Diagram

image

Code

@startuml
actor User
participant ":System" as System
participant ":User" as UserClass
participant ":Tip" as Tip
participant "Database" as DB

User -> System: saveTips(tipID)
System -> UserClass: getUserID()
alt User Authenticated
    UserClass --> System: userID
    System -> Tip: saveTips(tipID)
    Tip -> DB: checkTipExists(tipID)
    alt Tip Exists
        DB --> Tip: tipExists
        Tip -> DB: storeTipForUser(userID, tipID)
        alt Save Successful
            DB --> Tip: success
            Tip --> System: true
            System --> User: displayMessage("Tip saved successfully")
        else Save Failed
            DB --> Tip: error
            Tip --> System: false
            System --> User: displayMessage("Failed to save tip due to database error")
        end alt
    else Tip Does Not Exist
        DB --> Tip: tipNotFound
        Tip --> System: false
        System --> User: displayMessage("Invalid tip ID")
    end alt
else User Not Authenticated
    UserClass --> System: error
    System --> User: displayMessage("Please log in to save tips")
end alt

@enduml

Share Tips Sequence Diagram

Diagram

image

Code

@startuml
actor User
participant ":System" as System
participant ":User" as UserClass
participant ":Tip" as Tip
participant "Database" as DB
participant "ExternalPlatform" as Platform

User -> System: shareTips(tipID, platform)
System -> UserClass: getUserID()
alt User Authenticated
    UserClass --> System: userID
    System -> Tip: shareTips(tipID, platform)
    Tip -> DB: checkTipExists(tipID)
    alt Tip Exists
        DB --> Tip: tipContent
        Tip -> Platform: shareTipContent(tipContent, platform)
        alt Share Successful
            Platform --> Tip: success
            Tip --> System: true
            System --> User: displayMessage("Tip shared successfully")
        else Share Failed
            Platform --> Tip: error
            Tip --> System: false
            System --> User: displayMessage("Failed to share tip due to platform error")
        end alt
    else Tip Does Not Exist
        DB --> Tip: tipNotFound
        Tip --> System: false
        System --> User: displayMessage("Invalid tip ID")
    end alt
else User Not Authenticated
    UserClass --> System: error
    System --> User: displayMessage("Please log in to share tips")
end alt

@enduml

View Recommendations Sequence Diagram

Diagram

image

Code

@startuml
actor User
participant ":System" as System
participant ":User" as UserClass
participant ":RecommendationEngine" as RecEngine
participant ":Tip" as Tip
participant "Database" as DB

User -> System: viewRecommendations()
System -> UserClass: getUserID()
alt User Authenticated
    UserClass --> System: userID
    System -> RecEngine: generateRecommendations(userID)
    RecEngine -> Tip: viewTipsForUser(userID)
    Tip -> DB: queryTipsByUserWasteData(userID)
    DB --> Tip: List<Tip>
    Tip --> RecEngine: List<Tip>
    RecEngine -> DB: queryEcoProductsByUserWasteData(userID)
    DB --> RecEngine: List<Product>
    RecEngine --> System: combinedRecommendations(List<Tip>, List<Product>)
    alt Recommendations Found
        System --> User: displayMessage("Combined recommendations", List<Tip>, List<Product>)
    else No Recommendations Found
        System --> User: displayMessage("No recommendations available")
    end alt
else User Not Authenticated
    UserClass --> System: error
    System --> User: displayMessage("Please log in to view personalized recommendations")
end alt

@enduml

View Eco-Friendly Products Sequence Diagram

Diagram

image

Code

@startuml
actor User
participant ":System" as System
participant ":User" as UserClass
participant ":RecommendationEngine" as RecEngine
participant "Database" as DB

User -> System: viewEcoProducts()
System -> UserClass: getUserID()
alt User Authenticated
    UserClass --> System: userID
    System -> RecEngine: getEcoProductRecommendations(userID)
    RecEngine -> DB: queryEcoProductsByUserWasteData(userID)
    alt Products Found
        DB --> RecEngine: List<Product>
        RecEngine --> System: List<Product>
        System --> User: displayMessage("Eco-friendly products displayed", List<Product>)
    else No Products Found
        DB --> RecEngine: emptyList
        RecEngine --> System: emptyList
        System --> User: displayMessage("No eco-friendly products available")
    else Database Error
        DB --> RecEngine: error
        RecEngine --> System: error
        System --> User: displayMessage("Failed to retrieve products due to database error")
    end alt
else User Not Authenticated
    UserClass --> System: error
    System --> User: displayMessage("Please log in to view personalized product recommendations")
end alt

@enduml

Reward Tip Contribution Sequence Diagram

Diagram

image

Code

@startuml
actor Admin
participant ":System" as System
participant ":Admin" as AdminObj
participant ":Tip" as Tip
participant ":User" as User
participant "Database" as DB

Admin -> System: rewardTipContribution(tipID, rewardPoints)
System -> AdminObj: verifyAdmin()
alt Admin Authorized
    AdminObj --> System: adminID
    System -> AdminObj: rewardTipContribution(tipID, rewardPoints)
    AdminObj -> Tip: checkTipAndContributor(tipID)
    Tip -> DB: checkTipExists(tipID)
    alt Tip Exists
        DB --> Tip: contributorID
        Tip --> AdminObj: contributorID
        AdminObj -> User: updateReward(contributorID, rewardPoints)
        User -> DB: storeReward(contributorID, rewardPoints)
        alt Reward Saved Successfully
            DB --> User: success
            User --> AdminObj: true
            AdminObj --> System: true
            System --> Admin: displayMessage("Reward assigned successfully")
        else Reward Save Failed
            DB --> User: error
            User --> AdminObj: false
            AdminObj --> System: false
            System --> Admin: displayMessage("Failed to assign reward due to database error")
        end alt
    else Tip Does Not Exist
        DB --> Tip: tipNotFound
        Tip --> AdminObj: null
        AdminObj --> System: false
        System --> Admin: displayMessage("Invalid tip ID")
    end alt
else Admin Not Authorized
    AdminObj --> System: error
    System --> Admin: displayMessage("Unauthorized: Admin access required")
end alt

@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