Skip to content

Commit

Permalink
Merge pull request #27 from bardia-p/milestone1/OpinionOwl#14/CreateU…
Browse files Browse the repository at this point in the history
…mlClassDiagram to main

UML Class Diagram Creation
  • Loading branch information
Anthony-Massaad authored Nov 11, 2023
2 parents 61f5cb2 + e49bf36 commit 619b3b4
Show file tree
Hide file tree
Showing 3 changed files with 126 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

# ignore plant uml auto generated out folder
**/out/
### STS ###
.apt_generated
.classpath
Expand Down
Binary file added diagrams/Milestone1_UML_class_diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
124 changes: 124 additions & 0 deletions plantUmlFiles/UMLClassDiagram.plantuml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
@startuml Milestone1_UML_class_diagram
skinparam classFontSize 11
skinparam classBackgroundColor beige
skinparam ClassBorderColor red
skinparam ArrowColor red


package "models" <<frame>> {
class "Answer" {
- id: Long
- response: Response
- question: Long
- content: String
+ Answer(response: Response, Long question, content: String)
+ toString(): String
+ equals(o: Object): boolean
}

class "AppUser" {
- id: Long
- username: String
- password: String
- listSurveys: List<Survey>
+ AppUser(username: String, password: String)
+ addSurvey(survey: Survey): void
+ removeSurvey(surveyId: Long): boolean
+ toString(): String
+ equals(o: Object): boolean
}

enum "QuestionType" {
LONG_ANSWER("Long Answer")
RADIO_CHOICE("Radio Choice")
RANGE("Range")
- types: String {readonly}
+ QuestionType(type: String)
}

class "Question" {
- id: Long
- prompt: String
- type: QuestionType
- survey: Survey
+ Question(survey: Survey, prompt: String, type: QuestionType)
+ toString(): String
+ equals(o: Object): boolean
}

class "LongAnswerQuestion" {
- charLimit: Integer
+ LongAnswerQuestion()
+ LongAnswerQuestion(survey: Survey, prompt: String, charLimit: Integer)
+ toString(): String
+ equals(o: Object): boolean
}

class "RadioChoiceQuestion" {
- choices: String[]
+ RadioChoiceQuestion()
+ RadioChoiceQuestion(survey: Survey, prompt: String, choices: String[])
+ toString(): String
+ equals(o: Object): boolean
}

class "RangeQuestion" {
- lower: Integer
- upper: Integer
- incremental: Integer
+ RangeQuestion()
+ RangeQuestion(prompt: String, lower: Integer, upper: Integer)
+ RangeQuestion(survey: Survey, prompt: String, lower: Integer, upper: Integer, increment: Integer)
+ toString(): String
+ equals(o: Object): boolean
}

class "Response" {
- id: Long
- survey: Survey
- answers: List<Answer>
+ Response(survey: Survey)
+ addAnswer(question: Long, content: String): void
+ toString(): String
+ equals(o: Object): boolean
}

class "Survey" {
- id: Long
- questions: List<Question>
- responses: List<Response>
- closed: boolean
- title: String
- user: AppUser
+ Survey(user: AppUser, title: String)
+ addQuestion(question: Question): boolean
+ removeQuestion(questionId: long): boolean
+ addResponse(response: Response): boolean
+ removeResponse(responseId: Long): boolean
+ getResponsesForQuestion(questionId: Long): List<String>
+ toString(): String
+ equals(o: Object): boolean
}
}



' note right of "APIController"::createSurvey
' // returns 200 if survey created successfully
' // otherwise look at integer responses to handle errors
' end note

' Relationship arrows
"RangeQuestion" -up-|> "Question"
"LongAnswerQuestion" -up-|> "Question"
"RadioChoiceQuestion" -up-|> "Question"
"Question" --* "1" "QuestionType"

"Response" "1 " --* "0..* " "Answer"

"Survey" "1 " --* "0..* " "Question"
"Survey" "1 " --* "0..* " "Response"
"AppUser" "1 " --* "0..* " "Survey"


@enduml

0 comments on commit 619b3b4

Please sign in to comment.