Skip to content

Commit

Permalink
[UserManagement] Init the User Management component
Browse files Browse the repository at this point in the history
  • Loading branch information
cimela committed Aug 31, 2018
1 parent a97c41e commit 24e501f
Show file tree
Hide file tree
Showing 12 changed files with 210 additions and 2 deletions.
4 changes: 2 additions & 2 deletions component/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

<modules>
<module>sample</module>
<!--<module>user-management</module>
<module>authentication</module>-->
<module>user-management</module>
<!--<module>authentication</module>-->
</modules>

</project>
22 changes: 22 additions & 0 deletions component/user-management/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.github.cimela.erestaurant</groupId>
<artifactId>component</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<artifactId>user-management</artifactId>
<packaging>pom</packaging>

<modules>
<module>user-management-shared</module>
<module>user-management-service</module>
<module>user-management-webapp</module>
</modules>

</project>
20 changes: 20 additions & 0 deletions component/user-management/user-management-service/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.github.cimela.erestaurant</groupId>
<artifactId>user-management</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<artifactId>user-management-service</artifactId>

<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>user-management-shared</artifactId>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package java.com.github.cimela.e.restaurant.user.repository;

import org.bson.types.ObjectId;

import com.github.cimela.e.restaurant.base.repository.BaseCustomRepository;
import com.github.cimela.e.restaurant.base.repository.BaseRepository;
import com.github.cimela.e.restaurant.user.model.User;

public interface UserRepository extends BaseRepository<User, ObjectId>, BaseCustomRepository<User, ObjectId> {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package java.com.github.cimela.e.restaurant.user.repository;

import org.bson.types.ObjectId;

import com.github.cimela.e.restaurant.base.repository.BaseRepositoryImpl;
import com.github.cimela.e.restaurant.user.model.User;

public class UserRepositoryImpl extends BaseRepositoryImpl<User, ObjectId> {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package java.com.github.cimela.e.restaurant.user.service;

import com.github.cimela.e.restaurant.base.appserver.BaseResponse;
import com.github.cimela.e.restaurant.base.model.MessageObject;
import com.github.cimela.e.restaurant.base.service.AbstractComponentService;
import com.github.cimela.e.restaurant.user.appserver.UserRequest;
import com.github.cimela.e.restaurant.user.model.UserVO;

public class SampleService extends AbstractComponentService<UserRequest, BaseResponse> {

protected static final String TARGET_SAMPLE = "sample";
protected static final String MSG_SAMPLE_FAILED = "sample.failed";
protected static final String MSG_SAMPLE_SUCCESS = "sample.success";

@Override
public String getTarget() {
return TARGET_SAMPLE;
}

@Override
public BaseResponse handle(UserRequest request) {
BaseResponse response = new BaseResponse();
switch (request.getType()) {
case CREATE:
response.setSuccess(true);
response.setData(new UserVO());
break;
case UPDATE:
default:
if(request.getSample() != null) {
response.setSuccess(true);
response.setData(new MessageObject(MSG_SAMPLE_SUCCESS));
} else {
response.setSuccess(false);
response.setData(new MessageObject(MSG_SAMPLE_FAILED));
}
break;

}
return response;
}

}
20 changes: 20 additions & 0 deletions component/user-management/user-management-shared/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.github.cimela.erestaurant</groupId>
<artifactId>user-management</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<artifactId>user-management-shared</artifactId>

<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>model</artifactId>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.github.cimela.e.restaurant.user.appserver;

import com.github.cimela.e.restaurant.base.appserver.BaseRequest;
import com.github.cimela.e.restaurant.user.model.UserVO;

public class UserRequest extends BaseRequest {

private UserVO sample;

public UserVO getSample() {
return sample;
}

public void setSample(UserVO sample) {
this.sample = sample;
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.github.cimela.e.restaurant.user.model;

import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.index.Indexed;

import com.github.cimela.e.restaurant.base.model.GenericModel;

public class User extends GenericModel<ObjectId> {
@Indexed(unique=true)
private String username;

private String password;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.github.cimela.e.restaurant.user.model;

import com.github.cimela.e.restaurant.base.model.GenericModelVO;

public class UserVO extends GenericModelVO<User> {

public UserVO() {
super(User.class);
}

public UserVO(User sample, String...excludeAttrs) {
super(sample, User.class, excludeAttrs);
}

}
20 changes: 20 additions & 0 deletions component/user-management/user-management-webapp/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.github.cimela.erestaurant</groupId>
<artifactId>user-management</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<artifactId>user-management-webapp</artifactId>

<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>user-management-shared</artifactId>
</dependency>
</dependencies>
</project>
15 changes: 15 additions & 0 deletions root/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,21 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>user-management-shared</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>user-management-service</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>user-management-webapp</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down

0 comments on commit 24e501f

Please sign in to comment.