Skip to content
This repository was archived by the owner on May 18, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions RemoteSystemsTempFiles/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>RemoteSystemsTempFiles</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
<nature>org.eclipse.rse.ui.remoteSystemsTempNature</nature>
</natures>
</projectDescription>
6 changes: 6 additions & 0 deletions Trello/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="output" path="bin"/>
</classpath>
1 change: 1 addition & 0 deletions Trello/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bin/
17 changes: 17 additions & 0 deletions Trello/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Trello</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
11 changes: 11 additions & 0 deletions Trello/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
5 changes: 5 additions & 0 deletions Trello/src/enums/Access.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package enums;

public enum Access {
PUBLIC, PRIVATE;
}
7 changes: 7 additions & 0 deletions Trello/src/exceptions/BoardNotFoundException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package exceptions;

public class BoardNotFoundException extends Exception {
public BoardNotFoundException(String s) {
super(s);
}
}
7 changes: 7 additions & 0 deletions Trello/src/exceptions/CardNotFoundException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package exceptions;

public class CardNotFoundException extends Exception {
public CardNotFoundException(String s) {
super(s);
}
}
7 changes: 7 additions & 0 deletions Trello/src/exceptions/DifferentBoardException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package exceptions;

public class DifferentBoardException extends Exception{
public DifferentBoardException(String s) {
super(s);
}
}
7 changes: 7 additions & 0 deletions Trello/src/exceptions/ListNotFoundException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package exceptions;

public class ListNotFoundException extends Exception {
public ListNotFoundException(String s) {
super(s);
}
}
7 changes: 7 additions & 0 deletions Trello/src/exceptions/UserNotFoundException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package exceptions;

public class UserNotFoundException extends Exception {
public UserNotFoundException(String s) {
super(s);
}
}
32 changes: 32 additions & 0 deletions Trello/src/models/Application.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package models;
import java.util.*;

public class Application {
private Map<UUID,Board> boards;
private Map<String,User> users; // Here key would be user-email
private Map<UUID,BoardList> lists;
private Map<UUID,Card> cards;

public Application() {
this.boards = new HashMap<UUID,Board>();
this.users = new HashMap<String,User>();
this.lists = new HashMap<UUID,BoardList>();
this.cards = new HashMap<UUID,Card>();
}

public Map<UUID,Board> getBoards() {
return this.boards;
}

public Map<String,User> getUsers() {
return this.users;
}

public Map<UUID,BoardList> getLists() {
return this.lists;
}

public Map<UUID,Card> getCards() {
return this.cards;
}
}
103 changes: 103 additions & 0 deletions Trello/src/models/Board.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
package models;
import java.util.*;

import enums.Access;

public class Board {
private UUID id;
private String name;
private Access privacy;
private List<User> members;
private List<BoardList> lists;

public Board(String name)
{
this.id = UUID.randomUUID();
this.name = name;
this.privacy = Access.PUBLIC;
this.members = new ArrayList<User>();
this.lists = new ArrayList<BoardList>();
}

public UUID getId() {
return this.id;
}

public String getName() {
return this.name;
}

public void setName(String name) {
this.name = name;
}

public void setPrivacy(Access privacy) {
this.privacy = privacy;
}

public void addUser(User user) {
this.members.add(user);
}

public void removeUser(User user) {
this.members.remove(user);
}

public void addList(BoardList list) {
this.lists.add(list);
}

public void removeList(BoardList list) {
this.lists.remove(list);
}

public List<BoardList> getLists() {
return this.lists;
}

@Override
public String toString() {
int index;
StringBuilder displayString = new StringBuilder("{ id : "+id+", name: "+name+", privacy : "+privacy);
if(lists.size()>0)
{
displayString.append(", lists : [");
for(index=0; index<lists.size(); index++) {
displayString.append(lists.get(index));
if(index < lists.size()-1)
displayString.append(", ");
}
displayString.append(" ]");
}
if(members.size()>0)
{
displayString.append(", members : [");
for(index=0; index<members.size(); index++) {
displayString.append(members.get(index));
if(index < members.size()-1)
displayString.append(", ");
}
displayString.append(" ]");
}
displayString.append(" }");
return new String(displayString);
}

@Override
public boolean equals(Object board) {
if(board == this) {
return true;
}

if(!(board instanceof Board)) {
return false;
}

return this.getId().equals(((Board)board).getId());
}

@Override
public int hashCode() {
return this.id.hashCode();
}
}
80 changes: 80 additions & 0 deletions Trello/src/models/BoardList.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
package models;
import java.util.*;

public class BoardList {
private UUID userId;
private String name;
private List<Card> cards;
private Board board;

public BoardList(String name,Board board)
{
this.userId = UUID.randomUUID();
this.name = name;
this.board = board;
this.cards = new ArrayList<Card>();
}

public UUID getId() {
return this.userId;
}

public String getName() {
return this.name;
}

public void setName(String name) {
this.name = name;
}

public void addCard(Card card) {
this.cards.add(card);
}

public void removeCard(Card card) {
this.cards.remove(card);
}

public List<Card> getCards() {
return this.cards;
}

public Board getBoard() {
return this.board;
}

@Override
public String toString() {
StringBuilder displayString = new StringBuilder("{ id : "+userId+", name: "+name);
if(cards.size()>0)
{
displayString.append(", cards : [");
for(int index=0; index<cards.size(); index++) {
displayString.append(cards.get(index));
if(index < cards.size()-1)
displayString.append(", ");
}
displayString.append(" ]");
}
displayString.append(" }");
return new String(displayString);
}

@Override
public boolean equals(Object list) {
if(list == this) {
return true;
}

if(!(list instanceof BoardList)) {
return false;
}

return this.getId().equals(((BoardList)list).getId());
}

@Override
public int hashCode() {
return this.userId.hashCode();
}
}
82 changes: 82 additions & 0 deletions Trello/src/models/Card.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package models;
import java.util.*;


public class Card {
private UUID id;
private String name;
private String description;
private User assignee;
private BoardList list;

public Card(String name,BoardList list)
{
this.id = UUID.randomUUID();
this.name = name;
this.list = list;
}

public UUID getId() {
return this.id;
}

public String getName() {
return this.name;
}

public void setName(String name) {
this.name = name;
}

public void setDescription(String description) {
this.description = description;
}

public BoardList getList() {
return this.list;
}

public void setList(BoardList newList)
{
if(list!=null && !list.getBoard().getId().equals(newList.getBoard().getId())) {
System.out.println("The list can't be moved to different board.");
return ;
}
this.list.getCards().remove(this.getId());
newList.addCard(this);
this.list = newList;
}

public void setAssignee(User assignee) {
this.assignee = assignee;
}

@Override
public String toString() {
StringBuilder displayString = new StringBuilder("{ id : "+id+", name: "+name);
if(description!=null && description.length()>0)
displayString.append(", description: "+description);
if(assignee!=null)
displayString.append(", assignedTo: "+assignee.getEmail());
displayString.append('}');
return new String(displayString);
}

@Override
public boolean equals(Object card) {
if(card == this) {
return true;
}

if(!(card instanceof Card)) {
return false;
}

return this.getId().equals(((Card)card).getId());
}

@Override
public int hashCode() {
return this.id.hashCode();
}
}
Loading