├── doc ├── DDD-design.md └── images │ ├── forum.png │ ├── group.png │ ├── post.png │ ├── role.png │ ├── team.png │ ├── backlog.png │ ├── member.png │ ├── product.png │ ├── tenant.png │ ├── discussion.png │ ├── identity-uml.png │ └── collaboration-uml.png ├── zhacker-sample-ovation-collaboration └── src │ └── main │ ├── resources │ ├── bootstrap.yml │ └── application.yaml │ └── java │ └── top │ └── zhacker │ └── ddd │ └── collaboration │ ├── port │ ├── client │ │ ├── Systems.java │ │ ├── UserInRoleClient.java │ │ └── UserVO.java │ └── message │ │ ├── DiscussionChannel.java │ │ └── ExclusiveDiscussionCreationListener.java │ ├── application │ ├── vo │ │ ├── ForumCommandResult.java │ │ ├── CalendarCommandResult.java │ │ └── DiscussionCommandResult.java │ ├── command │ │ ├── ForumChangeSubjectCommand.java │ │ ├── ForumAssignModeratorCommand.java │ │ ├── ForumChangeDescriptionCommand.java │ │ ├── ForumStartCommand.java │ │ ├── DiscussionStartCommand.java │ │ ├── PostCreateCommand.java │ │ └── PostModerateCommand.java │ └── PostQueryService.java │ ├── CollaborationApp.java │ └── domain │ ├── forum │ ├── discussion │ │ ├── event │ │ │ ├── DiscussionClosed.java │ │ │ ├── DiscussionReopened.java │ │ │ └── DiscussionStarted.java │ │ ├── DiscussionId.java │ │ ├── post │ │ │ ├── PostId.java │ │ │ └── PostRepository.java │ │ └── DiscussionRepository.java │ ├── ForumRepository.java │ ├── ForumId.java │ └── event │ │ ├── ForumClosed.java │ │ ├── ForumReopened.java │ │ ├── ForumSubjectChanged.java │ │ ├── ForumDescriptionChanged.java │ │ └── ForumModeratorChanged.java │ ├── calendar │ ├── CalendarId.java │ ├── entry │ │ ├── CalendarEntryId.java │ │ ├── CalendarEntryRepository.java │ │ ├── AlarmUnitsType.java │ │ └── RepeatType.java │ └── CalendarRepository.java │ ├── tenant │ └── Tenant.java │ └── collaborator │ ├── Owner.java │ ├── Author.java │ ├── Creator.java │ ├── Moderator.java │ ├── Participant.java │ └── CollaboratorService.java ├── zhacker-sample-ovation-identityaccess └── src │ └── main │ ├── resources │ ├── bootstrap.yml │ ├── StoredEvent.hbm.xml │ ├── GroupMember.hbm.xml │ ├── Role.hbm.xml │ ├── RegistrationInvitation.hbm.xml │ ├── Group.hbm.xml │ ├── Tenant.hbm.xml │ ├── User.hbm.xml │ └── application.yaml │ └── java │ └── top │ └── zhacker │ └── ddd │ └── identity │ ├── domain │ ├── user │ │ ├── EncryptionService.java │ │ ├── event │ │ │ ├── UserPasswordChanged.java │ │ │ └── UserEnablementChanged.java │ │ ├── person │ │ │ ├── event │ │ │ │ ├── PersonNameChanged.java │ │ │ │ └── PersonContactInformationChanged.java │ │ │ └── EmailAddress.java │ │ ├── UserRepo.java │ │ ├── UserDescriptor.java │ │ └── AuthenticationService.java │ ├── tenant │ │ ├── TenantId.java │ │ ├── TenantRepo.java │ │ ├── event │ │ │ ├── TenantProvisioned.java │ │ │ ├── TenantActivated.java │ │ │ └── TenantDeactivated.java │ │ └── invitation │ │ │ └── InvitationDescriptor.java │ ├── group │ │ ├── GroupRepo.java │ │ ├── GroupMemberType.java │ │ ├── event │ │ │ ├── GroupProvisioned.java │ │ │ ├── GroupUserAdded.java │ │ │ ├── GroupUserRemoved.java │ │ │ ├── GroupGroupAdded.java │ │ │ └── GroupGroupRemoved.java │ │ └── GroupMember.java │ └── role │ │ ├── RoleRepo.java │ │ ├── RoleSimple.java │ │ ├── event │ │ ├── RoleProvisioned.java │ │ ├── GroupUnassignedFromRole.java │ │ ├── UserUnassignedFromRole.java │ │ ├── GroupAssignedToRole.java │ │ └── UserAssignedToRole.java │ │ └── AuthorizationService.java │ ├── application │ ├── command │ │ ├── OfferRegistrationInvitationCommand.java │ │ ├── DeactivateTenantCommand.java │ │ ├── AssignGroupToRoleCommand.java │ │ ├── UnassignGroupFromRoleCommand.java │ │ ├── ActivateTenantCommand.java │ │ ├── AddUserToGroupCommand.java │ │ ├── AuthenticateUserCommand.java │ │ ├── RemoveUserFromGroupCommand.java │ │ ├── AssignUserToRoleCommand.java │ │ ├── UnassignUserFromRoleCommand.java │ │ ├── AddGroupToGroupCommand.java │ │ ├── ChangePrimaryTelephoneCommand.java │ │ ├── ChangeSecondaryTelephoneCommand.java │ │ ├── ChangeEmailAddressCommand.java │ │ ├── RemoveGroupFromGroupCommand.java │ │ └── ProvisionGroupCommand.java │ ├── request │ │ └── TenantProvisionRequest.java │ └── NotificationApplicationService.java │ ├── IdentityApp.java │ ├── api │ ├── ConfigApi.java │ └── vo │ │ └── UserVO.java │ ├── infra │ ├── mapper │ │ └── RoleMapper.java │ ├── repo │ │ ├── impl │ │ │ └── SpringDataUserRepo.java │ │ ├── GroupMemberTypeUserType.java │ │ ├── HibernateGroupRepo.java │ │ └── HibernateRoleRepo.java │ ├── job │ │ └── NotificationPublishJob.java │ ├── service │ │ └── MD5EncryptionService.java │ └── listener │ │ └── UserCreatedListener.java │ └── IdentityConfig.java ├── .gitignore ├── zhacker-sample-ovation-agilepm └── src │ └── main │ ├── resources │ └── application.yaml │ └── java │ └── top │ └── zhacker │ └── ddd │ └── agilepm │ ├── application │ ├── ApplicationConifg.java │ ├── member │ │ └── command │ │ │ ├── DisableTeamMemberCommand.java │ │ │ ├── DisableProductOwnerCommand.java │ │ │ ├── DisableMemberCommand.java │ │ │ ├── ChangeTeamMemberEmailAddressCommand.java │ │ │ ├── EnableTeamMemberCommand.java │ │ │ ├── EnableProductOwnerCommand.java │ │ │ ├── ChangeTeamMemberNameCommand.java │ │ │ └── EnableMemberCommand.java │ ├── team │ │ └── command │ │ │ ├── ProvisionTeamCommand.java │ │ │ ├── AssignTeamMemberCommand.java │ │ │ ├── RemoveTeamMemberCommand.java │ │ │ └── AssignProductOwnerCommand.java │ ├── product │ │ └── command │ │ │ ├── RequestProductDiscussionCommand.java │ │ │ ├── StartDiscussionInitiationCommand.java │ │ │ ├── RetryProductDiscussionRequestCommand.java │ │ │ ├── InitiateDiscussionCommand.java │ │ │ ├── NewProductCommand.java │ │ │ ├── TimeOutProductDiscussionRequestCommand.java │ │ │ ├── ScheduleSprintCommand.java │ │ │ ├── ScheduleReleaseCommand.java │ │ │ └── PlanBacklogItemCommand.java │ ├── backlogitem │ │ └── command │ │ │ ├── CommitToSprintCommand.java │ │ │ └── ScheduleForReleaseCommand.java │ ├── sprint │ │ └── command │ │ │ └── CommitBacklogItemToSprintCommand.java │ └── release │ │ ├── command │ │ └── ScheduleBacklogItemForReleaseCommand.java │ │ └── ReleaseApplicationService.java │ ├── domain │ ├── team │ │ ├── member │ │ │ ├── TeamMemberId.java │ │ │ ├── TeamMemberRepo.java │ │ │ ├── ProductOwnerRepository.java │ │ │ ├── ProductOwnerId.java │ │ │ ├── ProductOwner.java │ │ │ └── TeamMember.java │ │ └── TeamRepo.java │ ├── product │ │ ├── ProductId.java │ │ ├── discussion │ │ │ └── ProductDiscussionRequestTimedOut.java │ │ ├── sprint │ │ │ └── SprintRepository.java │ │ ├── release │ │ │ └── ReleaseRepository.java │ │ ├── ProductRepository.java │ │ └── blacklogitem │ │ │ ├── task │ │ │ └── TaskStatus.java │ │ │ ├── BacklogItemType.java │ │ │ ├── StoryPoints.java │ │ │ ├── BacklogItemRepository.java │ │ │ └── event │ │ │ ├── BacklogItemMarkedAsRemoved.java │ │ │ ├── BacklogItemStoryTold.java │ │ │ └── BacklogItemSummarized.java │ └── discussion │ │ ├── DiscussionAvailability.java │ │ └── DiscussionDescriptor.java │ ├── port │ └── message │ │ ├── listener │ │ ├── DiscussionStartedListener.java │ │ ├── ProductDiscussionRequestedListener.java │ │ ├── ProductDiscussionRetryListener.java │ │ ├── ProductBacklogItemPlannedListener.java │ │ ├── BacklogItemCommittedListener.java │ │ ├── TeamMemberNameChangedListener.java │ │ ├── BacklogItemScheduledListener.java │ │ ├── TeamMemberEmailAddressChangedListener.java │ │ ├── TeamMemberDisableListener.java │ │ ├── TeamMemberEnablerListener.java │ │ └── ListeningChannels.java │ │ └── dto │ │ ├── PersonNameChanged.java │ │ ├── UserUnassignedFromRole.java │ │ ├── UserAssignedToRole.java │ │ └── PersonContactInformationChanged.java │ └── api │ ├── SprintApi.java │ └── ReleaseApi.java ├── pom.xml └── README.md /doc/DDD-design.md: -------------------------------------------------------------------------------- 1 | # DDD实现领域驱动设计解读 2 | 3 | -------------------------------------------------------------------------------- /doc/images/forum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyyawn/zhacker-sample-ovation/HEAD/doc/images/forum.png -------------------------------------------------------------------------------- /doc/images/group.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyyawn/zhacker-sample-ovation/HEAD/doc/images/group.png -------------------------------------------------------------------------------- /doc/images/post.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyyawn/zhacker-sample-ovation/HEAD/doc/images/post.png -------------------------------------------------------------------------------- /doc/images/role.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyyawn/zhacker-sample-ovation/HEAD/doc/images/role.png -------------------------------------------------------------------------------- /doc/images/team.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyyawn/zhacker-sample-ovation/HEAD/doc/images/team.png -------------------------------------------------------------------------------- /doc/images/backlog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyyawn/zhacker-sample-ovation/HEAD/doc/images/backlog.png -------------------------------------------------------------------------------- /doc/images/member.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyyawn/zhacker-sample-ovation/HEAD/doc/images/member.png -------------------------------------------------------------------------------- /doc/images/product.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyyawn/zhacker-sample-ovation/HEAD/doc/images/product.png -------------------------------------------------------------------------------- /doc/images/tenant.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyyawn/zhacker-sample-ovation/HEAD/doc/images/tenant.png -------------------------------------------------------------------------------- /doc/images/discussion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyyawn/zhacker-sample-ovation/HEAD/doc/images/discussion.png -------------------------------------------------------------------------------- /doc/images/identity-uml.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyyawn/zhacker-sample-ovation/HEAD/doc/images/identity-uml.png -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: collaboration 4 | -------------------------------------------------------------------------------- /doc/images/collaboration-uml.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fancyyawn/zhacker-sample-ovation/HEAD/doc/images/collaboration-uml.png -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: identity-access 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | .settings/ 3 | .project 4 | .classpath 5 | *iml 6 | .idea 7 | node_modules 8 | .springBean 9 | build/ 10 | /agile/ 11 | /log/ 12 | node_modules/ 13 | *.log 14 | *.jar -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: agile 4 | 5 | server: 6 | port: 8083 7 | 8 | leveldb.path: /tmp/agiledb 9 | 10 | swagger.basePackage: top.zhacker.ddd.agilepm.api -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/domain/user/EncryptionService.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.domain.user; 2 | 3 | public interface EncryptionService { 4 | 5 | String encryptedValue(String aPlainTextValue); 6 | } -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/application/ApplicationConifg.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.application; 2 | 3 | /** 4 | * Created by zhacker. 5 | * Time 2018/6/18 下午3:39 6 | */ 7 | public class ApplicationConifg { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/port/client/Systems.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.collaboration.port.client; 2 | 3 | /** 4 | * Created by zhacker. 5 | * Time 2018/7/14 上午8:07 6 | */ 7 | public class Systems { 8 | public static final String Identity = "identity-access"; 9 | } 10 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/application/member/command/DisableTeamMemberCommand.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.application.member.command; 2 | 3 | /** 4 | * Created by zhacker. 5 | * Time 2018/6/18 下午3:46 6 | */ 7 | public class DisableTeamMemberCommand extends DisableMemberCommand { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/application/vo/ForumCommandResult.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.collaboration.application.vo; 2 | 3 | public interface ForumCommandResult { 4 | 5 | public void resultingForumId(String aForumId); 6 | 7 | public void resultingDiscussionId(String aDiscussionId); 8 | } 9 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/application/member/command/DisableProductOwnerCommand.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.application.member.command; 2 | 3 | /** 4 | * Created by zhacker. 5 | * Time 2018/6/18 下午3:45 6 | */ 7 | public class DisableProductOwnerCommand extends DisableMemberCommand { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/domain/tenant/TenantId.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.domain.tenant; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | 6 | 7 | /** 8 | * Created by zhacker. 9 | * Time 2018/6/11 下午7:04 10 | */ 11 | @Data 12 | @AllArgsConstructor 13 | public class TenantId{ 14 | 15 | private String id; 16 | 17 | protected TenantId() { 18 | super(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/application/team/command/ProvisionTeamCommand.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.application.team.command; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | 7 | /** 8 | * Created by zhacker. 9 | * Time 2018/6/20 下午9:05 10 | */ 11 | @Data 12 | @Accessors(chain = true) 13 | public class ProvisionTeamCommand { 14 | private String tenantId; 15 | private String name; 16 | } 17 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/domain/tenant/TenantRepo.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.domain.tenant; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Created by zhacker. 7 | * Time 2018/6/11 下午7:04 8 | */ 9 | public interface TenantRepo { 10 | 11 | void add(Tenant tenant); 12 | 13 | Tenant findByTenantId(TenantId tenantId); 14 | 15 | TenantId nextIdentity(); 16 | 17 | List findAll(); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/application/command/ForumChangeSubjectCommand.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.collaboration.application.command; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | 7 | /** 8 | * Created by zhacker. 9 | * Time 2018/7/14 下午6:00 10 | */ 11 | @Data 12 | @Accessors(chain = true) 13 | public class ForumChangeSubjectCommand { 14 | String tenantId; 15 | String forumId; 16 | String subject; 17 | } 18 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/application/product/command/RequestProductDiscussionCommand.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.application.product.command; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | 7 | /** 8 | * Created by zhacker. 9 | * Time 2018/6/18 下午4:02 10 | */ 11 | @Data 12 | @Accessors(chain = true) 13 | public class RequestProductDiscussionCommand { 14 | private String tenantId; 15 | private String productId; 16 | } 17 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/application/product/command/StartDiscussionInitiationCommand.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.application.product.command; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | 7 | /** 8 | * Created by zhacker. 9 | * Time 2018/6/18 下午4:03 10 | */ 11 | @Data 12 | @Accessors(chain = true) 13 | public class StartDiscussionInitiationCommand { 14 | private String tenantId; 15 | private String productId; 16 | } 17 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/application/command/ForumAssignModeratorCommand.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.collaboration.application.command; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | 7 | /** 8 | * Created by zhacker. 9 | * Time 2018/7/14 下午6:03 10 | */ 11 | @Data 12 | @Accessors(chain = true) 13 | public class ForumAssignModeratorCommand { 14 | String tenantId; 15 | String forumId; 16 | String moderatorId; 17 | } 18 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/application/command/OfferRegistrationInvitationCommand.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.application.command; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | 7 | /** 8 | * Created by zhacker. 9 | * Time 2018/7/15 下午10:26 10 | */ 11 | @Data 12 | @Accessors(chain = true) 13 | public class OfferRegistrationInvitationCommand { 14 | private String tenantId; 15 | private String description; 16 | } 17 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/application/product/command/RetryProductDiscussionRequestCommand.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.application.product.command; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | 7 | /** 8 | * Created by zhacker. 9 | * Time 2018/6/18 下午4:04 10 | */ 11 | @Data 12 | @Accessors(chain = true) 13 | public class RetryProductDiscussionRequestCommand { 14 | private String tenantId; 15 | private String processId; 16 | } 17 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/application/team/command/AssignTeamMemberCommand.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.application.team.command; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | 7 | /** 8 | * Created by zhacker. 9 | * Time 2018/7/7 下午6:52 10 | */ 11 | @Data 12 | @Accessors(chain = true) 13 | public class AssignTeamMemberCommand { 14 | private String tenantId; 15 | private String teamName; 16 | private String username; 17 | } 18 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/application/team/command/RemoveTeamMemberCommand.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.application.team.command; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | 7 | /** 8 | * Created by zhacker. 9 | * Time 2018/7/7 下午6:52 10 | */ 11 | @Data 12 | @Accessors(chain = true) 13 | public class RemoveTeamMemberCommand { 14 | private String tenantId; 15 | private String teamName; 16 | private String username; 17 | } 18 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/application/command/ForumChangeDescriptionCommand.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.collaboration.application.command; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | 7 | /** 8 | * Created by zhacker. 9 | * Time 2018/7/14 下午5:58 10 | */ 11 | @Data 12 | @Accessors(chain = true) 13 | public class ForumChangeDescriptionCommand { 14 | String tenantId; 15 | String forumId; 16 | String description; 17 | } 18 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/IdentityApp.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | 7 | /** 8 | * Created by zhacker. 9 | * Time 2018/6/13 上午9:59 10 | */ 11 | @SpringBootApplication 12 | public class IdentityApp{ 13 | public static void main(String[] args){ 14 | SpringApplication.run(IdentityApp.class, args); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/application/team/command/AssignProductOwnerCommand.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.application.team.command; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | 7 | /** 8 | * Created by zhacker. 9 | * Time 2018/7/7 下午6:52 10 | */ 11 | @Data 12 | @Accessors(chain = true) 13 | public class AssignProductOwnerCommand { 14 | private String tenantId; 15 | private String teamName; 16 | private String username; 17 | } 18 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/application/backlogitem/command/CommitToSprintCommand.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.application.backlogitem.command; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | 7 | /** 8 | * Created by zhacker. 9 | * Time 2018/7/15 下午1:15 10 | */ 11 | @Data 12 | @Accessors(chain = true) 13 | public class CommitToSprintCommand { 14 | private String tenantId; 15 | private String sprintId; 16 | private String backlogItemId; 17 | } 18 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/application/product/command/InitiateDiscussionCommand.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.application.product.command; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | 7 | /** 8 | * Created by zhacker. 9 | * Time 2018/6/18 下午4:01 10 | */ 11 | @Data 12 | @Accessors(chain = true) 13 | public class InitiateDiscussionCommand { 14 | private String tenantId; 15 | private String productId; 16 | private String discussionId; 17 | } 18 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/application/backlogitem/command/ScheduleForReleaseCommand.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.application.backlogitem.command; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | 7 | /** 8 | * Created by zhacker. 9 | * Time 2018/7/15 下午2:56 10 | */ 11 | @Data 12 | @Accessors(chain = true) 13 | public class ScheduleForReleaseCommand { 14 | private String tenantId; 15 | private String releaseId; 16 | private String backlogItemId; 17 | } 18 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/application/sprint/command/CommitBacklogItemToSprintCommand.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.application.sprint.command; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | 7 | /** 8 | * Created by zhacker. 9 | * Time 2018/6/18 下午9:40 10 | */ 11 | @Data 12 | @Accessors(chain = true) 13 | public class CommitBacklogItemToSprintCommand { 14 | private String backlogItemId; 15 | private String sprintId; 16 | private String tenantId; 17 | } 18 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/application/command/ForumStartCommand.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.collaboration.application.command; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | 7 | /** 8 | * Created by zhacker. 9 | * Time 2018/7/8 下午3:54 10 | */ 11 | @Data 12 | @Accessors(chain = true) 13 | public class ForumStartCommand { 14 | String tenantId; 15 | String creatorId; 16 | String moderatorId; 17 | String subject; 18 | String description; 19 | } 20 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/application/member/command/DisableMemberCommand.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.application.member.command; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | import java.util.Date; 7 | 8 | 9 | /** 10 | * Created by zhacker. 11 | * Time 2018/6/18 下午3:45 12 | */ 13 | @Data 14 | @Accessors(chain = true) 15 | public class DisableMemberCommand { 16 | private String tenantId; 17 | private String username; 18 | private Date occurredOn; 19 | } 20 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/application/product/command/NewProductCommand.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.application.product.command; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | 7 | /** 8 | * Created by zhacker. 9 | * Time 2018/6/18 下午4:00 10 | */ 11 | @Data 12 | @Accessors(chain = true) 13 | public class NewProductCommand { 14 | private String tenantId; 15 | private String productOwnerId; 16 | private String name; 17 | private String description; 18 | } 19 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/application/command/DiscussionStartCommand.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.collaboration.application.command; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | 7 | /** 8 | * Created by zhacker. 9 | * Time 2018/7/14 下午7:00 10 | */ 11 | @Data 12 | @Accessors(chain = true) 13 | public class DiscussionStartCommand { 14 | private String tenantId; 15 | private String forumId; 16 | private String authorId; 17 | private String subject; 18 | } 19 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/application/release/command/ScheduleBacklogItemForReleaseCommand.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.application.release.command; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | 7 | /** 8 | * Created by zhacker. 9 | * Time 2018/7/15 下午3:05 10 | */ 11 | @Data 12 | @Accessors(chain = true) 13 | public class ScheduleBacklogItemForReleaseCommand { 14 | private String backlogItemId; 15 | private String releaseId; 16 | private String tenantId; 17 | } 18 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/application/command/PostCreateCommand.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.collaboration.application.command; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | 7 | /** 8 | * Created by zhacker. 9 | * Time 2018/7/14 下午4:34 10 | */ 11 | @Data 12 | @Accessors(chain = true) 13 | public class PostCreateCommand { 14 | String tenantId; 15 | String discussionId; 16 | String replyToPostId; 17 | String authorId; 18 | String subject; 19 | String bodyText; 20 | } 21 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/port/message/DiscussionChannel.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.collaboration.port.message; 2 | 3 | import org.springframework.cloud.stream.annotation.Input; 4 | import org.springframework.messaging.SubscribableChannel; 5 | 6 | 7 | /** 8 | * Created by zhacker. 9 | * Time 2018/7/15 上午10:24 10 | */ 11 | public interface DiscussionChannel { 12 | 13 | String DiscussionCreateRequest = ""; 14 | 15 | @Input(DiscussionCreateRequest) 16 | SubscribableChannel discussionCreateRequest(); 17 | } 18 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/domain/group/GroupRepo.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.domain.group; 2 | 3 | import java.util.Collection; 4 | 5 | import top.zhacker.ddd.identity.domain.tenant.TenantId; 6 | 7 | 8 | /** 9 | * Created by zhacker. 10 | * Time 2018/6/30 下午1:45 11 | */ 12 | public interface GroupRepo { 13 | 14 | void add(Group group); 15 | 16 | Collection allGroups(TenantId tenantId); 17 | 18 | Group groupNamed(TenantId tenantId, String name); 19 | 20 | void remove(Group group); 21 | } 22 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/domain/role/RoleRepo.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.domain.role; 2 | 3 | import java.util.Collection; 4 | 5 | import top.zhacker.ddd.identity.domain.tenant.TenantId; 6 | 7 | 8 | /** 9 | * Created by zhacker. 10 | * Time 2018/6/13 上午11:28 11 | */ 12 | public interface RoleRepo { 13 | 14 | void add(Role role); 15 | 16 | Collection allRoles(TenantId tenantId); 17 | 18 | void remove(Role role); 19 | 20 | Role roleNamed(TenantId tenantId, String roleName); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/domain/group/GroupMemberType.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.domain.group; 2 | 3 | public enum GroupMemberType { 4 | 5 | Group { 6 | public boolean isGroup() { 7 | return true; 8 | } 9 | }, 10 | 11 | User { 12 | public boolean isUser() { 13 | return true; 14 | } 15 | }; 16 | 17 | public boolean isGroup() { 18 | return false; 19 | } 20 | 21 | public boolean isUser() { 22 | return false; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/application/product/command/TimeOutProductDiscussionRequestCommand.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.application.product.command; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | import java.util.Date; 7 | 8 | 9 | /** 10 | * Created by zhacker. 11 | * Time 2018/6/18 下午4:04 12 | */ 13 | @Data 14 | @Accessors(chain = true) 15 | public class TimeOutProductDiscussionRequestCommand { 16 | private String tenantId; 17 | private String processId; 18 | private Date timedOutDate; 19 | } 20 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/domain/group/event/GroupProvisioned.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.domain.group.event; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | import top.zhacker.core.model.BaseDomainEvent; 6 | import top.zhacker.ddd.identity.domain.tenant.TenantId; 7 | 8 | 9 | /** 10 | * Created by zhacker. 11 | * Time 2018/6/30 下午9:03 12 | */ 13 | @Getter 14 | @AllArgsConstructor 15 | public class GroupProvisioned extends BaseDomainEvent { 16 | private TenantId tenantId; 17 | private String name; 18 | } 19 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/application/product/command/ScheduleSprintCommand.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.application.product.command; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | import java.util.Date; 7 | 8 | 9 | /** 10 | * Created by zhacker. 11 | * Time 2018/7/15 下午12:27 12 | */ 13 | @Data 14 | @Accessors(chain = true) 15 | public class ScheduleSprintCommand { 16 | private String tenantId; 17 | private String productId; 18 | String name; 19 | String goals; 20 | Date begins; 21 | Date ends; 22 | } 23 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8082 3 | spring: 4 | application: 5 | name: collaboration 6 | profiles: 7 | active: local 8 | sleuth: 9 | sampler: 10 | percentage: 1.0 11 | kafka: 12 | bootstrap-servers: localhost:9092 13 | 14 | swagger.basePackage: top.zhacker.ddd.collaboration.api 15 | 16 | spring.datasource.url: jdbc:mysql://127.0.0.1:3306/iddd_collaboration?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowMultiQueries=true 17 | spring.datasource.username: root 18 | spring.datasource.password: anywhere 19 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/application/product/command/ScheduleReleaseCommand.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.application.product.command; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | import java.util.Date; 7 | 8 | 9 | /** 10 | * Created by zhacker. 11 | * Time 2018/7/15 下午12:25 12 | */ 13 | @Data 14 | @Accessors(chain = true) 15 | public class ScheduleReleaseCommand { 16 | private String tenantId; 17 | private String productId; 18 | String name; 19 | String description; 20 | Date begins; 21 | Date ends; 22 | } 23 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/application/member/command/ChangeTeamMemberEmailAddressCommand.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.application.member.command; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | import java.util.Date; 7 | 8 | 9 | /** 10 | * Created by zhacker. 11 | * Time 2018/6/18 下午3:47 12 | */ 13 | @Data 14 | @Accessors(chain = true) 15 | public class ChangeTeamMemberEmailAddressCommand { 16 | private String tenantId; 17 | private String username; 18 | private String emailAddress; 19 | private Date occurredOn; 20 | } 21 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/application/command/PostModerateCommand.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.collaboration.application.command; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | import java.io.Serializable; 7 | 8 | 9 | /** 10 | * Created by zhacker. 11 | * Time 2018/7/14 下午4:20 12 | */ 13 | @Data 14 | @Accessors(chain = true) 15 | public class PostModerateCommand implements Serializable { 16 | String tenantId; 17 | String forumId; 18 | String postId; 19 | String moderatorId; 20 | String subject; 21 | String bodyText; 22 | } 23 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/domain/team/member/TeamMemberId.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.domain.team.member; 2 | 3 | import lombok.Getter; 4 | import top.zhacker.core.model.ValueObject; 5 | import top.zhacker.ddd.agilepm.domain.tenant.TenantId; 6 | 7 | 8 | /** 9 | * Created by zhacker. 10 | * Time 2018/6/18 下午10:17 11 | */ 12 | @Getter 13 | public class TeamMemberId extends ValueObject { 14 | 15 | private TenantId tenantId; 16 | private String id; 17 | 18 | 19 | public TeamMemberId(TenantId tenantId, String id) { 20 | this.tenantId = tenantId; 21 | this.id = id; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/domain/role/RoleSimple.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.domain.role; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | import top.zhacker.ddd.identity.domain.group.Group; 6 | import top.zhacker.ddd.identity.domain.tenant.TenantId; 7 | 8 | 9 | /** 10 | * Created by zhacker. 11 | * Time 2018/7/7 下午9:09 12 | */ 13 | @Data 14 | @Accessors(chain = true) 15 | public class RoleSimple { 16 | private TenantId tenantId; 17 | private String name; 18 | private String description; 19 | private boolean supportsNesting = true; 20 | private Group group; 21 | } 22 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/application/member/command/EnableTeamMemberCommand.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.application.member.command; 2 | 3 | import java.util.Date; 4 | 5 | 6 | /** 7 | * Created by zhacker. 8 | * Time 2018/6/18 下午3:44 9 | */ 10 | public class EnableTeamMemberCommand extends EnableMemberCommand { 11 | 12 | public EnableTeamMemberCommand(String tenantId, String username, String firstName, String lastName, String emailAddress, Date occurredOn) { 13 | super(tenantId, username, firstName, lastName, emailAddress, occurredOn); 14 | } 15 | 16 | public EnableTeamMemberCommand() { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/application/member/command/EnableProductOwnerCommand.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.application.member.command; 2 | 3 | import java.util.Date; 4 | 5 | 6 | /** 7 | * Created by zhacker. 8 | * Time 2018/6/18 下午3:44 9 | */ 10 | public class EnableProductOwnerCommand extends EnableMemberCommand { 11 | 12 | public EnableProductOwnerCommand(String tenantId, String username, String firstName, String lastName, String emailAddress, Date occurredOn) { 13 | super(tenantId, username, firstName, lastName, emailAddress, occurredOn); 14 | } 15 | 16 | public EnableProductOwnerCommand() { 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/domain/team/TeamRepo.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.domain.team; 2 | 3 | import top.zhacker.ddd.agilepm.domain.tenant.TenantId; 4 | 5 | import java.util.Collection; 6 | 7 | 8 | /** 9 | * Created by zhacker. 10 | * Time 2018/6/18 下午10:18 11 | */ 12 | public interface TeamRepo { 13 | 14 | void save(Team aTeam); 15 | 16 | void saveAll(Collection aTeamCollection); 17 | 18 | void remove(Team aTeam); 19 | 20 | void removeAll(Collection aTeamCollection); 21 | 22 | Collection allTeamsOfTenant(TenantId aTenantId); 23 | 24 | Team teamNamed(TenantId aTenantId, String aName); 25 | } 26 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/port/message/listener/DiscussionStartedListener.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.port.message.listener; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Component; 5 | import top.zhacker.ddd.agilepm.application.product.ProductApplicationService; 6 | 7 | 8 | /** 9 | * Created by zhacker. 10 | * Time 2018/6/18 下午9:09 11 | */ 12 | @Component 13 | public class DiscussionStartedListener { 14 | 15 | @Autowired 16 | private ProductApplicationService productApplicationService; 17 | 18 | public void process(){ 19 | productApplicationService.initiateDiscussion(null); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/domain/user/event/UserPasswordChanged.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.domain.user.event; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.Getter; 6 | import lombok.ToString; 7 | import top.zhacker.core.model.BaseDomainEvent; 8 | import top.zhacker.ddd.identity.domain.tenant.TenantId; 9 | 10 | 11 | /** 12 | * Created by zhacker. 13 | * Time 2018/6/30 下午9:12 14 | */ 15 | @Getter 16 | @AllArgsConstructor 17 | @ToString 18 | @EqualsAndHashCode(callSuper = true) 19 | public class UserPasswordChanged extends BaseDomainEvent { 20 | private TenantId tenantId; 21 | private String username; 22 | } 23 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/domain/role/event/RoleProvisioned.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.domain.role.event; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.Getter; 6 | import lombok.ToString; 7 | import top.zhacker.core.model.BaseDomainEvent; 8 | import top.zhacker.ddd.identity.domain.tenant.TenantId; 9 | 10 | 11 | /** 12 | * Created by zhacker. 13 | * Time 2018/6/30 下午5:43 14 | */ 15 | @AllArgsConstructor 16 | @Getter 17 | @EqualsAndHashCode(callSuper = true) 18 | @ToString(callSuper = true) 19 | public class RoleProvisioned extends BaseDomainEvent { 20 | private TenantId tenantId; 21 | private String name; 22 | } 23 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/application/member/command/ChangeTeamMemberNameCommand.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.application.member.command; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | import lombok.experimental.Accessors; 7 | 8 | import java.util.Date; 9 | 10 | 11 | /** 12 | * Created by zhacker. 13 | * Time 2018/6/18 下午3:47 14 | */ 15 | @Data 16 | @Accessors(chain = true) 17 | @AllArgsConstructor 18 | @NoArgsConstructor 19 | public class ChangeTeamMemberNameCommand { 20 | private String tenantId; 21 | private String username; 22 | private String firstName; 23 | private String lastName; 24 | private Date occurredOn; 25 | } 26 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/application/product/command/PlanBacklogItemCommand.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.application.product.command; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | import top.zhacker.ddd.agilepm.domain.product.blacklogitem.BacklogItemType; 6 | import top.zhacker.ddd.agilepm.domain.product.blacklogitem.StoryPoints; 7 | 8 | 9 | /** 10 | * Created by zhacker. 11 | * Time 2018/7/15 下午12:25 12 | */ 13 | @Data 14 | @Accessors(chain = true) 15 | public class PlanBacklogItemCommand { 16 | private String tenantId; 17 | private String productId; 18 | String summary; 19 | String category; 20 | BacklogItemType type; 21 | StoryPoints storyPoints; 22 | } 23 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/api/ConfigApi.java: -------------------------------------------------------------------------------- 1 | /* 2 | package top.zhacker.ddd.identity.api; 3 | 4 | import com.ctrip.framework.apollo.Config; 5 | import com.ctrip.framework.apollo.spring.annotation.ApolloConfig; 6 | 7 | import org.springframework.web.bind.annotation.GetMapping; 8 | import org.springframework.web.bind.annotation.RestController; 9 | 10 | 11 | */ 12 | /** 13 | * Created by zhacker. 14 | * Time 2018/8/2 下午8:02 15 | *//* 16 | 17 | @RestController 18 | public class ConfigApi { 19 | 20 | // @ApolloConfig 21 | private Config config; 22 | 23 | @GetMapping("/v1/apollo") 24 | public String findConfig(String key){ 25 | return config.getProperty(key, key); 26 | } 27 | } 28 | */ 29 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/infra/mapper/RoleMapper.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.infra.mapper; 2 | 3 | import org.apache.ibatis.annotations.Mapper; 4 | import org.apache.ibatis.annotations.Result; 5 | import org.apache.ibatis.annotations.Results; 6 | import org.apache.ibatis.annotations.Select; 7 | 8 | import java.util.List; 9 | 10 | import top.zhacker.ddd.identity.domain.role.Role; 11 | 12 | 13 | /** 14 | * Created by zhacker. 15 | * Time 2018/7/29 上午10:14 16 | */ 17 | @Mapper 18 | public interface RoleMapper { 19 | 20 | @Results({ 21 | @Result(column = "tenant_id_id", property = "tenantId.id") 22 | }) 23 | @Select("select * from tbl_role") 24 | List findAll(); 25 | } 26 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/port/message/dto/PersonNameChanged.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.port.message.dto; 2 | 3 | import lombok.*; 4 | import top.zhacker.core.model.BaseDomainEvent; 5 | import top.zhacker.ddd.agilepm.domain.tenant.TenantId; 6 | 7 | 8 | /** 9 | * Created by zhacker. 10 | * Time 2018/6/30 下午9:58 11 | */ 12 | @Getter 13 | @AllArgsConstructor 14 | @ToString 15 | @EqualsAndHashCode(callSuper = true) 16 | public class PersonNameChanged extends BaseDomainEvent { 17 | private TenantId tenantId; 18 | private String username; 19 | private FullName name; 20 | 21 | @Data 22 | public static class FullName { 23 | private String firstName; 24 | private String lastName; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/port/message/listener/ProductDiscussionRequestedListener.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.port.message.listener; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Component; 5 | import top.zhacker.ddd.agilepm.application.product.ProductApplicationService; 6 | 7 | 8 | /** 9 | * step1 10 | * 11 | * Created by zhacker. 12 | * Time 2018/6/18 下午9:11 13 | */ 14 | @Component 15 | public class ProductDiscussionRequestedListener { 16 | 17 | @Autowired 18 | private ProductApplicationService productApplicationService; 19 | 20 | public void process(){ 21 | productApplicationService.startDiscussionInitiation(null); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/domain/group/event/GroupUserAdded.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.domain.group.event; 2 | 3 | import lombok.Getter; 4 | import top.zhacker.core.model.BaseDomainEvent; 5 | import top.zhacker.ddd.identity.domain.tenant.TenantId; 6 | 7 | 8 | /** 9 | * Created by zhacker. 10 | * Time 2018/6/30 下午5:22 11 | */ 12 | @Getter 13 | public class GroupUserAdded extends BaseDomainEvent { 14 | 15 | private TenantId tenantId; 16 | private String groupName; 17 | private String username; 18 | 19 | public GroupUserAdded(TenantId tenantId, String groupName, String username) { 20 | this.tenantId = tenantId; 21 | this.groupName = groupName; 22 | this.username = username; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/application/member/command/EnableMemberCommand.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.application.member.command; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | import lombok.experimental.Accessors; 7 | 8 | import java.util.Date; 9 | 10 | 11 | /** 12 | * Created by zhacker. 13 | * Time 2018/6/18 下午3:43 14 | */ 15 | @Data 16 | @Accessors(chain = true) 17 | @AllArgsConstructor 18 | @NoArgsConstructor 19 | public class EnableMemberCommand { 20 | private String tenantId; 21 | private String username; 22 | private String firstName; 23 | private String lastName; 24 | private String emailAddress; 25 | private Date occurredOn; 26 | 27 | 28 | } 29 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/port/message/dto/UserUnassignedFromRole.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.port.message.dto; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.Getter; 6 | import lombok.ToString; 7 | import top.zhacker.core.model.BaseDomainEvent; 8 | import top.zhacker.ddd.agilepm.domain.tenant.TenantId; 9 | 10 | 11 | /** 12 | * Created by zhacker. 13 | * Time 2018/6/30 下午5:38 14 | */ 15 | @Getter 16 | @AllArgsConstructor 17 | @ToString(callSuper = true) 18 | @EqualsAndHashCode(callSuper = true) 19 | public class UserUnassignedFromRole extends BaseDomainEvent { 20 | 21 | private TenantId tenantId; 22 | private String roleName; 23 | private String username; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/domain/group/event/GroupUserRemoved.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.domain.group.event; 2 | 3 | import lombok.Getter; 4 | import top.zhacker.core.model.BaseDomainEvent; 5 | import top.zhacker.ddd.identity.domain.tenant.TenantId; 6 | 7 | 8 | /** 9 | * Created by zhacker. 10 | * Time 2018/6/30 下午5:23 11 | */ 12 | @Getter 13 | public class GroupUserRemoved extends BaseDomainEvent { 14 | 15 | private TenantId tenantId; 16 | private String groupName; 17 | private String username; 18 | 19 | public GroupUserRemoved(TenantId tenantId, String groupName, String username) { 20 | this.tenantId = tenantId; 21 | this.groupName = groupName; 22 | this.username = username; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/infra/repo/impl/SpringDataUserRepo.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.infra.repo.impl; 2 | 3 | import org.springframework.data.repository.CrudRepository; 4 | import org.springframework.stereotype.Repository; 5 | 6 | import top.zhacker.ddd.identity.domain.tenant.TenantId; 7 | import top.zhacker.ddd.identity.domain.user.User; 8 | 9 | 10 | /** 11 | * Created by zhacker. 12 | * Time 2018/7/1 上午11:00 13 | */ 14 | @Repository 15 | public interface SpringDataUserRepo extends CrudRepository { 16 | 17 | User findByTenantIdAndUsername(TenantId tenantId, String username); 18 | 19 | User findByTenantIdAndUsernameAndPassword(TenantId tenantId, String username, String password); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/domain/role/event/GroupUnassignedFromRole.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.domain.role.event; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.Getter; 6 | import lombok.ToString; 7 | import top.zhacker.core.model.BaseDomainEvent; 8 | import top.zhacker.ddd.identity.domain.tenant.TenantId; 9 | 10 | 11 | /** 12 | * Created by zhacker. 13 | * Time 2018/6/30 下午5:38 14 | */ 15 | @AllArgsConstructor 16 | @Getter 17 | @EqualsAndHashCode(callSuper = true) 18 | @ToString(callSuper = true) 19 | public class GroupUnassignedFromRole extends BaseDomainEvent { 20 | private TenantId tenantId; 21 | private String roleName; 22 | private String groupName; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/domain/role/event/UserUnassignedFromRole.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.domain.role.event; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.Getter; 6 | import lombok.ToString; 7 | import top.zhacker.core.model.BaseDomainEvent; 8 | import top.zhacker.ddd.identity.domain.tenant.TenantId; 9 | 10 | 11 | /** 12 | * Created by zhacker. 13 | * Time 2018/6/30 下午5:38 14 | */ 15 | @Getter 16 | @AllArgsConstructor 17 | @ToString(callSuper = true) 18 | @EqualsAndHashCode(callSuper = true) 19 | public class UserUnassignedFromRole extends BaseDomainEvent { 20 | 21 | private TenantId tenantId; 22 | private String roleName; 23 | private String username; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/domain/group/event/GroupGroupAdded.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.domain.group.event; 2 | 3 | import lombok.Getter; 4 | import top.zhacker.core.model.BaseDomainEvent; 5 | import top.zhacker.ddd.identity.domain.tenant.TenantId; 6 | 7 | 8 | /** 9 | * Created by zhacker. 10 | * Time 2018/6/30 下午5:06 11 | */ 12 | @Getter 13 | public class GroupGroupAdded extends BaseDomainEvent { 14 | 15 | private TenantId tenantId; 16 | private String groupName; 17 | private String nestedGroupName; 18 | 19 | public GroupGroupAdded(TenantId tenantId, String groupName, String nestedGroupName) { 20 | this.tenantId = tenantId; 21 | this.groupName = groupName; 22 | this.nestedGroupName = nestedGroupName; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/domain/tenant/event/TenantProvisioned.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.domain.tenant.event; 2 | 3 | import java.util.Date; 4 | 5 | import lombok.Getter; 6 | import top.zhacker.core.model.DomainEvent; 7 | import top.zhacker.ddd.identity.domain.tenant.TenantId; 8 | 9 | 10 | /** 11 | * Created by zhacker. 12 | * Time 2018/6/12 下午1:38 13 | */ 14 | @Getter 15 | public class TenantProvisioned implements DomainEvent { 16 | 17 | private int eventVersion; 18 | private Date occurredOn; 19 | private TenantId tenantId; 20 | 21 | public TenantProvisioned(TenantId aTenantId) { 22 | super(); 23 | 24 | this.eventVersion = 1; 25 | this.occurredOn = new Date(); 26 | this.tenantId = aTenantId; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/port/message/listener/ProductDiscussionRetryListener.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.port.message.listener; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Component; 5 | import top.zhacker.ddd.agilepm.application.product.ProductApplicationService; 6 | 7 | 8 | /** 9 | * Created by zhacker. 10 | * Time 2018/6/18 下午9:13 11 | */ 12 | @Component 13 | public class ProductDiscussionRetryListener { 14 | 15 | @Autowired 16 | private ProductApplicationService productApplicationService; 17 | 18 | public void process(){ 19 | productApplicationService.timeOutProductDiscussionRequest(null); 20 | productApplicationService.retryProductDiscussionRequest(null); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/domain/group/event/GroupGroupRemoved.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.domain.group.event; 2 | 3 | import lombok.Getter; 4 | import top.zhacker.core.model.BaseDomainEvent; 5 | import top.zhacker.ddd.identity.domain.tenant.TenantId; 6 | 7 | 8 | /** 9 | * Created by zhacker. 10 | * Time 2018/6/30 下午5:12 11 | */ 12 | @Getter 13 | public class GroupGroupRemoved extends BaseDomainEvent { 14 | 15 | private TenantId tenantId; 16 | private String groupName; 17 | private String nestedGroupName; 18 | 19 | 20 | public GroupGroupRemoved(TenantId tenantId, String groupName, String nestedGroupName) { 21 | this.tenantId = tenantId; 22 | this.groupName = groupName; 23 | this.nestedGroupName = nestedGroupName; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/port/message/ExclusiveDiscussionCreationListener.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.collaboration.port.message; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Component; 5 | import top.zhacker.ddd.collaboration.application.ForumApplicationService; 6 | 7 | 8 | /** 9 | * Created by zhacker. 10 | * Time 2018/7/15 上午10:22 11 | */ 12 | @Component 13 | //@EnableBinding(DiscussionChannel.class) 14 | public class ExclusiveDiscussionCreationListener { 15 | 16 | @Autowired 17 | private ForumApplicationService forumApplicationService; 18 | 19 | // @StreamListener(DiscussionChannel.DiscussionCreateRequest) 20 | public void discussionCreateRequest(){ 21 | 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/domain/user/event/UserEnablementChanged.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.domain.user.event; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.Getter; 6 | import lombok.ToString; 7 | import top.zhacker.core.model.BaseDomainEvent; 8 | import top.zhacker.ddd.identity.domain.tenant.TenantId; 9 | import top.zhacker.ddd.identity.domain.user.Enablement; 10 | 11 | 12 | /** 13 | * Created by zhacker. 14 | * Time 2018/6/30 下午9:13 15 | */ 16 | @Getter 17 | @AllArgsConstructor 18 | @ToString 19 | @EqualsAndHashCode(callSuper = true) 20 | public class UserEnablementChanged extends BaseDomainEvent { 21 | private TenantId tenantId; 22 | private String username; 23 | private Enablement enablement; 24 | } 25 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/domain/role/event/GroupAssignedToRole.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.domain.role.event; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.Getter; 6 | import lombok.ToString; 7 | //import top.zhacker.core.model.BaseDomainEvent; 8 | import top.zhacker.core.model.BaseDomainEvent; 9 | import top.zhacker.ddd.identity.domain.tenant.TenantId; 10 | 11 | 12 | /** 13 | * Created by zhacker. 14 | * Time 2018/6/30 下午5:38 15 | */ 16 | @AllArgsConstructor 17 | @Getter 18 | @EqualsAndHashCode(callSuper = true) 19 | @ToString(callSuper = true) 20 | public class GroupAssignedToRole extends BaseDomainEvent { 21 | private TenantId tenantId; 22 | private String roleName; 23 | private String groupName; 24 | } 25 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/domain/user/person/event/PersonNameChanged.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.domain.user.person.event; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.Getter; 6 | import lombok.ToString; 7 | import top.zhacker.core.model.BaseDomainEvent; 8 | import top.zhacker.ddd.identity.domain.tenant.TenantId; 9 | import top.zhacker.ddd.identity.domain.user.person.FullName; 10 | 11 | 12 | /** 13 | * Created by zhacker. 14 | * Time 2018/6/30 下午9:58 15 | */ 16 | @Getter 17 | @AllArgsConstructor 18 | @ToString 19 | @EqualsAndHashCode(callSuper = true) 20 | public class PersonNameChanged extends BaseDomainEvent { 21 | private TenantId tenantId; 22 | private String username; 23 | private FullName name; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/domain/team/member/TeamMemberRepo.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.domain.team.member; 2 | 3 | import top.zhacker.ddd.agilepm.domain.tenant.TenantId; 4 | 5 | import java.util.Collection; 6 | 7 | 8 | /** 9 | * Created by zhacker. 10 | * Time 2018/6/18 下午10:19 11 | */ 12 | public interface TeamMemberRepo { 13 | 14 | public Collection allTeamMembersOfTenant(TenantId aTenantId); 15 | 16 | public void remove(TeamMember aTeamMember); 17 | 18 | public void removeAll(Collection aTeamMemberCollection); 19 | 20 | public void save(TeamMember aTeamMember); 21 | 22 | public void saveAll(Collection aTeamMemberCollection); 23 | 24 | public TeamMember teamMemberOfIdentity(TenantId aTenantId, String aUsername); 25 | } 26 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | zhacker-boot-parent 7 | top.zhacker 8 | 2.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | zhacker-sample-ovation 13 | pom 14 | 15 | zhacker-sample-ovation-identityaccess 16 | zhacker-sample-ovation-collaboration 17 | zhacker-sample-ovation-agilepm 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/CollaborationApp.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.collaboration; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 6 | import org.springframework.cloud.openfeign.EnableFeignClients; 7 | import org.springframework.context.annotation.EnableAspectJAutoProxy; 8 | 9 | 10 | /** 11 | * Created by zhacker. 12 | * Time 2018/6/13 上午9:59 13 | */ 14 | @EnableFeignClients 15 | @EnableAspectJAutoProxy 16 | @SpringBootApplication 17 | @EnableDiscoveryClient 18 | public class CollaborationApp { 19 | 20 | public static void main(String[] args){ 21 | SpringApplication.run(CollaborationApp.class, args); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/resources/StoredEvent.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/port/client/UserInRoleClient.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.collaboration.port.client; 2 | 3 | import org.springframework.cloud.openfeign.FeignClient; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | import org.springframework.web.bind.annotation.RequestParam; 7 | 8 | 9 | /** 10 | * Created by zhacker. 11 | * Time 2018/7/13 下午11:42 12 | */ 13 | @FeignClient(name = Systems.Identity) 14 | @RequestMapping("/v1/users") 15 | public interface UserInRoleClient { 16 | 17 | @GetMapping("/in-role") 18 | UserVO userInRole( 19 | @RequestParam("tenantId") String tenantId, 20 | @RequestParam("username") String username, 21 | @RequestParam("role") String role); 22 | } 23 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/domain/tenant/event/TenantActivated.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.domain.tenant.event; 2 | 3 | import java.util.Date; 4 | 5 | import lombok.Getter; 6 | //import top.zhacker.core.model.DomainEvent; 7 | import top.zhacker.core.model.DomainEvent; 8 | import top.zhacker.ddd.identity.domain.tenant.TenantId; 9 | 10 | 11 | /** 12 | * Created by zhacker. 13 | * Time 2018/6/11 下午7:05 14 | */ 15 | @Getter 16 | public class TenantActivated implements DomainEvent { 17 | 18 | private int eventVersion; 19 | private Date occurredOn; 20 | private TenantId tenantId; 21 | 22 | public TenantActivated(TenantId aTenantId) { 23 | super(); 24 | 25 | this.eventVersion = 1; 26 | this.occurredOn = new Date(); 27 | this.tenantId = aTenantId; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/port/message/dto/UserAssignedToRole.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.port.message.dto; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.Getter; 6 | import lombok.ToString; 7 | import top.zhacker.core.model.BaseDomainEvent; 8 | import top.zhacker.ddd.agilepm.domain.tenant.TenantId; 9 | 10 | 11 | /** 12 | * Created by zhacker. 13 | * Time 2018/6/30 下午5:37 14 | */ 15 | @Getter 16 | @AllArgsConstructor 17 | @ToString(callSuper = true) 18 | @EqualsAndHashCode(callSuper = true) 19 | public class UserAssignedToRole extends BaseDomainEvent { 20 | private TenantId tenantId; 21 | private String roleName; 22 | private String username; 23 | private String firstName; 24 | private String lastName; 25 | private String emailAddress; 26 | } 27 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/domain/role/event/UserAssignedToRole.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.domain.role.event; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.Getter; 6 | import lombok.ToString; 7 | import top.zhacker.core.model.BaseDomainEvent; 8 | import top.zhacker.ddd.identity.domain.tenant.TenantId; 9 | 10 | 11 | /** 12 | * Created by zhacker. 13 | * Time 2018/6/30 下午5:37 14 | */ 15 | @Getter 16 | @AllArgsConstructor 17 | @ToString(callSuper = true) 18 | @EqualsAndHashCode(callSuper = true) 19 | public class UserAssignedToRole extends BaseDomainEvent { 20 | private TenantId tenantId; 21 | private String roleName; 22 | private String username; 23 | private String firstName; 24 | private String lastName; 25 | private String emailAddress; 26 | } 27 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/domain/team/member/ProductOwnerRepository.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.domain.team.member; 2 | 3 | import top.zhacker.ddd.agilepm.domain.tenant.TenantId; 4 | 5 | import java.util.Collection; 6 | 7 | 8 | /** 9 | * Created by zhacker. 10 | * Time 2018/6/18 下午10:18 11 | */ 12 | public interface ProductOwnerRepository { 13 | 14 | public Collection allProductOwnersOfTenant(TenantId aTenantId); 15 | 16 | public ProductOwner productOwnerOfIdentity(TenantId aTenantId, String aUsername); 17 | 18 | public void remove(ProductOwner aProductOwner); 19 | 20 | public void removeAll(Collection aProductOwnerCollection); 21 | 22 | public void save(ProductOwner aProductOwner); 23 | 24 | public void saveAll(Collection aProductOwnerCollection); 25 | } 26 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/domain/tenant/event/TenantDeactivated.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.domain.tenant.event; 2 | 3 | import java.util.Date; 4 | 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.ToString; 8 | import top.zhacker.core.model.DomainEvent; 9 | import top.zhacker.ddd.identity.domain.tenant.TenantId; 10 | 11 | 12 | /** 13 | * Created by zhacker. 14 | * Time 2018/6/11 下午7:06 15 | */ 16 | @Getter 17 | @ToString 18 | @EqualsAndHashCode 19 | public class TenantDeactivated implements DomainEvent { 20 | 21 | private int eventVersion; 22 | private Date occurredOn; 23 | private TenantId tenantId; 24 | 25 | public TenantDeactivated(TenantId tenantId) { 26 | this.tenantId = tenantId; 27 | this.occurredOn = new Date(); 28 | this.eventVersion = 1; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/domain/user/person/event/PersonContactInformationChanged.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.domain.user.person.event; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.Getter; 6 | import lombok.ToString; 7 | import top.zhacker.core.model.BaseDomainEvent; 8 | import top.zhacker.ddd.identity.domain.tenant.TenantId; 9 | import top.zhacker.ddd.identity.domain.user.person.ContactInformation; 10 | 11 | 12 | /** 13 | * Created by zhacker. 14 | * Time 2018/6/30 下午9:59 15 | */ 16 | @Getter 17 | @AllArgsConstructor 18 | @ToString 19 | @EqualsAndHashCode(callSuper = true) 20 | public class PersonContactInformationChanged extends BaseDomainEvent { 21 | private TenantId tenantId; 22 | private String username; 23 | private ContactInformation contactInformation; 24 | } 25 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/port/message/dto/PersonContactInformationChanged.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.port.message.dto; 2 | 3 | import lombok.*; 4 | import top.zhacker.core.model.BaseDomainEvent; 5 | import top.zhacker.ddd.agilepm.domain.tenant.TenantId; 6 | 7 | 8 | /** 9 | * Created by zhacker. 10 | * Time 2018/6/30 下午9:59 11 | */ 12 | @Getter 13 | @AllArgsConstructor 14 | @ToString 15 | @EqualsAndHashCode(callSuper = true) 16 | public class PersonContactInformationChanged extends BaseDomainEvent { 17 | private TenantId tenantId; 18 | private String username; 19 | private ContactInformation contactInformation; 20 | 21 | @Data 22 | public static class ContactInformation{ 23 | private EmailAddress emailAddress; 24 | } 25 | 26 | @Data 27 | public static class EmailAddress{ 28 | private String address; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/application/request/TenantProvisionRequest.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.application.request; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | 7 | /** 8 | * Created by zhacker. 9 | * Time 2018/6/14 下午6:57 10 | */ 11 | @Data 12 | @Accessors(chain = true) 13 | public class TenantProvisionRequest { 14 | 15 | private String tenantName; 16 | private String tenantDescription; 17 | private String administorFirstName; 18 | private String administorLastName; 19 | private String emailAddress; 20 | private String primaryTelephone; 21 | private String secondaryTelephone; 22 | private String addressStreetAddress; 23 | private String addressCity; 24 | private String addressStateProvince; 25 | private String addressPostalCode; 26 | private String addressCountryCode; 27 | } 28 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/domain/team/member/ProductOwnerId.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.domain.team.member; 2 | 3 | import lombok.EqualsAndHashCode; 4 | import lombok.Getter; 5 | import top.zhacker.core.model.AssertionConcern; 6 | import top.zhacker.ddd.agilepm.domain.tenant.TenantId; 7 | 8 | 9 | /** 10 | * Created by zhacker. 11 | * Time 2018/6/18 下午10:17 12 | */ 13 | @Getter 14 | @EqualsAndHashCode(callSuper = false) 15 | public class ProductOwnerId extends AssertionConcern { 16 | 17 | private TenantId tenantId; 18 | private String id; 19 | 20 | public ProductOwnerId(TenantId tenantId, String id) { 21 | this.tenantId = tenantId; 22 | this.id = id; 23 | } 24 | 25 | public void setTenantId(TenantId tenantId) { 26 | this.tenantId = tenantId; 27 | } 28 | 29 | public void setId(String id) { 30 | this.id = id; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/domain/user/UserRepo.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.domain.user; 2 | 3 | import java.util.Collection; 4 | 5 | import top.zhacker.ddd.identity.domain.tenant.TenantId; 6 | 7 | 8 | /** 9 | * Created by zhacker. 10 | * Time 2018/6/13 上午11:29 11 | */ 12 | public interface UserRepo { 13 | 14 | User save(User user); 15 | 16 | User userWithUsername(TenantId tenantId, String username); 17 | 18 | User userFromAuthenticCredentials( 19 | TenantId aTenantId, 20 | String aUsername, 21 | String anEncryptedPassword); 22 | 23 | 24 | void remove(User aUser); 25 | 26 | 27 | Collection allSimilarlyNamedUsers( 28 | TenantId aTenantId, 29 | String aFirstNamePrefix, 30 | String aLastNamePrefix); 31 | 32 | Collection allUsers(TenantId aTenantId); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/resources/GroupMember.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/domain/user/UserDescriptor.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.domain.user; 2 | 3 | import lombok.AccessLevel; 4 | import lombok.AllArgsConstructor; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.NoArgsConstructor; 8 | import lombok.ToString; 9 | import top.zhacker.core.model.AssertionConcern; 10 | import top.zhacker.ddd.identity.domain.tenant.TenantId; 11 | 12 | 13 | /** 14 | * Created by zhacker. 15 | * Time 2018/6/30 下午9:15 16 | */ 17 | @Getter 18 | @AllArgsConstructor 19 | @NoArgsConstructor(access = AccessLevel.PROTECTED) 20 | @EqualsAndHashCode(callSuper = false) 21 | @ToString 22 | public class UserDescriptor extends AssertionConcern { 23 | 24 | private TenantId tenantId; 25 | private String username; 26 | private String emailAddress; 27 | 28 | public static UserDescriptor nullDescriptorInstance() { 29 | return new UserDescriptor(); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/infra/job/NotificationPublishJob.java: -------------------------------------------------------------------------------- 1 | /* 2 | package top.zhacker.ddd.identity.job; 3 | 4 | import com.dangdang.ddframe.job.api.ShardingContext; 5 | import com.dangdang.ddframe.job.api.simple.SimpleJob; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Component; 8 | import org.springframework.transaction.annotation.Transactional; 9 | import top.zhacker.boot.event.notification.publisher.NotificationPublisher; 10 | 11 | 12 | */ 13 | /** 14 | * Created by zhacker. 15 | * Time 2018/8/2 下午1:20 16 | *//* 17 | 18 | //@Job(name="NotificationPublishJob") 19 | @Component 20 | public class NotificationPublishJob implements SimpleJob { 21 | 22 | @Autowired 23 | private NotificationPublisher notificationPublisher; 24 | 25 | @Transactional 26 | @Override 27 | public void execute(ShardingContext shardingContext) { 28 | notificationPublisher.publishNotifications(); 29 | } 30 | } 31 | */ 32 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/domain/team/member/ProductOwner.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.domain.team.member; 2 | 3 | import lombok.EqualsAndHashCode; 4 | import lombok.Getter; 5 | import top.zhacker.ddd.agilepm.domain.tenant.TenantId; 6 | 7 | import java.util.Date; 8 | 9 | 10 | /** 11 | * Created by zhacker. 12 | * Time 2018/6/18 下午10:16 13 | */ 14 | @Getter 15 | @EqualsAndHashCode(callSuper = true) 16 | public class ProductOwner extends Member { 17 | 18 | protected ProductOwner() { 19 | super(); 20 | } 21 | 22 | public ProductOwner(TenantId aTenantId, 23 | String aUsername, 24 | String aFirstName, 25 | String aLastName, 26 | String anEmailAddress, 27 | Date anInitializedOn) { 28 | super(aTenantId, aUsername, aFirstName, aLastName, anEmailAddress, anInitializedOn); 29 | } 30 | 31 | public ProductOwnerId getProductOwnerId() { 32 | return new ProductOwnerId(this.getTenantId(), this.getUsername()); 33 | } 34 | 35 | 36 | } 37 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/application/vo/CalendarCommandResult.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.collaboration.application.vo; 16 | 17 | public interface CalendarCommandResult { 18 | 19 | public void resultingCalendarId(String aCalendarId); 20 | 21 | public void resultingCalendarEntryId(String aCalendarEntryId); 22 | } 23 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/domain/forum/discussion/event/DiscussionClosed.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.collaboration.domain.forum.discussion.event; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.NoArgsConstructor; 7 | import lombok.experimental.Accessors; 8 | import top.zhacker.core.model.BaseDomainEvent; 9 | import top.zhacker.ddd.collaboration.domain.forum.ForumId; 10 | import top.zhacker.ddd.collaboration.domain.forum.discussion.DiscussionId; 11 | import top.zhacker.ddd.collaboration.domain.tenant.Tenant; 12 | 13 | 14 | /** 15 | * Created by zhacker. 16 | * Time 2018/7/14 上午8:14 17 | */ 18 | @Data 19 | @Accessors(chain = true) 20 | @EqualsAndHashCode(callSuper = true) 21 | @AllArgsConstructor 22 | @NoArgsConstructor 23 | public class DiscussionClosed extends BaseDomainEvent { 24 | private Tenant tenant; 25 | private ForumId forumId; 26 | private DiscussionId discussionId; 27 | private String exclusiveOwner; 28 | } 29 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/domain/forum/discussion/event/DiscussionReopened.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.collaboration.domain.forum.discussion.event; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.NoArgsConstructor; 7 | import lombok.experimental.Accessors; 8 | import top.zhacker.core.model.BaseDomainEvent; 9 | import top.zhacker.ddd.collaboration.domain.forum.ForumId; 10 | import top.zhacker.ddd.collaboration.domain.forum.discussion.DiscussionId; 11 | import top.zhacker.ddd.collaboration.domain.tenant.Tenant; 12 | 13 | 14 | /** 15 | * Created by zhacker. 16 | * Time 2018/7/14 上午8:14 17 | */ 18 | @Data 19 | @Accessors(chain = true) 20 | @EqualsAndHashCode(callSuper = true) 21 | @AllArgsConstructor 22 | @NoArgsConstructor 23 | public class DiscussionReopened extends BaseDomainEvent { 24 | private Tenant tenant; 25 | private ForumId forumId; 26 | private DiscussionId discussionId; 27 | private String exclusiveOwner; 28 | } 29 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/domain/calendar/CalendarId.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.collaboration.domain.calendar; 16 | 17 | 18 | import lombok.AllArgsConstructor; 19 | import lombok.Data; 20 | import lombok.NoArgsConstructor; 21 | 22 | 23 | @Data 24 | @AllArgsConstructor 25 | @NoArgsConstructor 26 | public final class CalendarId { 27 | private String id; 28 | } 29 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/domain/team/member/TeamMember.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.domain.team.member; 2 | 3 | import lombok.Getter; 4 | import top.zhacker.ddd.agilepm.domain.tenant.TenantId; 5 | 6 | import java.util.Date; 7 | 8 | 9 | /** 10 | * Created by zhacker. 11 | * Time 2018/6/18 下午10:15 12 | */ 13 | @Getter 14 | public class TeamMember extends Member { 15 | 16 | protected TeamMember() { 17 | super(); 18 | } 19 | 20 | public TeamMember( 21 | TenantId aTenantId, 22 | String aUsername, 23 | String aFirstName, 24 | String aLastName, 25 | String anEmailAddress, 26 | Date anInitializedOn) { 27 | 28 | super(aTenantId, aUsername, aFirstName, aLastName, anEmailAddress, anInitializedOn); 29 | } 30 | 31 | public TeamMemberId getTeamMemberId() { 32 | return new TeamMemberId(this.getTenantId(), this.getUsername()); 33 | } 34 | 35 | public TeamMemberId teamMemberId() { 36 | return new TeamMemberId(this.tenantId(), this.username()); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/infra/repo/GroupMemberTypeUserType.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.identity.infra.repo; 16 | 17 | import top.zhacker.ddd.identity.domain.group.GroupMemberType; 18 | 19 | 20 | public class GroupMemberTypeUserType extends EnumUserType { 21 | public GroupMemberTypeUserType() { 22 | super(GroupMemberType.class); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/domain/forum/discussion/DiscussionId.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.collaboration.domain.forum.discussion; 16 | 17 | 18 | import lombok.AllArgsConstructor; 19 | import lombok.Data; 20 | import lombok.NoArgsConstructor; 21 | 22 | 23 | @Data 24 | @AllArgsConstructor 25 | @NoArgsConstructor 26 | public final class DiscussionId { 27 | private String id; 28 | } 29 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/domain/forum/discussion/post/PostId.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.collaboration.domain.forum.discussion.post; 16 | 17 | 18 | import lombok.AllArgsConstructor; 19 | import lombok.Data; 20 | import lombok.NoArgsConstructor; 21 | 22 | 23 | @Data 24 | @AllArgsConstructor 25 | @NoArgsConstructor 26 | public final class PostId { 27 | private String id; 28 | } 29 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/application/vo/DiscussionCommandResult.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.collaboration.application.vo; 16 | 17 | public interface DiscussionCommandResult { 18 | 19 | public void resultingDiscussionId(String aDiscussionId); 20 | 21 | public void resultingPostId(String aPostId); 22 | 23 | public void resultingInReplyToPostId(String aReplyToPostId); 24 | } 25 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/domain/product/ProductId.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.domain.product; 2 | 3 | import lombok.EqualsAndHashCode; 4 | import lombok.Getter; 5 | import lombok.ToString; 6 | import top.zhacker.core.model.AssertionConcern; 7 | 8 | 9 | /** 10 | * Created by zhacker. 11 | * Time 2018/6/20 下午9:24 12 | */ 13 | @ToString 14 | @EqualsAndHashCode(callSuper = false) 15 | public class ProductId extends AssertionConcern { 16 | 17 | @Getter 18 | private String id; 19 | 20 | private ProductId() { 21 | super(); 22 | } 23 | 24 | public ProductId(String anId) { 25 | this(); 26 | 27 | this.setId(anId); 28 | } 29 | 30 | public ProductId(ProductId aProductId) { 31 | this(aProductId.getId()); 32 | } 33 | 34 | 35 | private void setId(String anId) { 36 | this.assertArgumentNotEmpty(anId, "The id must be provided."); 37 | this.assertArgumentLength(anId, 36, "The id must be 36 characters or less."); 38 | 39 | this.id = anId; 40 | } 41 | 42 | public String id(){ 43 | return id; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/domain/calendar/entry/CalendarEntryId.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.collaboration.domain.calendar.entry; 16 | 17 | 18 | import lombok.AllArgsConstructor; 19 | import lombok.Data; 20 | import lombok.NoArgsConstructor; 21 | 22 | 23 | @Data 24 | @AllArgsConstructor 25 | @NoArgsConstructor 26 | public final class CalendarEntryId { 27 | 28 | private String id; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/domain/forum/ForumRepository.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.collaboration.domain.forum; 16 | 17 | 18 | import top.zhacker.ddd.collaboration.domain.tenant.Tenant; 19 | 20 | 21 | public interface ForumRepository { 22 | 23 | public Forum forumOfId(Tenant aTenant, ForumId aForumId); 24 | 25 | public ForumId nextIdentity(); 26 | 27 | public void save(Forum aForum); 28 | } 29 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/api/vo/UserVO.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.api.vo; 2 | 3 | import java.io.Serializable; 4 | 5 | import lombok.Data; 6 | import lombok.experimental.Accessors; 7 | import top.zhacker.ddd.identity.domain.user.User; 8 | 9 | 10 | /** 11 | * Created by zhacker. 12 | * Time 2018/7/13 下午11:45 13 | */ 14 | @Data 15 | @Accessors(chain = true) 16 | public class UserVO implements Serializable { 17 | private String emailAddress; 18 | private String firstName; 19 | private String lastName; 20 | private String role; 21 | private String tenantId; 22 | private String username; 23 | 24 | public static UserVO from(User user){ 25 | if(user==null){ 26 | return null; 27 | } 28 | return new UserVO() 29 | .setTenantId(user.getTenantId().getId()) 30 | .setUsername(user.getUsername()) 31 | .setFirstName(user.getPerson().getName().getFirstName()) 32 | .setLastName(user.getPerson().getName().getLastName()) 33 | .setEmailAddress(user.getPerson().emailAddress().getAddress()); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/domain/forum/discussion/post/PostRepository.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.collaboration.domain.forum.discussion.post; 16 | 17 | 18 | import top.zhacker.ddd.collaboration.domain.tenant.Tenant; 19 | 20 | 21 | public interface PostRepository { 22 | 23 | public PostId nextIdentity(); 24 | 25 | public Post postOfId(Tenant aTenant, PostId aPostId); 26 | 27 | public void save(Post aPost); 28 | } 29 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/domain/tenant/Tenant.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.collaboration.domain.tenant; 16 | 17 | 18 | import lombok.AllArgsConstructor; 19 | import lombok.Data; 20 | import lombok.NoArgsConstructor; 21 | 22 | 23 | @Data 24 | @AllArgsConstructor 25 | @NoArgsConstructor 26 | public final class Tenant { 27 | 28 | private static final long serialVersionUID = 1L; 29 | 30 | private String id; 31 | } 32 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/domain/calendar/CalendarRepository.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.collaboration.domain.calendar; 16 | 17 | 18 | import top.zhacker.ddd.collaboration.domain.tenant.Tenant; 19 | 20 | 21 | public interface CalendarRepository { 22 | 23 | public Calendar calendarOfId(Tenant aTenant, CalendarId aCalendarId); 24 | 25 | public CalendarId nextIdentity(); 26 | 27 | public void save(Calendar aCalendar); 28 | } 29 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/domain/forum/ForumId.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.collaboration.domain.forum; 16 | 17 | 18 | import lombok.AllArgsConstructor; 19 | import lombok.Data; 20 | import lombok.NoArgsConstructor; 21 | 22 | 23 | @Data 24 | @AllArgsConstructor 25 | @NoArgsConstructor 26 | public final class ForumId { 27 | 28 | private static final long serialVersionUID = 1L; 29 | 30 | private String id; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/application/command/DeactivateTenantCommand.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.identity.application.command; 16 | 17 | import lombok.AllArgsConstructor; 18 | import lombok.Data; 19 | import lombok.NoArgsConstructor; 20 | import lombok.experimental.Accessors; 21 | 22 | 23 | @Data 24 | @Accessors(chain = true) 25 | @AllArgsConstructor 26 | @NoArgsConstructor 27 | public class DeactivateTenantCommand { 28 | private String tenantId; 29 | } 30 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/port/message/listener/ProductBacklogItemPlannedListener.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.port.message.listener; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.cloud.stream.annotation.StreamListener; 5 | import org.springframework.stereotype.Component; 6 | import top.zhacker.ddd.agilepm.application.product.ProductApplicationService; 7 | import top.zhacker.ddd.agilepm.domain.product.event.ProductBacklogItemPlanned; 8 | 9 | 10 | /** 11 | * Created by zhacker. 12 | * Time 2018/7/15 下午1:00 13 | */ 14 | @Component 15 | public class ProductBacklogItemPlannedListener { 16 | 17 | @Autowired 18 | private ProductApplicationService productApplicationService; 19 | 20 | @StreamListener(ListeningChannels.ProductBacklogItemPlanned) 21 | public void process(ProductBacklogItemPlanned event){ 22 | if(event.tenantId()==null){ 23 | return; 24 | } 25 | productApplicationService.plannedProductBacklogItem( 26 | event.tenantId().getId(), 27 | event.productId().id(), 28 | event.backlogItemId().id() 29 | ); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/domain/forum/discussion/event/DiscussionStarted.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.collaboration.domain.forum.discussion.event; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.NoArgsConstructor; 7 | import lombok.experimental.Accessors; 8 | import top.zhacker.core.model.BaseDomainEvent; 9 | import top.zhacker.ddd.collaboration.domain.collaborator.Author; 10 | import top.zhacker.ddd.collaboration.domain.forum.ForumId; 11 | import top.zhacker.ddd.collaboration.domain.forum.discussion.DiscussionId; 12 | import top.zhacker.ddd.collaboration.domain.tenant.Tenant; 13 | 14 | 15 | /** 16 | * Created by zhacker. 17 | * Time 2018/7/14 上午8:14 18 | */ 19 | @Data 20 | @Accessors(chain = true) 21 | @EqualsAndHashCode(callSuper = true) 22 | @AllArgsConstructor 23 | @NoArgsConstructor 24 | public class DiscussionStarted extends BaseDomainEvent { 25 | private Tenant tenant; 26 | private ForumId forumId; 27 | private DiscussionId discussionId; 28 | private Author author; 29 | private String subject; 30 | private String exclusiveOwner; 31 | } 32 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/domain/forum/discussion/DiscussionRepository.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.collaboration.domain.forum.discussion; 16 | 17 | 18 | import top.zhacker.ddd.collaboration.domain.tenant.Tenant; 19 | 20 | 21 | public interface DiscussionRepository { 22 | 23 | public Discussion discussionOfId(Tenant aTenantId, DiscussionId aDiscussionId); 24 | 25 | public DiscussionId nextIdentity(); 26 | 27 | public void save(Discussion aDiscussion); 28 | } 29 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/domain/calendar/entry/CalendarEntryRepository.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.collaboration.domain.calendar.entry; 16 | 17 | 18 | import top.zhacker.ddd.collaboration.domain.tenant.Tenant; 19 | 20 | 21 | public interface CalendarEntryRepository { 22 | 23 | public CalendarEntry calendarEntryOfId(Tenant aTenant, CalendarEntryId aCalendarEntryId); 24 | 25 | public CalendarEntryId nextIdentity(); 26 | 27 | public void save(CalendarEntry aCalendarEntry); 28 | } 29 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/resources/Role.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # zhacker-sample-ovation 2 | 3 | > 《实现领域驱动设计》对应的源码,并整合了spring cloud,以rest api形式对外暴露服务。 4 | 5 | 6 | 其中涉及的基础设施如下: 7 | 8 | * SpringMVC:服务暴露方式 9 | * Swagger2:api文档 10 | * Spring Cloud Zookeeper: 服务发现 11 | * zhacker-core:领域模型基础类库 12 | * zhacker-boot-starter-event: 领域事件发布等设施 13 | * Kafka:上下文映射中的消息发送 14 | * Hibernate + Mybatis + SpringJdbc + LevelDB:仓储实现 15 | * Mysql + LevelDB:数据库存储数据 16 | 17 | 18 | ## 项目结构和功能列表 19 | 20 | #### zhacker-sample-ovation-identityaccess 21 | 22 | > 身份认证上下文实现 23 | 24 | ![tenant-user](doc/images/tenant.png) 25 | ![tenant-role](doc/images/role.png) 26 | ![tenant-group](doc/images/group.png) 27 | 28 | #### zhacker-sample-ovation-collaboration 29 | 30 | > 协作上下文实现 31 | 32 | ![forum](doc/images/forum.png) 33 | ![discussion](doc/images/discussion.png) 34 | ![post](doc/images/post.png) 35 | 36 | #### zhacker-sample-ovation-agilepm 37 | 38 | > 敏捷项目管理上下文实现 39 | 40 | ![member](doc/images/member.png) 41 | ![team](doc/images/team.png) 42 | ![product](doc/images/product.png) 43 | ![backlog](doc/images/backlog.png) 44 | 45 | 46 | ## 项目设计 47 | 48 | #### 身份上下文UML 49 | 50 | ![identity-uml](doc/images/identity-uml.png) 51 | 52 | #### 协作上下文UML 53 | 54 | ![collaboration-uml](doc/images/collaboration-uml.png) -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/resources/RegistrationInvitation.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/application/command/AssignGroupToRoleCommand.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.identity.application.command; 16 | 17 | import lombok.AllArgsConstructor; 18 | import lombok.Data; 19 | import lombok.NoArgsConstructor; 20 | import lombok.experimental.Accessors; 21 | 22 | 23 | @Data 24 | @Accessors(chain = true) 25 | @AllArgsConstructor 26 | @NoArgsConstructor 27 | public class AssignGroupToRoleCommand { 28 | 29 | private String tenantId; 30 | private String groupName; 31 | private String roleName; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/domain/collaborator/Owner.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.collaboration.domain.collaborator; 16 | 17 | public class Owner extends Collaborator { 18 | 19 | private static final long serialVersionUID = 1L; 20 | 21 | public Owner(String anIdentity, String aName, String anEmailAddress) { 22 | super(anIdentity, aName, anEmailAddress); 23 | } 24 | 25 | protected Owner() { 26 | super(); 27 | } 28 | 29 | @Override 30 | protected int hashPrimeValue() { 31 | return 29; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/application/command/UnassignGroupFromRoleCommand.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.identity.application.command; 16 | 17 | import lombok.AllArgsConstructor; 18 | import lombok.Data; 19 | import lombok.NoArgsConstructor; 20 | import lombok.experimental.Accessors; 21 | 22 | 23 | @Data 24 | @Accessors(chain = true) 25 | @AllArgsConstructor 26 | @NoArgsConstructor 27 | public class UnassignGroupFromRoleCommand { 28 | 29 | private String tenantId; 30 | private String groupName; 31 | private String roleName; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/resources/Group.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/domain/collaborator/Author.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.collaboration.domain.collaborator; 16 | 17 | public final class Author extends Collaborator { 18 | 19 | private static final long serialVersionUID = 1L; 20 | 21 | public Author(String anIdentity, String aName, String anEmailAddress) { 22 | super(anIdentity, aName, anEmailAddress); 23 | } 24 | 25 | protected Author() { 26 | super(); 27 | } 28 | 29 | @Override 30 | protected int hashPrimeValue() { 31 | return 19; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/port/client/UserVO.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.collaboration.port.client; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | import top.zhacker.core.exception.BusinessException; 6 | import top.zhacker.ddd.collaboration.domain.collaborator.Collaborator; 7 | 8 | import java.io.Serializable; 9 | import java.lang.reflect.Constructor; 10 | 11 | 12 | /** 13 | * Created by zhacker. 14 | * Time 2018/7/13 下午11:45 15 | */ 16 | @Data 17 | @Accessors(chain = true) 18 | public class UserVO implements Serializable { 19 | private String emailAddress; 20 | private String firstName; 21 | private String lastName; 22 | private String role; 23 | private String tenantId; 24 | private String username; 25 | 26 | public T to(Class targetClass){ 27 | 28 | try { 29 | Constructor ctor = targetClass.getConstructor(String.class, String.class, String.class); 30 | 31 | T collaborator = ctor.newInstance(username, (firstName + " " + lastName).trim(), emailAddress); 32 | 33 | return collaborator; 34 | 35 | }catch (Exception e){ 36 | throw new BusinessException("user.convert.fail"); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/domain/collaborator/Creator.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.collaboration.domain.collaborator; 16 | 17 | public final class Creator extends Collaborator { 18 | 19 | private static final long serialVersionUID = 1L; 20 | 21 | public Creator(String anIdentity, String aName, String anEmailAddress) { 22 | super(anIdentity, aName, anEmailAddress); 23 | } 24 | 25 | protected Creator() { 26 | super(); 27 | } 28 | 29 | @Override 30 | protected int hashPrimeValue() { 31 | return 43; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/domain/collaborator/Moderator.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.collaboration.domain.collaborator; 16 | 17 | public final class Moderator extends Collaborator { 18 | 19 | private static final long serialVersionUID = 1L; 20 | 21 | public Moderator(String anIdentity, String aName, String anEmailAddress) { 22 | super(anIdentity, aName, anEmailAddress); 23 | } 24 | 25 | protected Moderator() { 26 | super(); 27 | } 28 | 29 | @Override 30 | protected int hashPrimeValue() { 31 | return 59; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/domain/collaborator/Participant.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.collaboration.domain.collaborator; 16 | 17 | public final class Participant extends Collaborator { 18 | 19 | private static final long serialVersionUID = 1L; 20 | 21 | public Participant(String anIdentity, String aName, String anEmailAddress) { 22 | super(anIdentity, aName, anEmailAddress); 23 | } 24 | 25 | protected Participant() { 26 | super(); 27 | } 28 | 29 | @Override 30 | protected int hashPrimeValue() { 31 | return 23; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/port/message/listener/BacklogItemCommittedListener.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.port.message.listener; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.cloud.stream.annotation.StreamListener; 5 | import org.springframework.stereotype.Component; 6 | import top.zhacker.ddd.agilepm.application.sprint.SprintApplicationService; 7 | import top.zhacker.ddd.agilepm.application.sprint.command.CommitBacklogItemToSprintCommand; 8 | import top.zhacker.ddd.agilepm.domain.product.blacklogitem.event.BacklogItemCommitted; 9 | 10 | 11 | /** 12 | * Created by zhacker. 13 | * Time 2018/7/15 上午11:19 14 | */ 15 | @Component 16 | public class BacklogItemCommittedListener { 17 | 18 | @Autowired 19 | private SprintApplicationService sprintApplicationService; 20 | 21 | @StreamListener(ListeningChannels.BacklogItemCommitted) 22 | public void process(BacklogItemCommitted event){ 23 | sprintApplicationService.commitBacklogItemToSprint( 24 | new CommitBacklogItemToSprintCommand() 25 | .setTenantId(event.tenantId().getId()) 26 | .setSprintId(event.committedToSprintId().id()) 27 | .setBacklogItemId(event.backlogItemId().id()) 28 | ); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/port/message/listener/TeamMemberNameChangedListener.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.port.message.listener; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.cloud.stream.annotation.StreamListener; 5 | import org.springframework.stereotype.Component; 6 | import top.zhacker.ddd.agilepm.application.member.MemberApplicationService; 7 | import top.zhacker.ddd.agilepm.application.member.command.ChangeTeamMemberNameCommand; 8 | import top.zhacker.ddd.agilepm.port.message.dto.PersonNameChanged; 9 | 10 | 11 | /** 12 | * Created by zhacker. 13 | * Time 2018/6/18 下午3:58 14 | */ 15 | @Component 16 | public class TeamMemberNameChangedListener { 17 | 18 | @Autowired 19 | private MemberApplicationService memberApplicationService; 20 | 21 | @StreamListener(ListeningChannels.PersonNameChanged) 22 | public void process(PersonNameChanged event){ 23 | memberApplicationService.changeTeamMemberName( 24 | new ChangeTeamMemberNameCommand( 25 | event.getTenantId().getId(), 26 | event.getUsername(), 27 | event.getName().getFirstName(), 28 | event.getName().getLastName(), 29 | event.getOccurredOn()) 30 | ); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/port/message/listener/BacklogItemScheduledListener.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.port.message.listener; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.cloud.stream.annotation.StreamListener; 5 | import org.springframework.stereotype.Component; 6 | import top.zhacker.ddd.agilepm.application.release.ReleaseApplicationService; 7 | import top.zhacker.ddd.agilepm.application.release.command.ScheduleBacklogItemForReleaseCommand; 8 | import top.zhacker.ddd.agilepm.domain.product.blacklogitem.event.BacklogItemScheduled; 9 | 10 | 11 | /** 12 | * Created by zhacker. 13 | * Time 2018/7/15 上午11:19 14 | */ 15 | @Component 16 | public class BacklogItemScheduledListener { 17 | 18 | @Autowired 19 | private ReleaseApplicationService releaseApplicationService; 20 | 21 | @StreamListener(ListeningChannels.BacklogItemScheduled) 22 | public void process(BacklogItemScheduled event){ 23 | 24 | releaseApplicationService.scheduleBacklogItem( 25 | new ScheduleBacklogItemForReleaseCommand() 26 | .setTenantId(event.tenantId().getId()) 27 | .setReleaseId(event.scheduledForReleaseId().id()) 28 | .setBacklogItemId(event.backlogItemId().id()) 29 | ); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/application/command/ActivateTenantCommand.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.identity.application.command; 16 | 17 | public class ActivateTenantCommand { 18 | private String tenantId; 19 | 20 | public ActivateTenantCommand(String tenantId) { 21 | super(); 22 | 23 | this.tenantId = tenantId; 24 | } 25 | 26 | public ActivateTenantCommand() { 27 | super(); 28 | } 29 | 30 | public String getTenantId() { 31 | return this.tenantId; 32 | } 33 | 34 | public void setTenantId(String tenantId) { 35 | this.tenantId = tenantId; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/port/message/listener/TeamMemberEmailAddressChangedListener.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.port.message.listener; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.cloud.stream.annotation.StreamListener; 5 | import org.springframework.stereotype.Component; 6 | import top.zhacker.ddd.agilepm.application.member.MemberApplicationService; 7 | import top.zhacker.ddd.agilepm.application.member.command.ChangeTeamMemberEmailAddressCommand; 8 | import top.zhacker.ddd.agilepm.port.message.dto.PersonContactInformationChanged; 9 | 10 | 11 | /** 12 | * Created by zhacker. 13 | * Time 2018/6/18 下午3:58 14 | */ 15 | @Component 16 | public class TeamMemberEmailAddressChangedListener { 17 | 18 | @Autowired 19 | private MemberApplicationService memberApplicationService; 20 | 21 | @StreamListener(ListeningChannels.PersonContactInformationChanged) 22 | public void process(PersonContactInformationChanged event){ 23 | memberApplicationService.changeTeamMemberEmailAddress(new ChangeTeamMemberEmailAddressCommand() 24 | .setTenantId(event.getTenantId().getId()) 25 | .setUsername(event.getUsername()) 26 | .setEmailAddress(event.getContactInformation().getEmailAddress().getAddress()) 27 | ); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/domain/product/discussion/ProductDiscussionRequestTimedOut.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.agilepm.domain.product.discussion; 16 | 17 | 18 | import top.zhacker.boot.event.process.ProcessId; 19 | import top.zhacker.boot.event.process.ProcessTimedOut; 20 | 21 | public class ProductDiscussionRequestTimedOut extends ProcessTimedOut { 22 | 23 | public ProductDiscussionRequestTimedOut( 24 | String aTenantId, 25 | ProcessId aProcessId, 26 | int aTotalRetriesPermitted, 27 | int aRetryCount) { 28 | 29 | super(aTenantId, aProcessId, aTotalRetriesPermitted, aRetryCount); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/domain/collaborator/CollaboratorService.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.collaboration.domain.collaborator; 16 | 17 | 18 | import top.zhacker.ddd.collaboration.domain.tenant.Tenant; 19 | 20 | 21 | public interface CollaboratorService { 22 | 23 | public Author authorFrom(Tenant aTenant, String anIdentity); 24 | 25 | public Creator creatorFrom(Tenant aTenant, String anIdentity); 26 | 27 | public Moderator moderatorFrom(Tenant aTenant, String anIdentity); 28 | 29 | public Owner ownerFrom(Tenant aTenant, String anIdentity); 30 | 31 | public Participant participantFrom(Tenant aTenant, String anIdentity); 32 | } 33 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/infra/service/MD5EncryptionService.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.infra.service; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | import java.math.BigInteger; 6 | import java.security.MessageDigest; 7 | 8 | import top.zhacker.core.model.AssertionConcern; 9 | import top.zhacker.ddd.identity.domain.user.EncryptionService; 10 | 11 | @Component 12 | public class MD5EncryptionService extends AssertionConcern implements EncryptionService { 13 | 14 | public MD5EncryptionService() { 15 | super(); 16 | } 17 | 18 | @Override 19 | public String encryptedValue(String aPlainTextValue) { 20 | this.assertArgumentNotEmpty( 21 | aPlainTextValue, 22 | "Plain text value to encrypt must be provided."); 23 | 24 | String encryptedValue = null; 25 | 26 | try { 27 | 28 | MessageDigest messageDigest = MessageDigest.getInstance("MD5"); 29 | 30 | messageDigest.update(aPlainTextValue.getBytes("UTF-8")); 31 | 32 | BigInteger bigInt = new BigInteger(1, messageDigest.digest()); 33 | 34 | encryptedValue = bigInt.toString(16); 35 | 36 | } catch (Exception e) { 37 | throw new IllegalStateException(e); 38 | } 39 | 40 | return encryptedValue; 41 | } 42 | } -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/resources/Tenant.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/domain/calendar/entry/AlarmUnitsType.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.collaboration.domain.calendar.entry; 16 | 17 | public enum AlarmUnitsType { 18 | 19 | Days { 20 | public boolean isDays() { 21 | return true; 22 | } 23 | }, 24 | 25 | Hours { 26 | public boolean isHours() { 27 | return true; 28 | } 29 | }, 30 | 31 | Minutes { 32 | public boolean isMinutes() { 33 | return true; 34 | } 35 | }; 36 | 37 | public boolean isDays() { 38 | return false; 39 | } 40 | 41 | public boolean isHours() { 42 | return false; 43 | } 44 | 45 | public boolean isMinutes() { 46 | return false; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/api/SprintApi.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.api; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | import org.springframework.web.bind.annotation.RestController; 7 | import top.zhacker.boot.aop.log.ParamLog; 8 | import top.zhacker.ddd.agilepm.domain.product.ProductId; 9 | import top.zhacker.ddd.agilepm.domain.product.sprint.Sprint; 10 | import top.zhacker.ddd.agilepm.domain.product.sprint.SprintId; 11 | import top.zhacker.ddd.agilepm.domain.product.sprint.SprintRepository; 12 | import top.zhacker.ddd.agilepm.domain.tenant.TenantId; 13 | 14 | import java.util.Collection; 15 | 16 | 17 | /** 18 | * Created by zhacker. 19 | * Time 2018/7/15 下午1:20 20 | */ 21 | @ParamLog 22 | @RestController 23 | @RequestMapping("/v1/sprint") 24 | public class SprintApi { 25 | 26 | @Autowired 27 | private SprintRepository sprintRepository; 28 | 29 | @GetMapping("list") 30 | public Collection allProductSprints(String tenantId, String productId){ 31 | return sprintRepository.allProductSprints(new TenantId(tenantId), new ProductId(productId)); 32 | } 33 | 34 | @GetMapping("detail") 35 | public Sprint sprintOfId(String tenantId, String sprintId){ 36 | return sprintRepository.sprintOfId( 37 | new TenantId(tenantId),new SprintId(sprintId) 38 | ); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/domain/product/sprint/SprintRepository.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.agilepm.domain.product.sprint; 16 | 17 | 18 | import top.zhacker.ddd.agilepm.domain.product.ProductId; 19 | import top.zhacker.ddd.agilepm.domain.tenant.TenantId; 20 | 21 | import java.util.Collection; 22 | 23 | 24 | public interface SprintRepository { 25 | 26 | public Collection allProductSprints(TenantId aTenantId, ProductId aProductId); 27 | 28 | public SprintId nextIdentity(); 29 | 30 | public void remove(Sprint aSprint); 31 | 32 | public void removeAll(Collection aSprintCollection); 33 | 34 | public void save(Sprint aSprint); 35 | 36 | public void saveAll(Collection aSprintCollection); 37 | 38 | public Sprint sprintOfId(TenantId aTenantId, SprintId aSprintId); 39 | } 40 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/resources/User.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/domain/product/release/ReleaseRepository.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.agilepm.domain.product.release; 16 | 17 | 18 | import top.zhacker.ddd.agilepm.domain.product.ProductId; 19 | import top.zhacker.ddd.agilepm.domain.tenant.TenantId; 20 | 21 | import java.util.Collection; 22 | 23 | 24 | public interface ReleaseRepository { 25 | 26 | public Collection allProductReleases(TenantId aTenantId, ProductId aProductId); 27 | 28 | public ReleaseId nextIdentity(); 29 | 30 | public Release releaseOfId(TenantId aTenantId, ReleaseId aReleaseId); 31 | 32 | public void remove(Release aRelease); 33 | 34 | public void removeAll(Collection aReleaseCollection); 35 | 36 | public void save(Release aRelease); 37 | 38 | public void saveAll(Collection aReleaseCollection); 39 | } 40 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/infra/listener/UserCreatedListener.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.infra.listener; 2 | 3 | import org.springframework.cloud.stream.annotation.EnableBinding; 4 | import org.springframework.cloud.stream.annotation.Input; 5 | import org.springframework.cloud.stream.annotation.StreamListener; 6 | import org.springframework.messaging.SubscribableChannel; 7 | import org.springframework.stereotype.Component; 8 | 9 | import lombok.extern.slf4j.Slf4j; 10 | 11 | 12 | /** 13 | * Created by zhacker. 14 | * Time 2018/6/24 下午4:32 15 | */ 16 | @Component 17 | @Slf4j 18 | @EnableBinding(UserCreatedListener.NotificationSource.class) 19 | public class UserCreatedListener { 20 | 21 | @StreamListener(NotificationSource.Notification) 22 | public void process(String notification){ 23 | log.info("notification={}", notification); 24 | } 25 | 26 | @StreamListener(NotificationSource.TenantProvisioned) 27 | public void doWhenTenantProvisioned(String notification){ 28 | log.info("tenantProvisioned = {}", notification); 29 | } 30 | 31 | 32 | public interface NotificationSource { 33 | 34 | String Notification = "topic.identity-access.notification"; 35 | 36 | String TenantProvisioned = "top.zhacker.ddd.identity.domain.tenant.event.TenantProvisioned"; 37 | 38 | @Input(Notification) 39 | SubscribableChannel notified(); 40 | 41 | @Input(TenantProvisioned) 42 | SubscribableChannel tenantProvisioned(); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/api/ReleaseApi.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.api; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | import org.springframework.web.bind.annotation.RestController; 7 | import top.zhacker.boot.aop.log.ParamLog; 8 | import top.zhacker.ddd.agilepm.domain.product.ProductId; 9 | import top.zhacker.ddd.agilepm.domain.product.release.Release; 10 | import top.zhacker.ddd.agilepm.domain.product.release.ReleaseId; 11 | import top.zhacker.ddd.agilepm.domain.product.release.ReleaseRepository; 12 | import top.zhacker.ddd.agilepm.domain.tenant.TenantId; 13 | 14 | import java.util.Collection; 15 | 16 | 17 | /** 18 | * Created by zhacker. 19 | * Time 2018/7/15 下午1:20 20 | */ 21 | @RestController 22 | @RequestMapping("/v1/release") 23 | @ParamLog 24 | public class ReleaseApi { 25 | 26 | @Autowired 27 | private ReleaseRepository releaseRepository; 28 | 29 | @GetMapping("list") 30 | public Collection allProductReleases(String tenantId, String productId){ 31 | return releaseRepository.allProductReleases( 32 | new TenantId(tenantId),new ProductId(productId) 33 | ); 34 | } 35 | 36 | @GetMapping("detail") 37 | public Release releaseOfId(String tenantId, String releaseId){ 38 | return releaseRepository.releaseOfId( 39 | new TenantId(tenantId), new ReleaseId(releaseId) 40 | ); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/domain/product/ProductRepository.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.agilepm.domain.product; 16 | 17 | import top.zhacker.ddd.agilepm.domain.tenant.TenantId; 18 | 19 | import java.util.Collection; 20 | 21 | 22 | public interface ProductRepository { 23 | 24 | public Collection allProductsOfTenant(TenantId aTenantId); 25 | 26 | public ProductId nextIdentity(); 27 | 28 | public Product productOfDiscussionInitiationId(TenantId aTenantId, String aDiscussionInitiationId); 29 | 30 | public Product productOfId(TenantId aTenantId, ProductId aProductId); 31 | 32 | public void remove(Product aProduct); 33 | 34 | public void removeAll(Collection aProductCollection); 35 | 36 | public void save(Product aProduct); 37 | 38 | public void saveAll(Collection aProductCollection); 39 | } 40 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/domain/product/blacklogitem/task/TaskStatus.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.agilepm.domain.product.blacklogitem.task; 16 | 17 | public enum TaskStatus { 18 | 19 | NOT_STARTED { 20 | public boolean isNotStarted() { 21 | return true; 22 | } 23 | }, 24 | 25 | IN_PROGRESS { 26 | public boolean isInProgress() { 27 | return true; 28 | } 29 | }, 30 | 31 | IMPEDED { 32 | public boolean isImpeded() { 33 | return true; 34 | } 35 | }, 36 | 37 | DONE { 38 | public boolean isDone() { 39 | return true; 40 | } 41 | }; 42 | 43 | public boolean isDone() { 44 | return false; 45 | } 46 | 47 | public boolean isImpeded() { 48 | return false; 49 | } 50 | 51 | public boolean isInProgress() { 52 | return false; 53 | } 54 | 55 | public boolean isNotStarted() { 56 | return false; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/domain/forum/event/ForumClosed.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.collaboration.domain.forum.event; 16 | 17 | 18 | import top.zhacker.core.model.BaseDomainEvent; 19 | import top.zhacker.ddd.collaboration.domain.forum.ForumId; 20 | import top.zhacker.ddd.collaboration.domain.tenant.Tenant; 21 | 22 | 23 | public class ForumClosed extends BaseDomainEvent { 24 | 25 | private String exclusiveOwner; 26 | private ForumId forumId; 27 | private Tenant tenant; 28 | 29 | public ForumClosed(Tenant aTenant, ForumId aForumId, String anExclusiveOwner) { 30 | super(); 31 | 32 | this.eventVersion = 1; 33 | this.exclusiveOwner = anExclusiveOwner; 34 | this.forumId = aForumId; 35 | this.tenant = aTenant; 36 | } 37 | 38 | public String exclusiveOwner() { 39 | return this.exclusiveOwner; 40 | } 41 | 42 | public ForumId forumId() { 43 | return this.forumId; 44 | } 45 | 46 | public Tenant tenant() { 47 | return this.tenant; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/domain/forum/event/ForumReopened.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.collaboration.domain.forum.event; 16 | 17 | import top.zhacker.core.model.BaseDomainEvent; 18 | import top.zhacker.ddd.collaboration.domain.forum.ForumId; 19 | import top.zhacker.ddd.collaboration.domain.tenant.Tenant; 20 | 21 | 22 | public class ForumReopened extends BaseDomainEvent { 23 | 24 | private String exclusiveOwner; 25 | private ForumId forumId; 26 | private Tenant tenant; 27 | 28 | public ForumReopened(Tenant aTenant, ForumId aForumId, String anExclusiveOwner) { 29 | super(); 30 | 31 | this.eventVersion = 1; 32 | this.exclusiveOwner = anExclusiveOwner; 33 | this.forumId = aForumId; 34 | this.tenant = aTenant; 35 | } 36 | 37 | public String exclusiveOwner() { 38 | return this.exclusiveOwner; 39 | } 40 | 41 | public ForumId forumId() { 42 | return this.forumId; 43 | } 44 | 45 | public Tenant tenant() { 46 | return this.tenant; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/application/release/ReleaseApplicationService.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.application.release; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Service; 5 | import top.zhacker.ddd.agilepm.application.release.command.ScheduleBacklogItemForReleaseCommand; 6 | import top.zhacker.ddd.agilepm.domain.product.blacklogitem.BacklogItem; 7 | import top.zhacker.ddd.agilepm.domain.product.blacklogitem.BacklogItemId; 8 | import top.zhacker.ddd.agilepm.domain.product.blacklogitem.BacklogItemRepository; 9 | import top.zhacker.ddd.agilepm.domain.product.release.Release; 10 | import top.zhacker.ddd.agilepm.domain.product.release.ReleaseId; 11 | import top.zhacker.ddd.agilepm.domain.product.release.ReleaseRepository; 12 | import top.zhacker.ddd.agilepm.domain.tenant.TenantId; 13 | import top.zhacker.boot.leveldb.LevelDbTransactional; 14 | 15 | 16 | /** 17 | * Created by zhacker. 18 | * Time 2018/7/15 下午3:03 19 | */ 20 | @Service 21 | public class ReleaseApplicationService { 22 | 23 | @Autowired 24 | private ReleaseRepository releaseRepository; 25 | 26 | @Autowired 27 | private BacklogItemRepository backlogItemRepository; 28 | 29 | @LevelDbTransactional 30 | public void scheduleBacklogItem(ScheduleBacklogItemForReleaseCommand command){ 31 | Release release = releaseRepository.releaseOfId(new TenantId(command.getTenantId()), new ReleaseId(command.getReleaseId())); 32 | 33 | BacklogItem item = backlogItemRepository.backlogItemOfId( 34 | new TenantId(command.getTenantId()), new BacklogItemId(command.getBacklogItemId()) 35 | ); 36 | 37 | release.schedule(item); 38 | 39 | releaseRepository.save(release); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/application/command/AddUserToGroupCommand.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.identity.application.command; 16 | 17 | public class AddUserToGroupCommand { 18 | 19 | private String tenantId; 20 | private String groupName; 21 | private String username; 22 | 23 | public AddUserToGroupCommand(String tenantId, String groupName, String username) { 24 | super(); 25 | 26 | this.tenantId = tenantId; 27 | this.groupName = groupName; 28 | this.username = username; 29 | } 30 | 31 | public String getGroupName() { 32 | return groupName; 33 | } 34 | 35 | public void setGroupName(String groupName) { 36 | this.groupName = groupName; 37 | } 38 | 39 | public String getTenantId() { 40 | return tenantId; 41 | } 42 | 43 | public void setTenantId(String tenantId) { 44 | this.tenantId = tenantId; 45 | } 46 | 47 | public String getUsername() { 48 | return username; 49 | } 50 | 51 | public void setUsername(String username) { 52 | this.username = username; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/application/command/AuthenticateUserCommand.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.identity.application.command; 16 | 17 | public class AuthenticateUserCommand { 18 | private String tenantId; 19 | private String username; 20 | private String password; 21 | 22 | public AuthenticateUserCommand(String tenantId, String aUsername, String aPassword) { 23 | super(); 24 | 25 | this.tenantId = tenantId; 26 | this.username = aUsername; 27 | this.password = aPassword; 28 | } 29 | 30 | public String getTenantId() { 31 | return this.tenantId; 32 | } 33 | 34 | public void setTenantId(String tenantId) { 35 | this.tenantId = tenantId; 36 | } 37 | 38 | public String getUsername() { 39 | return this.username; 40 | } 41 | 42 | public void setUsername(String username) { 43 | this.username = username; 44 | } 45 | 46 | public String getPassword() { 47 | return this.password; 48 | } 49 | 50 | public void setPassword(String password) { 51 | this.password = password; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/application/command/RemoveUserFromGroupCommand.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.identity.application.command; 16 | 17 | public class RemoveUserFromGroupCommand { 18 | 19 | private String tenantId; 20 | private String groupName; 21 | private String username; 22 | 23 | public RemoveUserFromGroupCommand(String tenantId, String groupName, String username) { 24 | super(); 25 | 26 | this.tenantId = tenantId; 27 | this.groupName = groupName; 28 | this.username = username; 29 | } 30 | 31 | public String getGroupName() { 32 | return groupName; 33 | } 34 | 35 | public void setGroupName(String groupName) { 36 | this.groupName = groupName; 37 | } 38 | 39 | public String getTenantId() { 40 | return tenantId; 41 | } 42 | 43 | public void setTenantId(String tenantId) { 44 | this.tenantId = tenantId; 45 | } 46 | 47 | public String getUsername() { 48 | return username; 49 | } 50 | 51 | public void setUsername(String username) { 52 | this.username = username; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/infra/repo/HibernateGroupRepo.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.infra.repo; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Component; 5 | 6 | import java.util.Collection; 7 | 8 | import javax.persistence.EntityManager; 9 | 10 | import top.zhacker.ddd.identity.domain.group.Group; 11 | import top.zhacker.ddd.identity.domain.group.GroupRepo; 12 | import top.zhacker.ddd.identity.domain.tenant.TenantId; 13 | 14 | 15 | /** 16 | * Created by zhacker. 17 | * Time 2018/6/30 下午4:51 18 | */ 19 | @Component 20 | public class HibernateGroupRepo implements GroupRepo { 21 | 22 | @Autowired 23 | private EntityManager entityManager; 24 | 25 | 26 | @Override 27 | public void add(Group group) { 28 | entityManager.persist(group); 29 | } 30 | 31 | 32 | @Override 33 | public Collection allGroups(TenantId tenantId) { 34 | return entityManager.createQuery( 35 | "select g from top.zhacker.ddd.identity.domain.group.Group g where g.tenantId = :tenantId", 36 | Group.class) 37 | .setParameter("tenantId", tenantId) 38 | .getResultList(); 39 | } 40 | 41 | 42 | @Override 43 | public Group groupNamed(TenantId tenantId, String name) { 44 | return entityManager.createQuery( 45 | "select g from top.zhacker.ddd.identity.domain.group.Group g where g.tenantId = :tenantId and g.name = :name", Group.class) 46 | .setParameter("tenantId", tenantId) 47 | .setParameter("name", name) 48 | .getResultList() 49 | .stream() 50 | .findFirst() 51 | .orElse(null); 52 | } 53 | 54 | 55 | @Override 56 | public void remove(Group group) { 57 | entityManager.remove(group); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/port/message/listener/TeamMemberDisableListener.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.port.message.listener; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.cloud.stream.annotation.StreamListener; 5 | import org.springframework.stereotype.Component; 6 | import top.zhacker.ddd.agilepm.application.member.MemberApplicationService; 7 | import top.zhacker.ddd.agilepm.application.member.command.DisableProductOwnerCommand; 8 | import top.zhacker.ddd.agilepm.application.member.command.DisableTeamMemberCommand; 9 | import top.zhacker.ddd.agilepm.port.message.dto.UserUnassignedFromRole; 10 | 11 | 12 | /** 13 | * Created by zhacker. 14 | * Time 2018/6/18 下午3:57 15 | */ 16 | @Component 17 | public class TeamMemberDisableListener { 18 | 19 | @Autowired 20 | private MemberApplicationService memberApplicationService; 21 | 22 | @StreamListener(ListeningChannels.UserUnassignedFromRole) 23 | public void process(UserUnassignedFromRole event){ 24 | if(event.getRoleName().equals("ScrumProductOwner")){ 25 | memberApplicationService.disableProductOwner( 26 | (DisableProductOwnerCommand) 27 | new DisableProductOwnerCommand() 28 | .setTenantId(event.getTenantId().getId()) 29 | .setUsername(event.getUsername()) 30 | .setOccurredOn(event.getOccurredOn()) 31 | ); 32 | }else if(event.getRoleName().equals("ScrumTeamMember")){ 33 | memberApplicationService.disableTeamMember( 34 | (DisableTeamMemberCommand) 35 | new DisableTeamMemberCommand() 36 | .setTenantId(event.getTenantId().getId()) 37 | .setUsername(event.getUsername()) 38 | .setOccurredOn(event.getOccurredOn()) 39 | ); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/domain/calendar/entry/RepeatType.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.collaboration.domain.calendar.entry; 16 | 17 | public enum RepeatType { 18 | 19 | DoesNotRepeat { 20 | public boolean isDoesNotRepeat() { 21 | return true; 22 | } 23 | }, 24 | 25 | Daily { 26 | public boolean isDaily() { 27 | return true; 28 | } 29 | }, 30 | 31 | Weekly { 32 | public boolean isWeekly() { 33 | return true; 34 | } 35 | }, 36 | 37 | Monthy { 38 | public boolean isMonthly() { 39 | return true; 40 | } 41 | }, 42 | 43 | Yearly { 44 | public boolean isYearly() { 45 | return true; 46 | } 47 | }; 48 | 49 | public boolean isDaily() { 50 | return false; 51 | } 52 | 53 | public boolean isDoesNotRepeat() { 54 | return false; 55 | } 56 | 57 | public boolean isMonthly() { 58 | return false; 59 | } 60 | 61 | public boolean isWeekly() { 62 | return false; 63 | } 64 | 65 | public boolean isYearly() { 66 | return false; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | spring: 2 | profiles: 3 | active: local 4 | application: 5 | name: identity-access 6 | jpa: 7 | show-sql: true 8 | database: mysql 9 | sleuth: 10 | sampler: 11 | percentage: 1.0 12 | 13 | # spring.jpa.hibernate.ddl-auto: update 14 | #event.store: spring-jdbc 15 | #event.publish.tracker: spring-jdbc 16 | 17 | app.name: identity-access 18 | 19 | eureka: 20 | instance: 21 | prefer-ip-address: true 22 | client: 23 | registerWithEureka: true 24 | fetchRegistry: true 25 | 26 | swagger.basePackage: top.zhacker.ddd.identity.api 27 | 28 | server: 29 | port: 8081 30 | 31 | #debug: true 32 | management: 33 | security: 34 | enabled: false 35 | endpoints: 36 | web: 37 | exposure: 38 | include: '*' 39 | 40 | 41 | --- 42 | spring.profiles: local 43 | 44 | spring.datasource.url: jdbc:mysql://127.0.0.1:3306/iddd_iam?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowMultiQueries=true 45 | spring.datasource.username: root 46 | spring.datasource.password: anywhere 47 | 48 | #spring: 49 | # rabbitmq: 50 | # host: 127.0.0.1 51 | 52 | #eureka: 53 | # client: 54 | # service-url: 55 | # defaultZone: http://localhost:8761/eureka/ 56 | 57 | spring: 58 | kafka: 59 | bootstrap-servers: mq.host:9092 60 | 61 | 62 | --- 63 | spring.profiles: ecs 64 | 65 | spring.datasource.url: jdbc:mysql://data.host:3306/iddd_iam?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowMultiQueries=true 66 | spring.datasource.username: root 67 | spring.datasource.password: anywhere 68 | 69 | #spring: 70 | # rabbitmq: 71 | # host: mq.host 72 | 73 | spring.cloud.stream.kafka.binder.zkNodes: data.host 74 | spring.cloud.stream.kafka.binder.brokers: mq.host 75 | 76 | eureka: 77 | client: 78 | service-url: 79 | defaultZone: http://data.host:8761/eureka/ -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/port/message/listener/TeamMemberEnablerListener.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.port.message.listener; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.cloud.stream.annotation.StreamListener; 5 | import org.springframework.stereotype.Component; 6 | import top.zhacker.ddd.agilepm.application.member.MemberApplicationService; 7 | import top.zhacker.ddd.agilepm.application.member.command.EnableProductOwnerCommand; 8 | import top.zhacker.ddd.agilepm.application.member.command.EnableTeamMemberCommand; 9 | import top.zhacker.ddd.agilepm.port.message.dto.UserAssignedToRole; 10 | 11 | 12 | /** 13 | * Created by zhacker. 14 | * Time 2018/6/18 下午3:58 15 | */ 16 | @Component 17 | public class TeamMemberEnablerListener { 18 | 19 | @Autowired 20 | private MemberApplicationService memberApplicationService; 21 | 22 | @StreamListener(ListeningChannels.UserAssignedToRole) 23 | public void process(UserAssignedToRole event){ 24 | 25 | if (event.getRoleName().equals("ScrumProductOwner")) { 26 | this.memberApplicationService.enableProductOwner( 27 | new EnableProductOwnerCommand( 28 | event.getTenantId().getId(), 29 | event.getUsername(), 30 | event.getFirstName(), 31 | event.getLastName(), 32 | event.getEmailAddress(), 33 | event.getOccurredOn())); 34 | } else if(event.getRoleName().equals("ScrumTeamMember")){ 35 | this.memberApplicationService.enableTeamMember( 36 | new EnableTeamMemberCommand( 37 | event.getTenantId().getId(), 38 | event.getUsername(), 39 | event.getFirstName(), 40 | event.getLastName(), 41 | event.getEmailAddress(), 42 | event.getOccurredOn())); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/application/command/AssignUserToRoleCommand.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.identity.application.command; 16 | 17 | public class AssignUserToRoleCommand { 18 | 19 | private String tenantId; 20 | private String username; 21 | private String roleName; 22 | 23 | public AssignUserToRoleCommand(String tenantId, String username, String roleName) { 24 | super(); 25 | 26 | this.tenantId = tenantId; 27 | this.username = username; 28 | this.roleName = roleName; 29 | } 30 | 31 | public AssignUserToRoleCommand() { 32 | super(); 33 | } 34 | 35 | public String getTenantId() { 36 | return this.tenantId; 37 | } 38 | 39 | public void setTenantId(String tenantId) { 40 | this.tenantId = tenantId; 41 | } 42 | 43 | public String getUsername() { 44 | return this.username; 45 | } 46 | 47 | public void setUsername(String username) { 48 | this.username = username; 49 | } 50 | 51 | public String getRoleName() { 52 | return this.roleName; 53 | } 54 | 55 | public void setRoleName(String roleName) { 56 | this.roleName = roleName; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/domain/product/blacklogitem/BacklogItemType.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.agilepm.domain.product.blacklogitem; 16 | 17 | public enum BacklogItemType { 18 | 19 | FEATURE { 20 | public boolean isFeature() { 21 | return true; 22 | } 23 | }, 24 | 25 | ENHANCEMENT { 26 | public boolean isEnhancement() { 27 | return true; 28 | } 29 | }, 30 | 31 | DEFECT { 32 | public boolean isDefect() { 33 | return true; 34 | } 35 | }, 36 | 37 | FOUNDATION { 38 | public boolean isFoundation() { 39 | return true; 40 | } 41 | }, 42 | 43 | INTEGRATION { 44 | public boolean isIntegration() { 45 | return true; 46 | } 47 | }; 48 | 49 | public boolean isDefect() { 50 | return false; 51 | } 52 | 53 | public boolean isEnhancement() { 54 | return false; 55 | } 56 | 57 | public boolean isFeature() { 58 | return false; 59 | } 60 | 61 | public boolean isFoundation() { 62 | return false; 63 | } 64 | 65 | public boolean isIntegration() { 66 | return false; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/domain/discussion/DiscussionAvailability.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.agilepm.domain.discussion; 16 | 17 | public enum DiscussionAvailability { 18 | 19 | ADD_ON_NOT_ENABLED { 20 | public boolean isAddOnNotAvailable() { 21 | return true; 22 | } 23 | }, 24 | 25 | FAILED { 26 | public boolean isFailed() { 27 | return true; 28 | } 29 | }, 30 | 31 | NOT_REQUESTED { 32 | public boolean isNotRequested() { 33 | return true; 34 | } 35 | }, 36 | 37 | REQUESTED { 38 | public boolean isRequested() { 39 | return true; 40 | } 41 | }, 42 | 43 | READY { 44 | public boolean isReady() { 45 | return true; 46 | } 47 | }; 48 | 49 | public boolean isAddOnNotAvailable() { 50 | return false; 51 | } 52 | 53 | public boolean isFailed() { 54 | return false; 55 | } 56 | 57 | public boolean isNotRequested() { 58 | return false; 59 | } 60 | 61 | public boolean isReady() { 62 | return false; 63 | } 64 | 65 | public boolean isRequested() { 66 | return false; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/application/command/UnassignUserFromRoleCommand.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.identity.application.command; 16 | 17 | public class UnassignUserFromRoleCommand { 18 | 19 | private String tenantId; 20 | private String username; 21 | private String roleName; 22 | 23 | public UnassignUserFromRoleCommand(String tenantId, String username, String roleName) { 24 | super(); 25 | 26 | this.tenantId = tenantId; 27 | this.username = username; 28 | this.roleName = roleName; 29 | } 30 | 31 | public UnassignUserFromRoleCommand() { 32 | super(); 33 | } 34 | 35 | public String getTenantId() { 36 | return this.tenantId; 37 | } 38 | 39 | public void setTenantId(String tenantId) { 40 | this.tenantId = tenantId; 41 | } 42 | 43 | public String getUsername() { 44 | return this.username; 45 | } 46 | 47 | public void setUsername(String username) { 48 | this.username = username; 49 | } 50 | 51 | public String getRoleName() { 52 | return this.roleName; 53 | } 54 | 55 | public void setRoleName(String roleName) { 56 | this.roleName = roleName; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/application/command/AddGroupToGroupCommand.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.identity.application.command; 16 | 17 | public class AddGroupToGroupCommand { 18 | 19 | private String tenantId; 20 | private String childGroupName; 21 | private String parentGroupName; 22 | 23 | public AddGroupToGroupCommand(String tenantId, String parentGroupName, String childGroupName) { 24 | super(); 25 | 26 | this.tenantId = tenantId; 27 | this.parentGroupName = parentGroupName; 28 | this.childGroupName = childGroupName; 29 | } 30 | 31 | public String getTenantId() { 32 | return tenantId; 33 | } 34 | 35 | public void setTenantId(String tenantId) { 36 | this.tenantId = tenantId; 37 | } 38 | 39 | public String getChildGroupName() { 40 | return childGroupName; 41 | } 42 | 43 | public void setChildGroupName(String childGroupName) { 44 | this.childGroupName = childGroupName; 45 | } 46 | 47 | public String getParentGroupName() { 48 | return parentGroupName; 49 | } 50 | 51 | public void setParentGroupName(String parentGroupName) { 52 | this.parentGroupName = parentGroupName; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/application/command/ChangePrimaryTelephoneCommand.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.identity.application.command; 16 | 17 | public class ChangePrimaryTelephoneCommand { 18 | private String tenantId; 19 | private String username; 20 | private String telephone; 21 | 22 | public ChangePrimaryTelephoneCommand(String tenantId, String username, String telephone) { 23 | super(); 24 | 25 | this.tenantId = tenantId; 26 | this.username = username; 27 | this.telephone = telephone; 28 | } 29 | 30 | public ChangePrimaryTelephoneCommand() { 31 | super(); 32 | } 33 | 34 | public String getTenantId() { 35 | return this.tenantId; 36 | } 37 | 38 | public void setTenantId(String tenantId) { 39 | this.tenantId = tenantId; 40 | } 41 | 42 | public String getUsername() { 43 | return this.username; 44 | } 45 | 46 | public void setUsername(String username) { 47 | this.username = username; 48 | } 49 | 50 | public String getTelephone() { 51 | return this.telephone; 52 | } 53 | 54 | public void setTelephone(String telephone) { 55 | this.telephone = telephone; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/application/command/ChangeSecondaryTelephoneCommand.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.identity.application.command; 16 | 17 | public class ChangeSecondaryTelephoneCommand { 18 | private String tenantId; 19 | private String username; 20 | private String telephone; 21 | 22 | public ChangeSecondaryTelephoneCommand(String tenantId, String username, String telephone) { 23 | super(); 24 | 25 | this.tenantId = tenantId; 26 | this.username = username; 27 | this.telephone = telephone; 28 | } 29 | 30 | public ChangeSecondaryTelephoneCommand() { 31 | super(); 32 | } 33 | 34 | public String getTenantId() { 35 | return this.tenantId; 36 | } 37 | 38 | public void setTenantId(String tenantId) { 39 | this.tenantId = tenantId; 40 | } 41 | 42 | public String getUsername() { 43 | return this.username; 44 | } 45 | 46 | public void setUsername(String username) { 47 | this.username = username; 48 | } 49 | 50 | public String getTelephone() { 51 | return this.telephone; 52 | } 53 | 54 | public void setTelephone(String telephone) { 55 | this.telephone = telephone; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/application/command/ChangeEmailAddressCommand.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.identity.application.command; 16 | 17 | public class ChangeEmailAddressCommand { 18 | private String tenantId; 19 | private String username; 20 | private String emailAddress; 21 | 22 | public ChangeEmailAddressCommand(String tenantId, String username, String emailAddress) { 23 | super(); 24 | 25 | this.tenantId = tenantId; 26 | this.username = username; 27 | this.emailAddress = emailAddress; 28 | } 29 | 30 | public ChangeEmailAddressCommand() { 31 | super(); 32 | } 33 | 34 | public String getTenantId() { 35 | return this.tenantId; 36 | } 37 | 38 | public void setTenantId(String tenantId) { 39 | this.tenantId = tenantId; 40 | } 41 | 42 | public String getUsername() { 43 | return this.username; 44 | } 45 | 46 | public void setUsername(String username) { 47 | this.username = username; 48 | } 49 | 50 | public String getEmailAddress() { 51 | return this.emailAddress; 52 | } 53 | 54 | public void setEmailAddress(String emailAddress) { 55 | this.emailAddress = emailAddress; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/port/message/listener/ListeningChannels.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.agilepm.port.message.listener; 2 | 3 | import org.springframework.cloud.stream.annotation.Input; 4 | import org.springframework.messaging.SubscribableChannel; 5 | 6 | 7 | /** 8 | * Created by zhacker. 9 | * Time 2018/7/15 下午2:40 10 | */ 11 | public interface ListeningChannels { 12 | 13 | String BacklogItemCommitted = "top.zhacker.ddd.agilepm.domain.product.blacklogitem.event.BacklogItemCommitted"; 14 | 15 | @Input(BacklogItemCommitted) 16 | SubscribableChannel backlogItemCommitted(); 17 | 18 | String BacklogItemScheduled = "top.zhacker.ddd.agilepm.domain.product.blacklogitem.event.BacklogItemScheduled"; 19 | 20 | @Input(BacklogItemScheduled) 21 | SubscribableChannel backlogItemScheduled(); 22 | 23 | 24 | String ProductBacklogItemPlanned = "top.zhacker.ddd.agilepm.domain.product.event.ProductBacklogItemPlanned"; 25 | 26 | @Input(ProductBacklogItemPlanned) 27 | SubscribableChannel productBacklogItemPlanned(); 28 | 29 | 30 | String UserAssignedToRole = "top.zhacker.ddd.identity.domain.role.event.UserAssignedToRole"; 31 | 32 | @Input(UserAssignedToRole) 33 | SubscribableChannel userAssignedToRole(); 34 | 35 | String PersonNameChanged = "top.zhacker.ddd.identity.domain.user.person.event.PersonNameChanged"; 36 | 37 | @Input(PersonNameChanged) 38 | SubscribableChannel personNameChanged(); 39 | 40 | 41 | String PersonContactInformationChanged = "top.zhacker.ddd.identity.domain.user.person.event.PersonContactInformationChanged"; 42 | 43 | @Input(PersonContactInformationChanged) 44 | SubscribableChannel personContactInformationChanged(); 45 | 46 | String UserUnassignedFromRole = "top.zhacker.ddd.identity.domain.role.event.UserUnassignedFromRole"; 47 | 48 | @Input(UserUnassignedFromRole) 49 | SubscribableChannel userUnassignedFromRole(); 50 | } 51 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/application/command/RemoveGroupFromGroupCommand.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.identity.application.command; 16 | 17 | public class RemoveGroupFromGroupCommand { 18 | 19 | private String tenantId; 20 | private String childGroupName; 21 | private String parentGroupName; 22 | 23 | public RemoveGroupFromGroupCommand(String tenantId, String parentGroupName, String childGroupName) { 24 | super(); 25 | 26 | this.tenantId = tenantId; 27 | this.parentGroupName = parentGroupName; 28 | this.childGroupName = childGroupName; 29 | } 30 | 31 | public String getTenantId() { 32 | return tenantId; 33 | } 34 | 35 | public void setTenantId(String tenantId) { 36 | this.tenantId = tenantId; 37 | } 38 | 39 | public String getChildGroupName() { 40 | return childGroupName; 41 | } 42 | 43 | public void setChildGroupName(String childGroupName) { 44 | this.childGroupName = childGroupName; 45 | } 46 | 47 | public String getParentGroupName() { 48 | return parentGroupName; 49 | } 50 | 51 | public void setParentGroupName(String parentGroupName) { 52 | this.parentGroupName = parentGroupName; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/domain/tenant/invitation/InvitationDescriptor.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.domain.tenant.invitation; 2 | 3 | import java.util.Date; 4 | 5 | import lombok.Getter; 6 | import top.zhacker.ddd.identity.domain.tenant.TenantId; 7 | 8 | 9 | /** 10 | * Created by zhacker. 11 | * Time 2018/6/13 上午10:52 12 | */ 13 | @Getter 14 | public class InvitationDescriptor { 15 | private String description; 16 | private String invitationId; 17 | private Date startingOn; 18 | private TenantId tenantId; 19 | private Date until; 20 | 21 | 22 | public InvitationDescriptor( 23 | TenantId aTenantId, 24 | String anInvitationId, 25 | String aDescription, 26 | Date aStartingOn, 27 | Date anUntil) { 28 | 29 | super(); 30 | 31 | this.setDescription(aDescription); 32 | this.setInvitationId(anInvitationId); 33 | this.setStartingOn(aStartingOn); 34 | this.setTenantId(aTenantId); 35 | this.setUntil(anUntil); 36 | } 37 | 38 | public InvitationDescriptor(InvitationDescriptor anInvitationDescriptor) { 39 | this(anInvitationDescriptor.getTenantId(), 40 | anInvitationDescriptor.getInvitationId(), 41 | anInvitationDescriptor.getDescription(), 42 | anInvitationDescriptor.getStartingOn(), 43 | anInvitationDescriptor.getUntil()); 44 | } 45 | 46 | 47 | public void setDescription(String description) { 48 | this.description = description; 49 | } 50 | 51 | 52 | public void setInvitationId(String invitationId) { 53 | this.invitationId = invitationId; 54 | } 55 | 56 | 57 | public void setStartingOn(Date startingOn) { 58 | this.startingOn = startingOn; 59 | } 60 | 61 | 62 | public void setTenantId(TenantId tenantId) { 63 | this.tenantId = tenantId; 64 | } 65 | 66 | 67 | public void setUntil(Date until) { 68 | this.until = until; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/application/command/ProvisionGroupCommand.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.identity.application.command; 16 | 17 | public class ProvisionGroupCommand { 18 | 19 | private String description; 20 | private String groupName; 21 | private String tenantId; 22 | 23 | public ProvisionGroupCommand( 24 | String tenantId, 25 | String groupName, 26 | String description) { 27 | 28 | super(); 29 | 30 | this.description = description; 31 | this.groupName = groupName; 32 | this.tenantId = tenantId; 33 | } 34 | 35 | public ProvisionGroupCommand() { 36 | super(); 37 | } 38 | 39 | public String getDescription() { 40 | return description; 41 | } 42 | 43 | public void setDescription(String description) { 44 | this.description = description; 45 | } 46 | 47 | public String getGroupName() { 48 | return groupName; 49 | } 50 | 51 | public void setGroupName(String groupName) { 52 | this.groupName = groupName; 53 | } 54 | 55 | public String getTenantId() { 56 | return this.tenantId; 57 | } 58 | 59 | public void setTenantId(String tenantId) { 60 | this.tenantId = tenantId; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/infra/repo/HibernateRoleRepo.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.infra.repo; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Component; 5 | 6 | import java.util.Collection; 7 | import java.util.HashMap; 8 | import java.util.Map; 9 | 10 | import javax.persistence.EntityManager; 11 | import javax.persistence.TypedQuery; 12 | 13 | import top.zhacker.ddd.identity.domain.role.Role; 14 | import top.zhacker.ddd.identity.domain.role.RoleRepo; 15 | import top.zhacker.ddd.identity.domain.tenant.TenantId; 16 | 17 | 18 | /** 19 | * Created by zhacker. 20 | * Time 2018/6/13 上午11:30 21 | */ 22 | @Component 23 | public class HibernateRoleRepo implements RoleRepo { 24 | 25 | @Autowired 26 | private EntityManager entityManager; 27 | 28 | @Override 29 | public void add(Role role) { 30 | entityManager.persist(role); 31 | } 32 | 33 | 34 | @Override 35 | public Collection allRoles(TenantId tenantId) { 36 | TypedQuery query = entityManager.createQuery( 37 | "select role from top.zhacker.ddd.identity.domain.role.Role role where role.tenantId = :tenantId", 38 | Role.class); 39 | query.setParameter("tenantId", tenantId); 40 | return query.getResultList(); 41 | } 42 | 43 | 44 | @Override 45 | public void remove(Role role) { 46 | entityManager.remove(role); 47 | } 48 | 49 | 50 | @Override 51 | public Role roleNamed(TenantId tenantId, String roleName) { 52 | 53 | return entityManager.createQuery( 54 | "select role from top.zhacker.ddd.identity.domain.role.Role role " + 55 | "where role.tenantId = :tenantId and role.name = :name", 56 | Role.class 57 | ).setParameter("tenantId", tenantId) 58 | .setParameter("name", roleName) 59 | .getResultList() 60 | .stream() 61 | .findFirst() 62 | .orElse(null); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/domain/discussion/DiscussionDescriptor.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.agilepm.domain.discussion; 16 | 17 | 18 | import lombok.EqualsAndHashCode; 19 | import lombok.Getter; 20 | import lombok.ToString; 21 | import top.zhacker.core.model.ValueObject; 22 | 23 | @ToString 24 | @EqualsAndHashCode(callSuper = false) 25 | public class DiscussionDescriptor extends ValueObject { 26 | 27 | public static final String UNDEFINED_ID = "UNDEFINED"; 28 | 29 | @Getter 30 | private String id; 31 | 32 | private DiscussionDescriptor() { 33 | super(); 34 | } 35 | 36 | 37 | public DiscussionDescriptor(String anId) { 38 | this(); 39 | 40 | this.setId(anId); 41 | } 42 | 43 | public DiscussionDescriptor(DiscussionDescriptor aDiscussionDescriptor) { 44 | this(aDiscussionDescriptor.getId()); 45 | } 46 | 47 | 48 | public boolean isUndefined() { 49 | return this.getId().equals(UNDEFINED_ID); 50 | } 51 | 52 | 53 | private void setId(String anId) { 54 | this.assertArgumentNotEmpty(anId, "The discussion identity must be provided."); 55 | this.assertArgumentLength(anId, 36, "The discussion identity must be 36 characters or less."); 56 | 57 | this.id = anId; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/domain/forum/event/ForumSubjectChanged.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.collaboration.domain.forum.event; 16 | 17 | 18 | import top.zhacker.core.model.BaseDomainEvent; 19 | import top.zhacker.ddd.collaboration.domain.forum.ForumId; 20 | import top.zhacker.ddd.collaboration.domain.tenant.Tenant; 21 | 22 | 23 | public class ForumSubjectChanged extends BaseDomainEvent { 24 | 25 | private String exclusiveOwner; 26 | private ForumId forumId; 27 | private String subject; 28 | private Tenant tenant; 29 | 30 | public ForumSubjectChanged( 31 | Tenant aTenant, 32 | ForumId aForumId, 33 | String aSubject, 34 | String anExclusiveOwner) { 35 | 36 | super(); 37 | 38 | this.eventVersion = 1; 39 | this.exclusiveOwner = anExclusiveOwner; 40 | this.forumId = aForumId; 41 | this.subject = aSubject; 42 | this.tenant = aTenant; 43 | } 44 | 45 | public String exclusiveOwner() { 46 | return this.exclusiveOwner; 47 | } 48 | 49 | public ForumId forumId() { 50 | return this.forumId; 51 | } 52 | 53 | public String subject() { 54 | return this.subject; 55 | } 56 | 57 | public Tenant tenant() { 58 | return this.tenant; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/application/PostQueryService.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.collaboration.application; 16 | 17 | import org.springframework.beans.factory.annotation.Autowired; 18 | import org.springframework.stereotype.Service; 19 | import top.zhacker.ddd.collaboration.application.vo.PostData; 20 | 21 | import javax.sql.DataSource; 22 | import java.util.Collection; 23 | 24 | @Service 25 | public class PostQueryService extends AbstractQueryService { 26 | 27 | @Autowired 28 | public PostQueryService(DataSource aDataSource) { 29 | super(aDataSource); 30 | } 31 | 32 | public Collection allPostsDataOfDiscussion(String aTenantId, String aDiscussionId) { 33 | return this.queryObjects( 34 | PostData.class, 35 | "select * from tbl_vw_post where tenant_id = ? and discussion_id = ?", 36 | new JoinOn(), 37 | aTenantId, 38 | aDiscussionId); 39 | } 40 | 41 | public PostData postDataOfId(String aTenantId, String aPostId) { 42 | return this.queryObject( 43 | PostData.class, 44 | "select * from tbl_vw_post where tenant_id = ? and post_id = ?", 45 | new JoinOn(), 46 | aTenantId, 47 | aPostId); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/IdentityConfig.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.springframework.boot.CommandLineRunner; 5 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.context.annotation.EnableAspectJAutoProxy; 9 | import org.springframework.scheduling.annotation.EnableScheduling; 10 | import top.zhacker.boot.event.notification.publisher.CloudNotificationPublisher; 11 | import top.zhacker.boot.event.notification.publisher.NotificationPublisher; 12 | 13 | /** 14 | * Created by zhacker. 15 | * Time 2018/11/12 下午1:32 16 | */ 17 | @Slf4j 18 | @Configuration 19 | @EnableDiscoveryClient 20 | @EnableAspectJAutoProxy 21 | @EnableScheduling 22 | public class IdentityConfig implements CommandLineRunner { 23 | 24 | @Override 25 | public void run(String... strings) throws Exception { 26 | // Config config = ConfigService.getAppConfig(); //config instance is singleton for each namespace and is never null 27 | // config.addChangeListener(new ConfigChangeListener() { 28 | // @Override 29 | // public void onChange(ConfigChangeEvent changeEvent) { 30 | // log.info("Changes for namespace " + changeEvent.getNamespace()); 31 | // for (String key : changeEvent.changedKeys()) { 32 | // ConfigChange change = changeEvent.getChange(key); 33 | // log.info(String.format("Found change - key: %s, oldValue: %s, newValue: %s, changeType: %s", change.getPropertyName(), change.getOldValue(), change.getNewValue(), change.getChangeType())); 34 | // } 35 | // } 36 | // }); 37 | } 38 | 39 | 40 | @Bean 41 | public NotificationPublisher notificationPublisher(){ 42 | return new CloudNotificationPublisher(); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/application/NotificationApplicationService.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.identity.application; 16 | 17 | 18 | import org.springframework.beans.factory.annotation.Autowired; 19 | import org.springframework.stereotype.Service; 20 | 21 | import top.zhacker.boot.event.notification.NotificationLog; 22 | import top.zhacker.boot.event.notification.NotificationLogFactory; 23 | import top.zhacker.boot.event.notification.NotificationLogId; 24 | import top.zhacker.boot.event.store.EventStore; 25 | 26 | 27 | @Service 28 | public class NotificationApplicationService { 29 | 30 | @Autowired 31 | private EventStore eventStore; 32 | 33 | 34 | public NotificationApplicationService() { 35 | super(); 36 | } 37 | 38 | // @Transactional(readOnly=true) 39 | public NotificationLog currentNotificationLog() { 40 | NotificationLogFactory factory = new NotificationLogFactory(this.eventStore); 41 | 42 | return factory.createCurrentNotificationLog(); 43 | } 44 | 45 | // @Transactional(readOnly=true) 46 | public NotificationLog notificationLog(String aNotificationLogId) { 47 | NotificationLogFactory factory = new NotificationLogFactory(this.eventStore); 48 | 49 | return factory.createNotificationLog(new NotificationLogId(aNotificationLogId)); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/domain/forum/event/ForumDescriptionChanged.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.collaboration.domain.forum.event; 16 | 17 | 18 | import top.zhacker.core.model.BaseDomainEvent; 19 | import top.zhacker.ddd.collaboration.domain.forum.ForumId; 20 | import top.zhacker.ddd.collaboration.domain.tenant.Tenant; 21 | 22 | 23 | public class ForumDescriptionChanged extends BaseDomainEvent { 24 | 25 | private String description; 26 | private String exclusiveOwner; 27 | private ForumId forumId; 28 | private Tenant tenant; 29 | 30 | public ForumDescriptionChanged( 31 | Tenant aTenant, 32 | ForumId aForumId, 33 | String aDescription, 34 | String anExclusiveOwner) { 35 | 36 | super(); 37 | 38 | this.description = aDescription; 39 | this.eventVersion = 1; 40 | this.exclusiveOwner = anExclusiveOwner; 41 | this.forumId = aForumId; 42 | this.tenant = aTenant; 43 | } 44 | 45 | public String description() { 46 | return this.description; 47 | } 48 | 49 | public String exclusiveOwner() { 50 | return this.exclusiveOwner; 51 | } 52 | 53 | public ForumId forumId() { 54 | return this.forumId; 55 | } 56 | 57 | public Tenant tenant() { 58 | return this.tenant; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/domain/product/blacklogitem/StoryPoints.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.agilepm.domain.product.blacklogitem; 16 | 17 | public enum StoryPoints { 18 | 19 | ZERO { 20 | public int pointValue() { 21 | return 0; 22 | } 23 | }, 24 | 25 | ONE { 26 | public int pointValue() { 27 | return 1; 28 | } 29 | }, 30 | 31 | TWO { 32 | public int pointValue() { 33 | return 2; 34 | } 35 | }, 36 | 37 | THREE { 38 | public int pointValue() { 39 | return 3; 40 | } 41 | }, 42 | 43 | FIVE { 44 | public int pointValue() { 45 | return 5; 46 | } 47 | }, 48 | 49 | EIGHT { 50 | public int pointValue() { 51 | return 8; 52 | } 53 | }, 54 | 55 | THIRTEEN { 56 | public int pointValue() { 57 | return 13; 58 | } 59 | }, 60 | 61 | TWENTY { 62 | public int pointValue() { 63 | return 20; 64 | } 65 | }, 66 | 67 | FORTY { 68 | public int pointValue() { 69 | return 40; 70 | } 71 | }, 72 | 73 | ONE_HUNDRED { 74 | public int pointValue() { 75 | return 100; 76 | } 77 | }; 78 | 79 | public abstract int pointValue(); 80 | } 81 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/domain/group/GroupMember.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.domain.group; 2 | 3 | import org.hibernate.validator.constraints.NotEmpty; 4 | 5 | import javax.validation.constraints.NotNull; 6 | import javax.validation.constraints.Size; 7 | 8 | import lombok.AccessLevel; 9 | import lombok.EqualsAndHashCode; 10 | import lombok.Getter; 11 | import lombok.NoArgsConstructor; 12 | import lombok.ToString; 13 | import top.zhacker.core.model.IdentifiedEntity; 14 | import top.zhacker.core.model.IdentifiedValueObject; 15 | import top.zhacker.ddd.identity.domain.tenant.TenantId; 16 | 17 | 18 | /** 19 | * Created by zhacker. 20 | * Time 2018/6/30 下午1:53 21 | */ 22 | @Getter 23 | @EqualsAndHashCode(callSuper = false) 24 | @ToString 25 | @NoArgsConstructor(access = AccessLevel.PROTECTED) 26 | public class GroupMember extends IdentifiedValueObject { 27 | 28 | @NotNull(message = "The tenantId must be provided.") 29 | private TenantId tenantId; 30 | 31 | @NotEmpty(message = "Member name is required.") 32 | @Size(min = 1, max = 100, message = "Member name must be 100 characters or less.") 33 | private String name; 34 | 35 | @NotNull(message = "The type must be provided.") 36 | private GroupMemberType type; 37 | 38 | 39 | public GroupMember(TenantId tenantId, String name, GroupMemberType type) { 40 | this(); 41 | this.tenantId = tenantId; 42 | this.name = name; 43 | this.type = type; 44 | validate(); 45 | } 46 | 47 | protected void setTenantId(TenantId tenantId) { 48 | validate("tenantId"); 49 | this.tenantId = tenantId; 50 | } 51 | 52 | protected void setName(String name) { 53 | validate("name"); 54 | this.name = name; 55 | } 56 | 57 | protected void setType(GroupMemberType type) { 58 | validate("type"); 59 | this.type = type; 60 | } 61 | 62 | public boolean isGroup(){ 63 | return this.type.isGroup(); 64 | } 65 | 66 | public boolean isUser(){ 67 | return this.type.isUser(); 68 | } 69 | 70 | 71 | } 72 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/domain/product/blacklogitem/BacklogItemRepository.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.agilepm.domain.product.blacklogitem; 16 | 17 | import top.zhacker.ddd.agilepm.domain.product.ProductId; 18 | import top.zhacker.ddd.agilepm.domain.product.release.ReleaseId; 19 | import top.zhacker.ddd.agilepm.domain.product.sprint.SprintId; 20 | import top.zhacker.ddd.agilepm.domain.tenant.TenantId; 21 | 22 | import java.util.Collection; 23 | 24 | 25 | public interface BacklogItemRepository { 26 | 27 | public Collection allBacklogItemsComittedTo(TenantId aTenantId, SprintId aSprintId); 28 | 29 | public Collection allBacklogItemsScheduledFor(TenantId aTenantId, ReleaseId aReleaseId); 30 | 31 | public Collection allOutstandingProductBacklogItems(TenantId aTenantId, ProductId aProductId); 32 | 33 | public Collection allProductBacklogItems(TenantId aTenantId, ProductId aProductId); 34 | 35 | public BacklogItem backlogItemOfId(TenantId aTenantId, BacklogItemId aBacklogItemId); 36 | 37 | public BacklogItemId nextIdentity(); 38 | 39 | public void remove(BacklogItem aBacklogItem); 40 | 41 | public void removeAll(Collection aBacklogItemCollection); 42 | 43 | public void save(BacklogItem aBacklogItem); 44 | 45 | public void saveAll(Collection aBacklogItemCollection); 46 | } 47 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-collaboration/src/main/java/top/zhacker/ddd/collaboration/domain/forum/event/ForumModeratorChanged.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.collaboration.domain.forum.event; 16 | 17 | 18 | import top.zhacker.core.model.BaseDomainEvent; 19 | import top.zhacker.ddd.collaboration.domain.collaborator.Moderator; 20 | import top.zhacker.ddd.collaboration.domain.forum.ForumId; 21 | import top.zhacker.ddd.collaboration.domain.tenant.Tenant; 22 | 23 | 24 | public class ForumModeratorChanged extends BaseDomainEvent { 25 | 26 | private String exclusiveOwner; 27 | private ForumId forumId; 28 | private Moderator moderator; 29 | private Tenant tenant; 30 | 31 | public ForumModeratorChanged( 32 | Tenant aTenant, 33 | ForumId aForumId, 34 | Moderator aModerator, 35 | String anExclusiveOwner) { 36 | 37 | super(); 38 | 39 | this.eventVersion = 1; 40 | this.exclusiveOwner = anExclusiveOwner; 41 | this.forumId = aForumId; 42 | this.moderator = aModerator; 43 | this.tenant = aTenant; 44 | } 45 | 46 | public String exclusiveOwner() { 47 | return this.exclusiveOwner; 48 | } 49 | 50 | public ForumId forumId() { 51 | return this.forumId; 52 | } 53 | 54 | public Moderator moderator() { 55 | return this.moderator; 56 | } 57 | 58 | public Tenant tenant() { 59 | return this.tenant; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/domain/product/blacklogitem/event/BacklogItemMarkedAsRemoved.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.agilepm.domain.product.blacklogitem.event; 16 | 17 | import lombok.AccessLevel; 18 | import lombok.NoArgsConstructor; 19 | import top.zhacker.core.model.DomainEvent; 20 | import top.zhacker.ddd.agilepm.domain.product.blacklogitem.BacklogItemId; 21 | import top.zhacker.ddd.agilepm.domain.tenant.TenantId; 22 | 23 | import java.util.Date; 24 | 25 | @NoArgsConstructor(access = AccessLevel.PROTECTED) 26 | public class BacklogItemMarkedAsRemoved implements DomainEvent { 27 | 28 | private BacklogItemId backlogItemId; 29 | private int eventVersion; 30 | private Date occurredOn; 31 | private TenantId tenantId; 32 | 33 | public BacklogItemMarkedAsRemoved(TenantId aTenantId, BacklogItemId aBacklogItemId) { 34 | super(); 35 | 36 | this.backlogItemId = aBacklogItemId; 37 | this.eventVersion = 1; 38 | this.occurredOn = new Date(); 39 | this.tenantId = aTenantId; 40 | } 41 | 42 | public BacklogItemId backlogItemId() { 43 | return this.backlogItemId; 44 | } 45 | 46 | @Override 47 | public int eventVersion() { 48 | return this.eventVersion; 49 | } 50 | 51 | @Override 52 | public Date occurredOn() { 53 | return this.occurredOn; 54 | } 55 | 56 | public TenantId tenantId() { 57 | return this.tenantId; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/domain/role/AuthorizationService.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.domain.role; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Component; 5 | 6 | //import top.zhacker.core.model.AssertionConcern; 7 | import top.zhacker.core.model.AssertionConcern; 8 | import top.zhacker.ddd.identity.domain.group.GroupRepo; 9 | import top.zhacker.ddd.identity.domain.tenant.TenantId; 10 | import top.zhacker.ddd.identity.domain.user.User; 11 | import top.zhacker.ddd.identity.domain.user.UserRepo; 12 | 13 | 14 | /** 15 | * Created by zhacker. 16 | * Time 2018/6/30 下午5:45 17 | */ 18 | @Component 19 | public class AuthorizationService extends AssertionConcern { 20 | 21 | private GroupRepo groupRepo; 22 | private RoleRepo roleRepo; 23 | private UserRepo userRepo; 24 | 25 | @Autowired 26 | public AuthorizationService(GroupRepo groupRepo, RoleRepo roleRepo, UserRepo userRepo) { 27 | this.groupRepo = groupRepo; 28 | this.roleRepo = roleRepo; 29 | this.userRepo = userRepo; 30 | } 31 | 32 | public boolean isUserInRole(TenantId tenantId, String username, String roleName){ 33 | this.assertArgumentNotNull(tenantId, "TenantId must not be null."); 34 | this.assertArgumentNotEmpty(username, "Username must not be provided."); 35 | this.assertArgumentNotEmpty(roleName, "Role name must not be null."); 36 | 37 | User user = this.userRepo.userWithUsername(tenantId, username); 38 | 39 | return user == null ? false : this.isUserInRole(user, roleName); 40 | } 41 | 42 | public boolean isUserInRole(User user, String roleName){ 43 | this.assertArgumentNotNull(user, "User must not be null."); 44 | this.assertArgumentNotEmpty(roleName, "Role name must not be null."); 45 | 46 | boolean authorized = false; 47 | 48 | if (user.isEnabled()) { 49 | Role role = this.roleRepo.roleNamed(user.getTenantId(), roleName); 50 | 51 | if (role != null) { 52 | authorized = role.isInRole(user); 53 | } 54 | } 55 | 56 | return authorized; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/domain/user/person/EmailAddress.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.identity.domain.user.person; 16 | 17 | import java.io.Serializable; 18 | import java.util.regex.Pattern; 19 | 20 | import lombok.EqualsAndHashCode; 21 | import lombok.Getter; 22 | import lombok.ToString; 23 | import top.zhacker.core.model.AssertionConcern; 24 | 25 | 26 | @EqualsAndHashCode(callSuper = false) 27 | @ToString 28 | public final class EmailAddress extends AssertionConcern implements Serializable { 29 | 30 | private static final long serialVersionUID = 1L; 31 | 32 | @Getter 33 | private String address; 34 | 35 | public EmailAddress(String anAddress) { 36 | super(); 37 | 38 | this.setAddress(anAddress); 39 | } 40 | 41 | public EmailAddress(EmailAddress anEmailAddress) { 42 | this(anEmailAddress.getAddress()); 43 | } 44 | 45 | protected EmailAddress() { 46 | super(); 47 | } 48 | 49 | private void setAddress(String anAddress) { 50 | this.assertArgumentNotEmpty(anAddress, "The email address is required."); 51 | this.assertArgumentLength(anAddress, 1, 100, "Email address must be 100 characters or less."); 52 | this.assertArgumentTrue( 53 | Pattern.matches("\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*", anAddress), 54 | "Email address format is invalid."); 55 | 56 | this.address = anAddress; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/domain/product/blacklogitem/event/BacklogItemStoryTold.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.agilepm.domain.product.blacklogitem.event; 16 | 17 | import top.zhacker.core.model.DomainEvent; 18 | import top.zhacker.ddd.agilepm.domain.product.blacklogitem.BacklogItemId; 19 | import top.zhacker.ddd.agilepm.domain.tenant.TenantId; 20 | 21 | import java.util.Date; 22 | 23 | 24 | public class BacklogItemStoryTold implements DomainEvent { 25 | 26 | private BacklogItemId backlogItemId; 27 | private int eventVersion; 28 | private Date occurredOn; 29 | private String story; 30 | private TenantId tenantId; 31 | 32 | public BacklogItemStoryTold(TenantId aTenantId, BacklogItemId aBacklogItemId, String aStory) { 33 | super(); 34 | 35 | this.backlogItemId = aBacklogItemId; 36 | this.eventVersion = 1; 37 | this.occurredOn = new Date(); 38 | this.story = aStory; 39 | this.tenantId = aTenantId; 40 | } 41 | 42 | public BacklogItemId backlogItemId() { 43 | return this.backlogItemId; 44 | } 45 | 46 | @Override 47 | public int eventVersion() { 48 | return this.eventVersion; 49 | } 50 | 51 | @Override 52 | public Date occurredOn() { 53 | return this.occurredOn; 54 | } 55 | 56 | public String story() { 57 | return this.story; 58 | } 59 | 60 | public TenantId tenantId() { 61 | return this.tenantId; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-agilepm/src/main/java/top/zhacker/ddd/agilepm/domain/product/blacklogitem/event/BacklogItemSummarized.java: -------------------------------------------------------------------------------- 1 | // Copyright 2012,2013 Vaughn Vernon 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package top.zhacker.ddd.agilepm.domain.product.blacklogitem.event; 16 | 17 | import top.zhacker.core.model.DomainEvent; 18 | import top.zhacker.ddd.agilepm.domain.product.blacklogitem.BacklogItemId; 19 | import top.zhacker.ddd.agilepm.domain.tenant.TenantId; 20 | 21 | import java.util.Date; 22 | 23 | 24 | public class BacklogItemSummarized implements DomainEvent { 25 | 26 | private BacklogItemId backlogItemId; 27 | private int eventVersion; 28 | private Date occurredOn; 29 | private String summary; 30 | private TenantId tenantId; 31 | 32 | public BacklogItemSummarized(TenantId aTenantId, BacklogItemId aBacklogItemId, String aSummary) { 33 | super(); 34 | 35 | this.backlogItemId = aBacklogItemId; 36 | this.eventVersion = 1; 37 | this.occurredOn = new Date(); 38 | this.summary = aSummary; 39 | this.tenantId = aTenantId; 40 | } 41 | 42 | public BacklogItemId backlogItemId() { 43 | return this.backlogItemId; 44 | } 45 | 46 | @Override 47 | public int eventVersion() { 48 | return this.eventVersion; 49 | } 50 | 51 | @Override 52 | public Date occurredOn() { 53 | return this.occurredOn; 54 | } 55 | 56 | public String summary() { 57 | return this.summary; 58 | } 59 | 60 | public TenantId tenantId() { 61 | return this.tenantId; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /zhacker-sample-ovation-identityaccess/src/main/java/top/zhacker/ddd/identity/domain/user/AuthenticationService.java: -------------------------------------------------------------------------------- 1 | package top.zhacker.ddd.identity.domain.user; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Component; 5 | 6 | import top.zhacker.core.model.AssertionConcern; 7 | import top.zhacker.ddd.identity.domain.tenant.Tenant; 8 | import top.zhacker.ddd.identity.domain.tenant.TenantId; 9 | import top.zhacker.ddd.identity.domain.tenant.TenantRepo; 10 | 11 | 12 | /** 13 | * Created by zhacker. 14 | * Time 2018/6/30 下午10:32 15 | */ 16 | @Component 17 | public class AuthenticationService extends AssertionConcern { 18 | 19 | private EncryptionService encryptionService; 20 | private TenantRepo tenantRepo; 21 | private UserRepo userRepo; 22 | 23 | @Autowired 24 | public AuthenticationService(EncryptionService encryptionService, TenantRepo tenantRepo, UserRepo userRepo) { 25 | this.encryptionService = encryptionService; 26 | this.tenantRepo = tenantRepo; 27 | this.userRepo = userRepo; 28 | } 29 | 30 | public UserDescriptor authenticate( 31 | TenantId aTenantId, 32 | String aUsername, 33 | String aPassword) { 34 | 35 | this.assertArgumentNotNull(aTenantId, "TenantId must not be null."); 36 | this.assertArgumentNotEmpty(aUsername, "Username must be provided."); 37 | this.assertArgumentNotEmpty(aPassword, "Password must be provided."); 38 | 39 | UserDescriptor userDescriptor = UserDescriptor.nullDescriptorInstance(); 40 | 41 | Tenant tenant = this.tenantRepo.findByTenantId(aTenantId); 42 | 43 | if (tenant != null && tenant.isActive()) { 44 | String encryptedPassword = this.encryptionService.encryptedValue(aPassword); 45 | 46 | User user = 47 | this.userRepo 48 | .userFromAuthenticCredentials( 49 | aTenantId, 50 | aUsername, 51 | encryptedPassword); 52 | 53 | if (user != null && user.isEnabled()) { 54 | userDescriptor = user.userDescriptor(); 55 | } 56 | } 57 | 58 | return userDescriptor; 59 | } 60 | 61 | } 62 | --------------------------------------------------------------------------------