Skip to content

Commit

Permalink
cola3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fulan.zjf committed Jun 22, 2020
1 parent 57210b9 commit b2539d2
Show file tree
Hide file tree
Showing 16 changed files with 44 additions and 227 deletions.
2 changes: 1 addition & 1 deletion cola-archetype-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.alibaba.cola</groupId>
<artifactId>cola-framework-archetype-service</artifactId>
<version>2.0.0</version>
<version>3.0.0</version>
<packaging>maven-archetype</packaging>

<name>cola framework archetype</name>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package}.executor;

package ${package}.executor;

import com.alibaba.cola.command.Command;
import com.alibaba.cola.command.CommandExecutorI;
import com.alibaba.cola.domain.DomainEventServiceI;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.exception.BizException;
import ${package}.dto.CustomerAddCmd;
import ${package}.dto.domainmodel.ErrorCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


@Command
public class CustomerAddCmdExe implements CommandExecutorI<Response, CustomerAddCmd>{
@Component
public class CustomerAddCmdExe{

@Override
public Response execute(CustomerAddCmd cmd) {
//The flow of usecase is defined here.
//The core ablility should be implemented in Domain. or sink to Domian gradually
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@
#set( $symbol_escape = '\' )
package ${package}.executor.query;

import com.alibaba.cola.command.Command;
import com.alibaba.cola.command.QueryExecutorI;
import com.alibaba.cola.dto.MultiResponse;
import ${package}.dto.CustomerListByNameQry;
import ${package}.dto.domainmodel.Customer;
import java.util.ArrayList;
import java.util.List;
import org.springframework.stereotype.Component;

@Command
public class CustomerListByNameQryExe implements QueryExecutorI<MultiResponse<Customer>, CustomerListByNameQry> {

@Override
@Component
public class CustomerListByNameQryExe{

public MultiResponse<Customer> execute(CustomerListByNameQry cmd) {
List<Customer> customerList = new ArrayList<>();
Customer customer = new Customer();
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#set( $symbol_escape = '\' )
package ${package}.service;

import com.alibaba.cola.command.CommandBusI;
import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.Response;
import ${package}.api.CustomerServiceI;
Expand All @@ -13,21 +12,28 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import ${package}.executor.CustomerAddCmdExe;
import ${package}.executor.query.CustomerListByNameQryExe;

import javax.annotation.Resource;


@Service
public class CustomerServiceImpl implements CustomerServiceI {

@Autowired
private CommandBusI commandBus;
@Resource
private CustomerAddCmdExe customerAddCmdExe;

@Resource
private CustomerListByNameQryExe customerListByNameQryExe;

@Override
public Response addCustomer(CustomerAddCmd customerAddCmd) {
return (Response)commandBus.send(customerAddCmd);
return customerAddCmdExe.execute(customerAddCmd);
}

@Override
public MultiResponse<Customer> listByName(CustomerListByNameQry customerListByNameQry) {
return (MultiResponse<Customer>)commandBus.send(customerListByNameQry);
return customerListByNameQryExe.execute(customerListByNameQry);
}

}
}
2 changes: 1 addition & 1 deletion cola-archetype-web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.alibaba.cola</groupId>
<artifactId>cola-framework-archetype-web</artifactId>
<version>2.0.0</version>
<version>3.0.0</version>
<packaging>maven-archetype</packaging>

<name>cola framework archetype</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,17 @@
#set( $symbol_escape = '\' )
package ${package}.executor;


import com.alibaba.cola.command.Command;
import com.alibaba.cola.command.CommandExecutorI;
import com.alibaba.cola.domain.DomainEventServiceI;
import com.alibaba.cola.dto.Response;
import com.alibaba.cola.exception.BizException;
import ${package}.dto.CustomerAddCmd;
import ${package}.dto.domainmodel.ErrorCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


@Command
public class CustomerAddCmdExe implements CommandExecutorI<Response, CustomerAddCmd>{
@Component
public class CustomerAddCmdExe{

@Override
public Response execute(CustomerAddCmd cmd) {
//The flow of usecase is defined here.
//The core ablility should be implemented in Domain. or sink to Domian gradually
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@
#set( $symbol_escape = '\' )
package ${package}.executor.query;

import com.alibaba.cola.command.Command;
import com.alibaba.cola.command.QueryExecutorI;
import com.alibaba.cola.dto.MultiResponse;
import ${package}.dto.CustomerListByNameQry;
import ${package}.dto.domainmodel.Customer;
import java.util.ArrayList;
import java.util.List;
import org.springframework.stereotype.Component;

@Command
public class CustomerListByNameQryExe implements QueryExecutorI<MultiResponse<Customer>, CustomerListByNameQry> {

@Override
@Component
public class CustomerListByNameQryExe{

public MultiResponse<Customer> execute(CustomerListByNameQry cmd) {
List<Customer> customerList = new ArrayList<>();
Customer customer = new Customer();
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit b2539d2

Please sign in to comment.