Hello all
    I am working on a project which has following
requirements.Actually this is not real project .I am used to work with
relational DB`s and for future projects I want to use GAE.Through this
project I just want to learn best ways to use GAE .
It is basically implementation of discussion groups(Same as forums on
different sites).In the website users can discuss different topics
with friends and other users of the website.So I have to implement
following features.
1) User can have many friends.
2) Each user can create multiple discussions.
3) Each discussion will have participant in it.
4) If there is any update in the discussion then participants of the
discussion will get notifications.
5) A user can observe his friends by adding them to his observed
list.if an observed person creates any discussion a notification will
be sent to his observers.
6) Any user can view list of his observers and list of users he/she is
observing.
7) Every user can create his profile on website .He can put his
picture ,title and tags.
8) Every discussion will have profile on website .It will have
picture ,title and tags.
9) Any user of the website can search people or discussions based on
the tags associated with the users and discussions.For example If user
A has 3 tags in his profile like cooking,continental and Asian and
user B has cooking and Asian in his tags and there is discussion named
D1 on website which has tags continental and chines then if any user
search for keyword continental user A and discussion D1 should come as
search results.
10) If a user has created a discussion all the participants of that
discussion will be added to his work group.For example let us say
there are 4 users A,B,C,D and A creates a discussion named D1 and add
user B,C in it.then work group of A will have B and C in it. Work
group of B will have A and C in it.Work group of C will have A and B
in it.Now if user D creates discussion named D2 and add C as
participant in it then work group of D will have C in it.work group of
C  will now have A,B and D in it.In other words work group is list of
all the users with whom a user is participating in any discussion.

Its GUI will be as below
 1) After log in,  user Home page will be shown.On the home page there
will be right bar and main content area.
In the right bar we will show
    a) His 10 recent active friends along with link to see all his
friends list and total count of his friends.
    b) His 10 recent discussions created by him with link to see list
of all discussions created by him and total count of his discussions.
    c) 10 recent discussion in which he is participant with link to
see list of all discussions in which he his participant and total
count of his discussions.
   d) 10 recent active user to whom he is observing along with link to
see list of all observed user and total count of user observed.
   f) 10 recent active user who are observing him along with link to
see list of all his observers and total count of users observing.
   g) 10 recent active users from his work group along with link to
see list of all the users in work group.(Work group is list of all the
participants of all discussions in which user is participating) and
total count of his work group.
In the Main Content we will have
  a) Initially after log in it will display all the notifications of
the user.
  b) If user click on any link in the right bar then result of that
action will be displayed in main content.

To implement this I have written following entities.I do not know
whether it is the best way to do it .Please help me to know how we can
improve this .

I am planing to keep Discussion , Message , Workgroup , Notification
in one entity group.

package com.test;

import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;


@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Discussion implements Serializable{
        private static final long serialVersionUID = -9115235415573154018L;

        @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key key;

    @Persistent
    private String title;

    @Persistent
    private String createdBy;

    @Persistent
    private Date creationDate;

        @Persistent
        private String profileImagePath;

        @Persistent(defaultFetchGroup = "true")
        private Set<String> tags;

    @Persistent(defaultFetchGroup="true")
    private Set<String> participants;

        public Discussion(Key key, String title, String createdBy,
                        Date creationDate, String profileImagePath) {
                super();
                this.key = key;
                this.title = title;
                this.createdBy = createdBy;
                this.creationDate = creationDate;
                this.profileImagePath = profileImagePath;
                this.tags = new HashSet<String>();
                this.participants = new HashSet<String>();
        }

        public Key getKey() {
                return key;
        }

        public void setKey(Key key) {
                this.key = key;
        }

        public String getTitle() {
                return title;
        }

        public void setTitle(String title) {
                this.title = title;
        }

        public String getCreatedBy() {
                return createdBy;
        }

        public void setCreatedBy(String createdBy) {
                this.createdBy = createdBy;
        }

        public Date getCreationDate() {
                return creationDate;
        }

        public void setCreationDate(Date creationDate) {
                this.creationDate = creationDate;
        }

        public String getProfileImagePath() {
                return profileImagePath;
        }

        public void setProfileImagePath(String profileImagePath) {
                this.profileImagePath = profileImagePath;
        }

        public Set<String> getTags() {
                return tags;
        }

        public void setTags(Set<String> tags) {
                this.tags = tags;
        }

        public Set<String> getParticipants() {
                return participants;
        }

        public void setParticipants(Set<String> participants) {
                this.participants = participants;
        }

        public static long getSerialversionuid() {
                return serialVersionUID;
        }


}


package com.test;

import java.io.Serializable;
import java.util.Date;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;


@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Message implements Serializable{
        private static final long serialVersionUID = -9115235415573154018L;

        @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key key;

    @Persistent
    private String discussionId;

        @Persistent
    private String title;

    @Persistent
    private String createdBy;

    @Persistent
    private Date creationDate;

        public Message(Key key, String discussionId, String title,
                        String createdBy, Date creationDate) {
                super();
                this.key = key;
                this.discussionId = discussionId;
                this.title = title;
                this.createdBy = createdBy;
                this.creationDate = creationDate;
        }

        public Key getKey() {
                return key;
        }

        public void setKey(Key key) {
                this.key = key;
        }

        public String getDiscussionId() {
                return discussionId;
        }

        public void setDiscussionId(String discussionId) {
                this.discussionId = discussionId;
        }

        public String getTitle() {
                return title;
        }

        public void setTitle(String title) {
                this.title = title;
        }

        public String getCreatedBy() {
                return createdBy;
        }

        public void setCreatedBy(String createdBy) {
                this.createdBy = createdBy;
        }

        public Date getCreationDate() {
                return creationDate;
        }

        public void setCreationDate(Date creationDate) {
                this.creationDate = creationDate;
        }

        public static long getSerialversionuid() {
                return serialVersionUID;
        }

}

package com.test;

import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;


@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Notification implements Serializable{
        private static final long serialVersionUID = -9115235415573154018L;

        @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Long id;

        @Persistent
    private String title;

    @Persistent
    private String createdBy;

    @Persistent
    private Date creationDate;

    @Persistent(defaultFetchGroup="true")
    private Set<String> users;

        public Notification(Long id, String title, String createdBy,
                        Date creationDate) {
                super();
                this.id = id;
                this.title = title;
                this.createdBy = createdBy;
                this.creationDate = creationDate;
                this.users =  new HashSet<String>();
        }

        public Long getId() {
                return id;
        }

        public void setId(Long id) {
                this.id = id;
        }

        public String getTitle() {
                return title;
        }

        public void setTitle(String title) {
                this.title = title;
        }

        public String getCreatedBy() {
                return createdBy;
        }

        public void setCreatedBy(String createdBy) {
                this.createdBy = createdBy;
        }

        public Date getCreationDate() {
                return creationDate;
        }

        public void setCreationDate(Date creationDate) {
                this.creationDate = creationDate;
        }

        public Set<String> getUsers() {
                return users;
        }

        public void setUsers(Set<String> users) {
                this.users = users;
        }

        public static long getSerialversionuid() {
                return serialVersionUID;
        }

}

package com.test;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class User implements Serializable {
        private static final long serialVersionUID = 1L;

        @PrimaryKey
        @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
        private Key key;

        @Persistent
        private String password;

        @Persistent
        private String profileImagePath;

        @Persistent(defaultFetchGroup = "true")
        private Set<String> tags;

        @Persistent(defaultFetchGroup = "true")
        private Set<String> friends;

        @Persistent(defaultFetchGroup = "true")
        private Set<String> observing;

        public User(Key key, String password, String profileImagePath) {
                super();
                this.key = key;
                this.password = password;
                this.profileImagePath = profileImagePath;
                this.tags =  new HashSet<String>();;
                this.friends =  new HashSet<String>();
                this.observing =  new HashSet<String>();
        }

        public Key getKey() {
                return key;
        }

        public void setKey(Key key) {
                this.key = key;
        }

        public String getPassword() {
                return password;
        }

        public void setPassword(String password) {
                this.password = password;
        }

        public String getProfileImagePath() {
                return profileImagePath;
        }

        public void setProfileImagePath(String profileImagePath) {
                this.profileImagePath = profileImagePath;
        }

        public Set<String> getTags() {
                return tags;
        }

        public void setTags(Set<String> tags) {
                this.tags = tags;
        }

        public Set<String> getFriends() {
                return friends;
        }

        public void setFriends(Set<String> friends) {
                this.friends = friends;
        }

        public Set<String> getObserving() {
                return observing;
        }

        public void setObserving(Set<String> observing) {
                this.observing = observing;
        }

        public static long getSerialversionuid() {
                return serialVersionUID;
        }

}

package com.test;

import java.io.Serializable;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;


@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class WorkGroup implements Serializable{
        private static final long serialVersionUID = -9115235415573154018L;

        @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key key;

    @Persistent
    private String userName;

    @Persistent
    private String workGroupUserName;

        public WorkGroup(Key key, String userName, String workGroupUserName)
{
                super();
                this.key = key;
                this.userName = userName;
                this.workGroupUserName = workGroupUserName;
        }

        public Key getKey() {
                return key;
        }

        public void setKey(Key key) {
                this.key = key;
        }

        public String getUserName() {
                return userName;
        }

        public void setUserName(String userName) {
                this.userName = userName;
        }

        public String getWorkGroupUserName() {
                return workGroupUserName;
        }

        public void setWorkGroupUserName(String workGroupUserName) {
                this.workGroupUserName = workGroupUserName;
        }

        public static long getSerialversionuid() {
                return serialVersionUID;
        }
}



-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to