You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by ma...@apache.org on 2010/07/12 21:11:42 UTC
svn commit: r963440 - in
/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page:
CatalogReceipt.java IndexPager.java IngestReceipt.java Page.java
PageInfo.java ProcessedPageInfo.java QueryPager.java TransactionReceipt.java
Author: mattmann
Date: Mon Jul 12 19:11:42 2010
New Revision: 963440
URL: http://svn.apache.org/viewvc?rev=963440&view=rev
Log:
- progress towards OODT-15 One trunk for all OODT components with top level build
Modified:
incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/CatalogReceipt.java
incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/IndexPager.java
incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/IngestReceipt.java
incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/Page.java
incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/PageInfo.java
incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/ProcessedPageInfo.java
incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/QueryPager.java
incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/TransactionReceipt.java
Modified: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/CatalogReceipt.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/CatalogReceipt.java?rev=963440&r1=963439&r2=963440&view=diff
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/CatalogReceipt.java (original)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/CatalogReceipt.java Mon Jul 12 19:11:42 2010
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -17,49 +17,59 @@
package org.apache.oodt.cas.catalog.page;
+//JDK imports
import java.util.Date;
+//OODT imports
import org.apache.oodt.cas.catalog.struct.TransactionId;
+/**
+ *
+ * Describe your class here.
+ *
+ */
public class CatalogReceipt {
- protected TransactionId<?> transactionId;
- protected Date transactionDate;
- protected String catalogId;
-
- public CatalogReceipt(IngestReceipt ingestReceipt, String catalogId) {
- this.transactionId = ingestReceipt.getCatalogTransactionId();
- this.transactionDate = ingestReceipt.getTransactionDate();
- this.catalogId = catalogId;
- }
-
- public TransactionId<?> getTransactionId() {
- return this.transactionId;
- }
-
- public Date getTransactionDate() {
- return this.transactionDate;
- }
-
- public String getCatalogId() {
- return this.catalogId;
- }
-
- public boolean equals(Object obj) {
- if (obj instanceof CatalogReceipt) {
- CatalogReceipt compareTo = (CatalogReceipt) obj;
- return this.transactionId.equals(compareTo.transactionId) && this.transactionDate.equals(compareTo.transactionDate) && this.catalogId.equals(compareTo.catalogId);
- }else {
- return false;
- }
- }
-
- public int hashCode() {
- return this.toString().hashCode();
- }
-
- public String toString() {
- return ("{CatalogReceipt(tID=" + this.transactionId + ",tDate=" + this.transactionDate + ",catID=" + this.catalogId + ")}");
- }
-
+ protected TransactionId<?> transactionId;
+ protected Date transactionDate;
+ protected String catalogId;
+
+ public CatalogReceipt(IngestReceipt ingestReceipt, String catalogId) {
+ this.transactionId = ingestReceipt.getCatalogTransactionId();
+ this.transactionDate = ingestReceipt.getTransactionDate();
+ this.catalogId = catalogId;
+ }
+
+ public TransactionId<?> getTransactionId() {
+ return this.transactionId;
+ }
+
+ public Date getTransactionDate() {
+ return this.transactionDate;
+ }
+
+ public String getCatalogId() {
+ return this.catalogId;
+ }
+
+ public boolean equals(Object obj) {
+ if (obj instanceof CatalogReceipt) {
+ CatalogReceipt compareTo = (CatalogReceipt) obj;
+ return this.transactionId.equals(compareTo.transactionId)
+ && this.transactionDate.equals(compareTo.transactionDate)
+ && this.catalogId.equals(compareTo.catalogId);
+ } else {
+ return false;
+ }
+ }
+
+ public int hashCode() {
+ return this.toString().hashCode();
+ }
+
+ public String toString() {
+ return ("{CatalogReceipt(tID=" + this.transactionId + ",tDate="
+ + this.transactionDate + ",catID=" + this.catalogId + ")}");
+ }
+
}
Modified: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/IndexPager.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/IndexPager.java?rev=963440&r1=963439&r2=963440&view=diff
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/IndexPager.java (original)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/IndexPager.java Mon Jul 12 19:11:42 2010
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -18,60 +18,57 @@
package org.apache.oodt.cas.catalog.page;
/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
+ *
* A pager for paging through a index
- * <p>
+ *
*/
public class IndexPager {
- protected int pageSize;
- protected int pageNum;
- protected int totalPages;
- protected int numOfHits;
-
- public IndexPager() {
- this.pageSize = 20;
- this.pageNum = 1;
- this.totalPages = 0;
- }
-
- public IndexPager(ProcessedPageInfo processedPageInfo) {
- this.pageSize = processedPageInfo.getPageSize();
- this.pageNum = processedPageInfo.getPageNum();
- this.totalPages = processedPageInfo.getTotalPages();
- this.numOfHits = processedPageInfo.getNumOfHits();
- }
-
- public ProcessedPageInfo getProcessedPageInfo() {
- return new ProcessedPageInfo(this.pageSize, this.pageNum, this.numOfHits);
- }
-
- public int getPageSize() {
- return this.pageSize;
- }
-
- public int getPageNum() {
- return this.pageNum;
- }
-
- public int getTotalPages() {
- return this.totalPages;
- }
-
- public int getNumOfHits() {
- return this.numOfHits;
- }
-
- public void incrementPageNumber() {
- if (this.pageNum + 1 <= this.totalPages)
- this.pageNum++;
- }
-
- public boolean isLastPage() {
- return this.getProcessedPageInfo().isLastPage();
- }
-
+ protected int pageSize;
+ protected int pageNum;
+ protected int totalPages;
+ protected int numOfHits;
+
+ public IndexPager() {
+ this.pageSize = 20;
+ this.pageNum = 1;
+ this.totalPages = 0;
+ }
+
+ public IndexPager(ProcessedPageInfo processedPageInfo) {
+ this.pageSize = processedPageInfo.getPageSize();
+ this.pageNum = processedPageInfo.getPageNum();
+ this.totalPages = processedPageInfo.getTotalPages();
+ this.numOfHits = processedPageInfo.getNumOfHits();
+ }
+
+ public ProcessedPageInfo getProcessedPageInfo() {
+ return new ProcessedPageInfo(this.pageSize, this.pageNum, this.numOfHits);
+ }
+
+ public int getPageSize() {
+ return this.pageSize;
+ }
+
+ public int getPageNum() {
+ return this.pageNum;
+ }
+
+ public int getTotalPages() {
+ return this.totalPages;
+ }
+
+ public int getNumOfHits() {
+ return this.numOfHits;
+ }
+
+ public void incrementPageNumber() {
+ if (this.pageNum + 1 <= this.totalPages)
+ this.pageNum++;
+ }
+
+ public boolean isLastPage() {
+ return this.getProcessedPageInfo().isLastPage();
+ }
+
}
Modified: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/IngestReceipt.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/IngestReceipt.java?rev=963440&r1=963439&r2=963440&view=diff
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/IngestReceipt.java (original)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/IngestReceipt.java Mon Jul 12 19:11:42 2010
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -17,34 +17,43 @@
package org.apache.oodt.cas.catalog.page;
+//OODT imports
import org.apache.oodt.cas.catalog.struct.TransactionId;
+//JDK imports
import java.util.Date;
+/**
+ *
+ * Describe your class here.
+ *
+ */
public class IngestReceipt {
- protected TransactionId<?> catalogTransactionId;
- protected Date transactionDate;
-
- public IngestReceipt(TransactionId<?> catalogTransactionId, Date transactionDate) {
- this.catalogTransactionId = catalogTransactionId;
- this.transactionDate = transactionDate;
- }
-
- public TransactionId<?> getCatalogTransactionId() {
- return this.catalogTransactionId;
- }
-
- public Date getTransactionDate() {
- return this.transactionDate;
- }
-
- public int hashCode() {
- return this.catalogTransactionId.hashCode();
- }
-
- public String toString() {
- return this.catalogTransactionId.toString() + " : " + this.transactionDate.toString();
- }
-
+ protected TransactionId<?> catalogTransactionId;
+ protected Date transactionDate;
+
+ public IngestReceipt(TransactionId<?> catalogTransactionId,
+ Date transactionDate) {
+ this.catalogTransactionId = catalogTransactionId;
+ this.transactionDate = transactionDate;
+ }
+
+ public TransactionId<?> getCatalogTransactionId() {
+ return this.catalogTransactionId;
+ }
+
+ public Date getTransactionDate() {
+ return this.transactionDate;
+ }
+
+ public int hashCode() {
+ return this.catalogTransactionId.hashCode();
+ }
+
+ public String toString() {
+ return this.catalogTransactionId.toString() + " : "
+ + this.transactionDate.toString();
+ }
+
}
Modified: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/Page.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/Page.java?rev=963440&r1=963439&r2=963440&view=diff
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/Page.java (original)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/Page.java Mon Jul 12 19:11:42 2010
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -17,55 +17,63 @@
package org.apache.oodt.cas.catalog.page;
+//OODT imports
import org.apache.oodt.cas.catalog.query.QueryExpression;
+//JDK imports
import java.util.List;
import java.util.Set;
+/**
+ *
+ * Describe your class here.
+ *
+ */
public class Page {
- protected List<TransactionReceipt> receipts;
- protected ProcessedPageInfo processedPageInfo;
- protected QueryExpression queryExpression;
- protected Set<String> restrictToCatalogIds;
-
- public Page(ProcessedPageInfo pageInfo, QueryExpression queryExpression, Set<String> restrictToCatalogIds, List<TransactionReceipt> receipts) {
- this.processedPageInfo = pageInfo;
- this.queryExpression = queryExpression;
- this.restrictToCatalogIds = restrictToCatalogIds;
- this.receipts = receipts;
- }
-
- public List<TransactionReceipt> getReceipts() {
- return this.receipts;
- }
-
- public int getPageSize() {
- return this.processedPageInfo.getPageSize();
- }
-
- public int getPageNum() {
- return this.processedPageInfo.getPageNum();
- }
-
- public int getTotalPages() {
- return this.processedPageInfo.getTotalPages();
- }
-
- public int getNumOfHits() {
- return this.processedPageInfo.getNumOfHits();
- }
-
- public QueryExpression getQueryExpression() {
- return queryExpression;
- }
-
- public Set<String> getRestrictToCatalogIds() {
- return restrictToCatalogIds;
- }
-
- public boolean isLastPage() {
- return this.processedPageInfo.isLastPage();
- }
-
+ protected List<TransactionReceipt> receipts;
+ protected ProcessedPageInfo processedPageInfo;
+ protected QueryExpression queryExpression;
+ protected Set<String> restrictToCatalogIds;
+
+ public Page(ProcessedPageInfo pageInfo, QueryExpression queryExpression,
+ Set<String> restrictToCatalogIds, List<TransactionReceipt> receipts) {
+ this.processedPageInfo = pageInfo;
+ this.queryExpression = queryExpression;
+ this.restrictToCatalogIds = restrictToCatalogIds;
+ this.receipts = receipts;
+ }
+
+ public List<TransactionReceipt> getReceipts() {
+ return this.receipts;
+ }
+
+ public int getPageSize() {
+ return this.processedPageInfo.getPageSize();
+ }
+
+ public int getPageNum() {
+ return this.processedPageInfo.getPageNum();
+ }
+
+ public int getTotalPages() {
+ return this.processedPageInfo.getTotalPages();
+ }
+
+ public int getNumOfHits() {
+ return this.processedPageInfo.getNumOfHits();
+ }
+
+ public QueryExpression getQueryExpression() {
+ return queryExpression;
+ }
+
+ public Set<String> getRestrictToCatalogIds() {
+ return restrictToCatalogIds;
+ }
+
+ public boolean isLastPage() {
+ return this.processedPageInfo.isLastPage();
+ }
+
}
Modified: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/PageInfo.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/PageInfo.java?rev=963440&r1=963439&r2=963440&view=diff
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/PageInfo.java (original)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/PageInfo.java Mon Jul 12 19:11:42 2010
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -17,28 +17,33 @@
package org.apache.oodt.cas.catalog.page;
+/**
+ *
+ * Describe your class here.
+ *
+ */
public class PageInfo {
- protected int pageSize;
- protected int pageNum;
-
- public static final int LAST_PAGE = Integer.MAX_VALUE;
- public static final int FIRST_PAGE = 1;
-
- public PageInfo(int pageSize, int pageNum) {
- this.pageSize = pageSize;
- if (pageNum < 1)
- this.pageNum = 1;
- else
- this.pageNum = pageNum;
- }
-
- public int getPageSize() {
- return pageSize;
- }
-
- public int getPageNum() {
- return pageNum;
- }
-
+ protected int pageSize;
+ protected int pageNum;
+
+ public static final int LAST_PAGE = Integer.MAX_VALUE;
+ public static final int FIRST_PAGE = 1;
+
+ public PageInfo(int pageSize, int pageNum) {
+ this.pageSize = pageSize;
+ if (pageNum < 1)
+ this.pageNum = 1;
+ else
+ this.pageNum = pageNum;
+ }
+
+ public int getPageSize() {
+ return pageSize;
+ }
+
+ public int getPageNum() {
+ return pageNum;
+ }
+
}
Modified: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/ProcessedPageInfo.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/ProcessedPageInfo.java?rev=963440&r1=963439&r2=963440&view=diff
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/ProcessedPageInfo.java (original)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/ProcessedPageInfo.java Mon Jul 12 19:11:42 2010
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -17,27 +17,34 @@
package org.apache.oodt.cas.catalog.page;
+/**
+ *
+ * Describe your class here.
+ *
+ */
public class ProcessedPageInfo extends PageInfo {
- protected int totalPages;
- protected int numOfHits;
-
- public ProcessedPageInfo(int pageSize, int pageNum, int numOfHits) {
- super(pageSize, pageNum > ((int) Math.ceil((double) numOfHits / (double) pageSize)) ? ((int) Math.ceil((double) numOfHits / (double) pageSize)) : pageNum);
- this.totalPages = ((int) Math.ceil((double) numOfHits / (double) pageSize));
- this.numOfHits = numOfHits;
- }
-
- public int getTotalPages() {
- return this.totalPages;
- }
-
- public int getNumOfHits() {
- return this.numOfHits;
- }
-
- public boolean isLastPage() {
- return this.pageNum == this.totalPages;
- }
-
+ protected int totalPages;
+ protected int numOfHits;
+
+ public ProcessedPageInfo(int pageSize, int pageNum, int numOfHits) {
+ super(pageSize, pageNum > ((int) Math.ceil((double) numOfHits
+ / (double) pageSize)) ? ((int) Math.ceil((double) numOfHits
+ / (double) pageSize)) : pageNum);
+ this.totalPages = ((int) Math.ceil((double) numOfHits / (double) pageSize));
+ this.numOfHits = numOfHits;
+ }
+
+ public int getTotalPages() {
+ return this.totalPages;
+ }
+
+ public int getNumOfHits() {
+ return this.numOfHits;
+ }
+
+ public boolean isLastPage() {
+ return this.pageNum == this.totalPages;
+ }
+
}
Modified: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/QueryPager.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/QueryPager.java?rev=963440&r1=963439&r2=963440&view=diff
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/QueryPager.java (original)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/QueryPager.java Mon Jul 12 19:11:42 2010
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -23,47 +23,49 @@ import java.util.List;
import java.util.Vector;
/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A pager for paging through query results
- * <p>
+ *
+ * A pager for paging through query results.
+ *
*/
public class QueryPager extends IndexPager {
- protected List<TransactionReceipt> receipts;
-
- public QueryPager(List<TransactionReceipt> receipts) {
- super();
- this.receipts = new Vector<TransactionReceipt>(receipts);
- this.totalPages = this.caculateTotalPages();
- this.numOfHits = receipts.size();
- }
-
- protected int caculateTotalPages() {
- return (int) Math.ceil((double) receipts.size() / (double) this.getPageSize());
- }
-
- public void setPageInfo(PageInfo pageInfo) {
- this.pageSize = Math.max(pageInfo.getPageSize(), 0);
- this.totalPages = this.caculateTotalPages();
- if (this.totalPages == 0)
- this.pageNum = 0;
- else
- this.pageNum = (pageInfo.getPageNum() == PageInfo.LAST_PAGE || pageInfo.getPageNum() >= this.totalPages) ? this.totalPages : pageInfo.getPageNum();
- }
-
- public List<TransactionReceipt> getTransactionReceipts() {
- return Collections.unmodifiableList(this.receipts);
- }
-
- public List<TransactionReceipt> getCurrentPage() {
- List<TransactionReceipt> currentPage = new Vector<TransactionReceipt>();
- if (this.pageNum > 0)
- for (int i = (this.getPageNum() - 1) * this.getPageSize(); i < receipts.size() && i < this.getPageNum() * this.getPageSize(); i++)
- currentPage.add(receipts.get(i));
- return currentPage;
- }
-
+ protected List<TransactionReceipt> receipts;
+
+ public QueryPager(List<TransactionReceipt> receipts) {
+ super();
+ this.receipts = new Vector<TransactionReceipt>(receipts);
+ this.totalPages = this.caculateTotalPages();
+ this.numOfHits = receipts.size();
+ }
+
+ protected int caculateTotalPages() {
+ return (int) Math.ceil((double) receipts.size()
+ / (double) this.getPageSize());
+ }
+
+ public void setPageInfo(PageInfo pageInfo) {
+ this.pageSize = Math.max(pageInfo.getPageSize(), 0);
+ this.totalPages = this.caculateTotalPages();
+ if (this.totalPages == 0)
+ this.pageNum = 0;
+ else
+ this.pageNum = (pageInfo.getPageNum() == PageInfo.LAST_PAGE || pageInfo
+ .getPageNum() >= this.totalPages) ? this.totalPages : pageInfo
+ .getPageNum();
+ }
+
+ public List<TransactionReceipt> getTransactionReceipts() {
+ return Collections.unmodifiableList(this.receipts);
+ }
+
+ public List<TransactionReceipt> getCurrentPage() {
+ List<TransactionReceipt> currentPage = new Vector<TransactionReceipt>();
+ if (this.pageNum > 0)
+ for (int i = (this.getPageNum() - 1) * this.getPageSize(); i < receipts
+ .size()
+ && i < this.getPageNum() * this.getPageSize(); i++)
+ currentPage.add(receipts.get(i));
+ return currentPage;
+ }
+
}
Modified: incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/TransactionReceipt.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/TransactionReceipt.java?rev=963440&r1=963439&r2=963440&view=diff
==============================================================================
--- incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/TransactionReceipt.java (original)
+++ incubator/oodt/trunk/catalog/src/main/java/org/apache/oodt/cas/catalog/page/TransactionReceipt.java Mon Jul 12 19:11:42 2010
@@ -1,4 +1,4 @@
-/*
+/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -29,63 +29,62 @@ import java.util.Vector;
import org.apache.oodt.cas.catalog.struct.TransactionId;
/**
- * @author bfoster
- * @version $Revision$
- *
- * <p>
+ *
* A Reciept created by performing a transaction with a CatalogService
- * <p>
+ *
*/
public class TransactionReceipt {
- protected TransactionId<?> transactionId;
- protected Set<String> catalogIds;
- protected Date transactionDate;
- protected Vector<CatalogReceipt> catalogReceipts;
-
- public TransactionReceipt(TransactionId<?> transactionId, List<CatalogReceipt> catalogReceipts) {
- this.transactionId = transactionId;
- this.catalogIds = new HashSet<String>();
- this.catalogReceipts = new Vector<CatalogReceipt>(catalogReceipts);
- for (CatalogReceipt catalogReceipt : catalogReceipts) {
- this.catalogIds.add(catalogReceipt.getCatalogId());
- if (this.transactionDate == null)
- this.transactionDate = catalogReceipt.getTransactionDate();
- else if (this.transactionDate.before(catalogReceipt.getTransactionDate()))
- this.transactionDate = catalogReceipt.getTransactionDate();
- }
- }
-
- public TransactionId<?> getTransactionId() {
- return this.transactionId;
- }
-
- public Set<String> getCatalogIds() {
- return this.catalogIds;
- }
-
- public Date getTransactionDate() {
- return this.transactionDate;
- }
-
- public List<CatalogReceipt> getCatalogReceipts() {
- return Collections.unmodifiableList(this.catalogReceipts);
- }
-
- public int hashCode() {
- return this.transactionId.hashCode();
- }
-
- public boolean equals(Object obj) {
- if (obj instanceof TransactionReceipt) {
- return this.transactionId.equals(((TransactionReceipt) obj).transactionId);
- }else {
- return false;
- }
- }
-
- public String toString() {
- return this.transactionId + ":" + this.catalogIds;
- }
-
+ protected TransactionId<?> transactionId;
+ protected Set<String> catalogIds;
+ protected Date transactionDate;
+ protected Vector<CatalogReceipt> catalogReceipts;
+
+ public TransactionReceipt(TransactionId<?> transactionId,
+ List<CatalogReceipt> catalogReceipts) {
+ this.transactionId = transactionId;
+ this.catalogIds = new HashSet<String>();
+ this.catalogReceipts = new Vector<CatalogReceipt>(catalogReceipts);
+ for (CatalogReceipt catalogReceipt : catalogReceipts) {
+ this.catalogIds.add(catalogReceipt.getCatalogId());
+ if (this.transactionDate == null)
+ this.transactionDate = catalogReceipt.getTransactionDate();
+ else if (this.transactionDate.before(catalogReceipt.getTransactionDate()))
+ this.transactionDate = catalogReceipt.getTransactionDate();
+ }
+ }
+
+ public TransactionId<?> getTransactionId() {
+ return this.transactionId;
+ }
+
+ public Set<String> getCatalogIds() {
+ return this.catalogIds;
+ }
+
+ public Date getTransactionDate() {
+ return this.transactionDate;
+ }
+
+ public List<CatalogReceipt> getCatalogReceipts() {
+ return Collections.unmodifiableList(this.catalogReceipts);
+ }
+
+ public int hashCode() {
+ return this.transactionId.hashCode();
+ }
+
+ public boolean equals(Object obj) {
+ if (obj instanceof TransactionReceipt) {
+ return this.transactionId
+ .equals(((TransactionReceipt) obj).transactionId);
+ } else {
+ return false;
+ }
+ }
+
+ public String toString() {
+ return this.transactionId + ":" + this.catalogIds;
+ }
+
}