Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of https://github.com/gpuliyar/oss-scrum

  • Loading branch information...
commit ad8f76cf911e1cfc80e9c66cf7b97c630572e68d 2 parents 0cf339e + 4ba7469
@rishabhsrao rishabhsrao authored
View
36 .classpath
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes" path="src/main/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
View
6 .gitignore
@@ -2,6 +2,12 @@ install.sh
target/*
test-output/*
bin/*
+.classpath
+faces-config.NavData
+.metadata
+.project
+.settings
+target
# Ignore NetBeans and Glassfish specific files
src/main/webapp/WEB-INF/glassfish-web.xml
View
2  .metadata/src/main/webapp/WEB-INF/faces-config.pageflow
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<pageflow:Pageflow xmlns:pageflow="http://www.sybase.com/suade/pageflow" id="pf13552522818590" configfile="/oss-scrum/src/main/webapp/WEB-INF/faces-config.xml"/>
View
42 .project
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>oss-scrum</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>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ <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
12 .settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,12 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+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.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.6
View
4 .settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
View
2  pom.xml
@@ -20,7 +20,7 @@
<properties>
<spring.version>3.1.2.RELEASE</spring.version>
- <netbeans.hint.deploy.server>gfv3ee6</netbeans.hint.deploy.server>
+ <netbeans.hint.deploy.server>gfv3ee6</netbeans.hint.deploy.server>
</properties>
<dependencies>
View
5 src/main/java/oss/process/scrum/service/AuthenticationService.java
@@ -0,0 +1,5 @@
+package oss.process.scrum.service;
+
+public interface AuthenticationService {
+ boolean login(String userName, String userPassword);
+}
View
25 src/main/java/oss/process/scrum/service/AuthenticationServiceImpl.java
@@ -0,0 +1,25 @@
+package oss.process.scrum.service;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.authentication.AuthenticationManager;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.stereotype.Service;
+
+@Service(value = "authenticationService")
+public class AuthenticationServiceImpl implements AuthenticationService {
+ @Autowired
+ private AuthenticationManager authenticationManager;
+
+ @Override
+ public boolean login(String userName, String userPassword) {
+ Authentication authenticate = authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(userName, userPassword));
+ if (authenticate.isAuthenticated()) {
+ SecurityContextHolder.getContext().setAuthentication(authenticate);
+ return true;
+ }
+
+ return false;
+ }
+}
View
77 src/main/java/oss/process/scrum/service/OrganizationServiceImpl.java
@@ -0,0 +1,77 @@
+package oss.process.scrum.service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.Resource;
+
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import oss.process.scrum.dao.model.IDao;
+import oss.process.scrum.dao.vo.ScrOrganization;
+import oss.process.scrum.domain.Organization;
+import oss.process.scrum.exception.AppException;
+import oss.process.scrum.mapper.IMapper;
+
+@Service(value = "organizationService")
+@Transactional
+public class OrganizationServiceImpl implements OrganizationService {
+ @Resource(name = "scrOrganizationDao")
+ private IDao<ScrOrganization, String> organizationDao;
+ @Resource(name = "organizationToScrOrganizationMapper")
+ private IMapper<Organization, ScrOrganization> orgToScrOrgMapper;
+ @Resource(name = "scrOrganizationToOrganizationMapper")
+ private IMapper<ScrOrganization, Organization> scrOrgToOrgMapper;
+
+ @Override
+ public void create(Organization data) throws AppException {
+ ScrOrganization scrOrganization = orgToScrOrgMapper.map(data);
+ organizationDao.persist(scrOrganization);
+ }
+
+ @Override
+ public void update(Organization data) throws AppException {
+ ScrOrganization scrOrganization = orgToScrOrgMapper.map(data);
+ organizationDao.persist(scrOrganization);
+ }
+
+ @Override
+ public void delete(Organization data) throws AppException {
+ ScrOrganization scrOrganization = orgToScrOrgMapper.map(data);
+ organizationDao.delete(scrOrganization);
+ }
+
+ @Override
+ public Organization retrieveById(String id) throws AppException {
+ ScrOrganization scrOrganization = organizationDao.findById(id);
+ Organization organization = scrOrgToOrgMapper.map(scrOrganization);
+ return organization;
+ }
+
+ @Override
+ public List<Organization> retrieveByExample(Organization data) throws AppException {
+ ScrOrganization scrOrganization = orgToScrOrgMapper.map(data);
+ List<ScrOrganization> scrOrganizations = organizationDao.findByExample(scrOrganization);
+ List<Organization> organizations = new ArrayList<Organization>();
+
+ for (ScrOrganization scrOrganization2 : scrOrganizations) {
+ organizations.add(scrOrgToOrgMapper.map(scrOrganization2));
+ }
+
+ return organizations;
+ }
+
+ @Override
+ public List<Organization> retrieveAll() throws AppException {
+ ScrOrganization scrOrganization = new ScrOrganization();
+ List<ScrOrganization> scrOrganizations = organizationDao.findByExample(scrOrganization);
+ List<Organization> organizations = new ArrayList<Organization>();
+
+ for (ScrOrganization scrOrganization2 : scrOrganizations) {
+ organizations.add(scrOrgToOrgMapper.map(scrOrganization2));
+ }
+
+ return organizations;
+ }
+}
View
8 src/main/java/oss/process/scrum/service/UserService.java
@@ -0,0 +1,8 @@
+package oss.process.scrum.service;
+
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.security.core.userdetails.UsernameNotFoundException;
+
+public interface UserService {
+ UserDetails loadUserByUserName(String username) throws UsernameNotFoundException;
+}
View
46 src/main/java/oss/process/scrum/service/UserServiceImpl.java
@@ -0,0 +1,46 @@
+package oss.process.scrum.service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.PostConstruct;
+
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.authority.SimpleGrantedAuthority;
+import org.springframework.security.core.userdetails.User;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.security.core.userdetails.UsernameNotFoundException;
+
+public class UserServiceImpl implements UserService {
+ private Map<String, User> users = new HashMap<String, User>();
+
+ @PostConstruct
+ public void init() {
+ boolean enabled = true;
+ boolean accountNonExpired = true;
+ boolean credentialsNonExpired = true;
+ boolean accountNonLocked = true;
+
+ List<GrantedAuthority> adminAuthorities = new ArrayList<GrantedAuthority>();
+ adminAuthorities.add(new SimpleGrantedAuthority("ROLE_ADMIN"));
+
+ List<GrantedAuthority> userAuthorities = new ArrayList<GrantedAuthority>();
+ userAuthorities.add(new SimpleGrantedAuthority("ROLE_REGISTERED"));
+
+ users.put("admin", new User("admin", "admin", enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, adminAuthorities));
+ users.put("users", new User("users", "users", enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, userAuthorities));
+ }
+
+ @Override
+ public UserDetails loadUserByUserName(String username) throws UsernameNotFoundException {
+ User user = users.get(username);
+
+ if (user != null) {
+ return user;
+ } else {
+ throw new UsernameNotFoundException("UserAccount for name \"" + username + "\" not found.");
+ }
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.