Initial commit :

Base business core classes for User and Role management.
Probably a lot more to be added to these, but I can't get to think to anything else for now.
This commit is contained in:
2007-12-11 23:22:55 +00:00
parent 122b46b3bc
commit 1792b20be0
15 changed files with 358 additions and 0 deletions

10
YACOSCore/.classpath Normal file
View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="ejbModule"/>
<classpathentry kind="src" path="test"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/JVM 1.5.0 (MacOS X Default)"/>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.generic.runtimeTarget/JBoss v5.0"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>

30
YACOSCore/.project Normal file
View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>YACOSCore</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
</natures>
</projectDescription>

View File

@@ -0,0 +1,7 @@
#Tue Dec 11 22:09:32 CET 2007
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.5

View File

@@ -0,0 +1,4 @@
#Tue Dec 11 22:09:32 CET 2007
classpath.helper/org.eclipse.jdt.launching.JRE_CONTAINER\:\:org.eclipse.jdt.internal.launching.macosx.MacOSXType\:\:JVM\ 1.5.0\ (MacOS\ X\ Default)/owners=jst.java\:5.0
classpath.helper/org.eclipse.jst.server.core.container\:\:org.eclipse.jst.server.generic.runtimeTarget\:\:JBoss\ v5.0/owners=jst.ejb\:3.0
eclipse.preferences.version=1

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="YACOSCore">
<wb-resource deploy-path="/" source-path="/ejbModule"/>
<wb-resource deploy-path="/" source-path="/test"/>
<property name="java-output-path" value="build/classes"/>
</wb-module>
</project-modules>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<runtime name="JBoss v5.0"/>
<fixed facet="jst.java"/>
<fixed facet="jst.ejb"/>
<installed facet="jst.java" version="5.0"/>
<installed facet="jst.ejb" version="3.0"/>
</faceted-project>

View File

@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Class-Path:

View File

@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">
</ejb-jar>

View File

@@ -0,0 +1,12 @@
/**
*
*/
package org.yacos.core;
/**
* @author christiancorsano
* TODO
*/
public class Conference {
}

View File

@@ -0,0 +1,66 @@
package org.yacos.core;
/**
* An role of a given type (author,chairman,PCmember or referee)
* defined for a user and a conference
* @author christiancorsano
*
*/
public class Role {
/**
* User for which this role is defined
*/
private User user;
/**
* Conference for which this role is defined
*/
private Conference conference;
/**
* The type of this role
*/
private RoleType type;
public Role(RoleType type,User user, Conference conference) {
super();
setType(type);
setUser(user);
setConference(conference);
}
/**
* @return the user who plays this role
*/
public User getUser() {
return user;
}
/**
* @param user the user who is to play this role
*/
public void setUser(User user) {
this.user = user;
}
/**
* @return the conference for which this role is defined
*/
public Conference getConference() {
return conference;
}
/**
* @param conference the conference for which this role is defined
*/
public void setConference(Conference conference) {
this.conference = conference;
}
/**
* @return the type of this role
*/
public RoleType getType() {
return type;
}
/**
* @param type the type of this role
*/
public void setType(RoleType type) {
this.type = type;
}
}

View File

@@ -0,0 +1,48 @@
/**
*
*/
package org.yacos.core;
/**
* @author christiancorsano
*
*/
public class RoleType {
/**
* Author constant role
*/
static public final RoleType author = new RoleType("author");
/**
* Chairman constant role
*/
static public final RoleType chairman = new RoleType("chairman");
/**
* PCMember constant role
*/
static public final RoleType PCmember = new RoleType("PCmember");
/**
* Referee constant role
*/
static public final RoleType Referee = new RoleType("referee");
/**
* Name of this role type
*/
private String name;
/**
* Private constructor : used to instanciate the constants
* @param name Name of the new RoleType
*/
private RoleType(String name){
this.name = name;
}
/**
* Return the name of this RoleType
* @return
*/
public String getName() {
return this.name;
}
}

View File

@@ -0,0 +1,104 @@
package org.yacos.core;
import java.util.Set;
/**
* A unique User of the system.
* The user is registered globally in the application and would be able to get different roles for
* different conferences.
* @author christiancorsano
*
*/
public class User {
/**
* Unique login of the user
* Is used to identify the user, should be unique and can't be modified
*/
private String login;
/**
* Password : used for authentication purpose only, is only writable
*/
private String password;
/**
* First Name of the user
*/
private String firstName;
/**
* Last name of the user
*/
private String lastName;
/**
* Organization or lab the user belongs to
*/
private String organization;
/**
* Active email (has to be used frequently) of the user
*/
private String email;
public User() {
}
public String getLogin() {
return login;
}
public void setPassword(String password) {
this.password = password;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getOrganization() {
return organization;
}
public void setOrganization(String organization) {
this.organization = organization;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public void addRole(Role role){
// TODO
}
public void addRoleForConference(RoleType roleType, Conference conference){
if(! hasRoleForConference(roleType)){
} else {
// TODO : declare and throw an exception
}
}
public boolean hasRoleForConference(RoleType roleType){
// TODO
return false;
}
public Set<Role> getRoles(){
// TODO
return null;
}
}

View File

@@ -0,0 +1,33 @@
/**
*
*/
package org.yacos.core;
import java.util.Collection;
/**
* @author christiancorsano
*
*/
public class UsersManager {
public Collection<User> getUsers(){
// TODO
return null;
}
/**
* Adds a user into the system
* @param user
*/
public void addUser(User user){
// TODO
}
/**
* Removes a user from the system
* @param user
*/
public void removeUser(User user){
// TODO
}
}

View File

@@ -0,0 +1,15 @@
/**
*
*/
package org.yacos.tests.core;
/**
* @author christiancorsano
*
*/
public class TestRole {
public void aRoleShouldBeUnique(){
// TODO : look for roles of the same type, same user and same conference
}
}

View File

@@ -0,0 +1,7 @@
package org.yacos.tests.core;
import static org.junit.Assert.*;
public class TestUser {
}