Skip to content
This repository has been archived by the owner on Dec 14, 2021. It is now read-only.

Commit

Permalink
Add the transaction stuff to the code base
Browse files Browse the repository at this point in the history
  • Loading branch information
jettro committed Oct 28, 2011
1 parent c74ac79 commit 47eef8c
Show file tree
Hide file tree
Showing 22 changed files with 1,100 additions and 0 deletions.
@@ -0,0 +1,51 @@
/*
* Copyright (c) 2011. Gridshore
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.axonframework.samples.trader.app.api.transaction;

import org.axonframework.domain.AggregateIdentifier;

/**
* @author Jettro Coenradie
*/
public class AbstractStartTransactionCommand {
private AggregateIdentifier orderbookIdentifier;
private AggregateIdentifier portfolioIdentifier;
private long tradeCount;
private long itemPrice;

public AbstractStartTransactionCommand(AggregateIdentifier orderbookIdentifier, AggregateIdentifier portfolioIdentifier, long tradeCount, long itemPrice) {
this.itemPrice = itemPrice;
this.orderbookIdentifier = orderbookIdentifier;
this.portfolioIdentifier = portfolioIdentifier;
this.tradeCount = tradeCount;
}

public long getItemPrice() {
return itemPrice;
}

public AggregateIdentifier getOrderbookIdentifier() {
return orderbookIdentifier;
}

public AggregateIdentifier getPortfolioIdentifier() {
return portfolioIdentifier;
}

public long getTradeCount() {
return tradeCount;
}
}
@@ -0,0 +1,56 @@
/*
* Copyright (c) 2011. Gridshore
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.axonframework.samples.trader.app.api.transaction;

import org.axonframework.domain.AggregateIdentifier;
import org.axonframework.domain.DomainEvent;

/**
* @author Jettro Coenradie
*/
public abstract class AbstractTransactionStartedEvent extends DomainEvent {
private AggregateIdentifier orderbookIdentifier;
private AggregateIdentifier portfolioIdentifier;
private long totalItems;
private long pricePerItem;

public AbstractTransactionStartedEvent(AggregateIdentifier orderbookIdentifier,
AggregateIdentifier portfolioIdentifier,
long totalItems,
long pricePerItem) {
this.orderbookIdentifier = orderbookIdentifier;
this.portfolioIdentifier = portfolioIdentifier;
this.totalItems = totalItems;
this.pricePerItem = pricePerItem;
}

public AggregateIdentifier getOrderbookIdentifier() {
return orderbookIdentifier;
}

public AggregateIdentifier getPortfolioIdentifier() {
return portfolioIdentifier;
}

public long getPricePerItem() {
return pricePerItem;
}

public long getTotalItems() {
return totalItems;
}

}
@@ -0,0 +1,44 @@
/*
* Copyright (c) 2011. Gridshore
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.axonframework.samples.trader.app.api.transaction;

import org.axonframework.domain.AggregateIdentifier;
import org.axonframework.domain.DomainEvent;

/**
* @author Jettro Coenradie
*/
public class BuyTransactionCancelledEvent extends DomainEvent {
private long totalAmountOfItems;
private long amountOfExecutedItems;

public BuyTransactionCancelledEvent(long totalAmountOfItems, long amountOfExecutedItems) {
this.totalAmountOfItems = totalAmountOfItems;
this.amountOfExecutedItems = amountOfExecutedItems;
}

public AggregateIdentifier getTransactionIdentifier() {
return super.getAggregateIdentifier();
}

public long getAmountOfExecutedItems() {
return amountOfExecutedItems;
}

public long getTotalAmountOfItems() {
return totalAmountOfItems;
}
}
@@ -0,0 +1,28 @@
/*
* Copyright (c) 2011. Gridshore
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.axonframework.samples.trader.app.api.transaction;

import org.axonframework.domain.AggregateIdentifier;
import org.axonframework.domain.DomainEvent;

/**
* @author Jettro Coenradie
*/
public class BuyTransactionConfirmedEvent extends DomainEvent {
public AggregateIdentifier getTransactionIdentifier() {
return super.getAggregateIdentifier();
}
}
@@ -0,0 +1,44 @@
/*
* Copyright (c) 2011. Gridshore
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.axonframework.samples.trader.app.api.transaction;

import org.axonframework.domain.AggregateIdentifier;
import org.axonframework.domain.DomainEvent;

/**
* @author Jettro Coenradie
*/
public class BuyTransactionExecutedEvent extends DomainEvent {
private long amountOfItems;
private long itemPrice;

public BuyTransactionExecutedEvent(long amountOfItems, long itemPrice) {
this.amountOfItems = amountOfItems;
this.itemPrice = itemPrice;
}

public AggregateIdentifier getTransactionIdentifier() {
return this.getAggregateIdentifier();
}

public long getAmountOfItems() {
return amountOfItems;
}

public long getItemPrice() {
return itemPrice;
}
}
@@ -0,0 +1,63 @@
/*
* Copyright (c) 2011. Gridshore
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.axonframework.samples.trader.app.api.transaction;

import org.axonframework.domain.AggregateIdentifier;
import org.axonframework.domain.DomainEvent;

/**
* @author Jettro Coenradie
*/
public class BuyTransactionPartiallyExecutedEvent extends DomainEvent {
private long amountOfExecutedItems;
private long totalOfExecutedItems;
private long itemPrice;

public BuyTransactionPartiallyExecutedEvent(long amountOfExecutedItems, long totalOfExecutedItems, long itemPrice) {

this.amountOfExecutedItems = amountOfExecutedItems;
this.totalOfExecutedItems = totalOfExecutedItems;
this.itemPrice = itemPrice;
}

public AggregateIdentifier getTransactionIdentifier() {
return this.getAggregateIdentifier();
}

public long getAmountOfExecutedItems() {
return amountOfExecutedItems;
}

public void setAmountOfExecutedItems(long amountOfExecutedItems) {
this.amountOfExecutedItems = amountOfExecutedItems;
}

public long getItemPrice() {
return itemPrice;
}

public void setItemPrice(long itemPrice) {
this.itemPrice = itemPrice;
}

public long getTotalOfExecutedItems() {
return totalOfExecutedItems;
}

public void setTotalOfExecutedItems(long totalOfExecutedItems) {
this.totalOfExecutedItems = totalOfExecutedItems;
}
}
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2011. Gridshore
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.axonframework.samples.trader.app.api.transaction;

import org.axonframework.domain.AggregateIdentifier;

/**
* @author Jettro Coenradie
*/
public class BuyTransactionStartedEvent extends AbstractTransactionStartedEvent {

public BuyTransactionStartedEvent(AggregateIdentifier orderbookIdentifier,
AggregateIdentifier portfolioIdentifier,
long totalItems,
long pricePerItem) {
super(orderbookIdentifier, portfolioIdentifier, totalItems, pricePerItem);
}
}
@@ -0,0 +1,33 @@
/*
* Copyright (c) 2011. Gridshore
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.axonframework.samples.trader.app.api.transaction;

import org.axonframework.domain.AggregateIdentifier;

/**
* @author Jettro Coenradie
*/
public class CancelTransactionCommand {
private AggregateIdentifier transactionIdentifier;

public CancelTransactionCommand(AggregateIdentifier transactionIdentifier) {
this.transactionIdentifier = transactionIdentifier;
}

public AggregateIdentifier getTransactionIdentifier() {
return transactionIdentifier;
}
}
@@ -0,0 +1,33 @@
/*
* Copyright (c) 2011. Gridshore
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.axonframework.samples.trader.app.api.transaction;

import org.axonframework.domain.AggregateIdentifier;

/**
* @author Jettro Coenradie
*/
public class ConfirmTransactionCommand {
private AggregateIdentifier transactionIdentifier;

public ConfirmTransactionCommand(AggregateIdentifier transactionIdentifier) {
this.transactionIdentifier = transactionIdentifier;
}

public AggregateIdentifier getTransactionIdentifier() {
return transactionIdentifier;
}
}

0 comments on commit 47eef8c

Please sign in to comment.