-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UserManagement] Init the User Management component
- Loading branch information
Showing
12 changed files
with
210 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
11 changes: 11 additions & 0 deletions
11
...ice/src/main/java/java/com/github/cimela/e/restaurant/user/repository/UserRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> { | ||
|
||
} |
10 changes: 10 additions & 0 deletions
10
...src/main/java/java/com/github/cimela/e/restaurant/user/repository/UserRepositoryImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> { | ||
|
||
} |
43 changes: 43 additions & 0 deletions
43
...service/src/main/java/java/com/github/cimela/e/restaurant/user/service/SampleService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
19 changes: 19 additions & 0 deletions
19
...ement-shared/src/main/java/com/github/cimela/e/restaurant/user/appserver/UserRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
|
||
|
||
} |
13 changes: 13 additions & 0 deletions
13
.../user-management-shared/src/main/java/com/github/cimela/e/restaurant/user/model/User.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
15 changes: 15 additions & 0 deletions
15
...ser-management-shared/src/main/java/com/github/cimela/e/restaurant/user/model/UserVO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters