本文整理汇总了Java中org.apache.oodt.cas.filemgr.structs.Product.setProductId方法的典型用法代码示例。如果您正苦于以下问题:Java Product.setProductId方法的具体用法?Java Product.setProductId怎么用?Java Product.setProductId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.oodt.cas.filemgr.structs.Product
的用法示例。
在下文中一共展示了Product.setProductId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getProductFromXmlRpc
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public static Product getProductFromXmlRpc(Map<?, ?> productHash) {
Product product = new Product();
product.setProductId((String) productHash.get("id"));
product.setProductName((String) productHash.get("name"));
if (productHash.get("type") != null) {
product.setProductType(getProductTypeFromXmlRpc(
(Map<String, Object>) productHash.get("type")));
}
product.setProductStructure((String) productHash.get("structure"));
product.setTransferStatus((String) productHash.get("transferStatus"));
if (productHash.get("references") != null) {
product.setProductReferences(getReferencesFromXmlRpc(
(Vector<Map<String, Object>>) productHash
.get("references")));
}
if (productHash.get("rootReference") != null) {
product.setRootRef(getReferenceFromXmlRpc(
(Map<String, Object>) productHash.get("rootReference")));
}
return product;
}
示例2: getProduct
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
public static Product getProduct(ResultSet rs, boolean getType, boolean productIdString)
throws SQLException {
Product product = new Product();
if (productIdString) {
product.setProductId(rs.getString("product_id"));
} else {
product.setProductId(String.valueOf(rs.getInt("product_id")));
}
product.setProductName(rs.getString("product_name"));
product.setProductStructure(rs.getString("product_structure"));
product.setTransferStatus(rs.getString("product_transfer_status"));
if (getType) {
product.setProductType(getProductType(rs));
} else {
// still grab the ID
ProductType type = new ProductType();
type.setProductTypeId(rs.getString("product_type_id"));
product.setProductType(type);
}
return product;
}
示例3: getProductById
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
@Override
public Product getProductById(String productId) {
lastMethodCallDetails = new MethodCallDetails("getProductById",
Lists.newArrayList((Object) productId));
Product p = new Product();
p.setProductId(productId);
p.setProductName("TestProductName");
p.setProductReferences(Lists.newArrayList(
new Reference("file:/orig/file", "file:/ds/file", 3)));
p.setProductStructure(Product.STRUCTURE_FLAT);
p.setTransferStatus(Product.STATUS_RECEIVED);
ProductType pt = new ProductType();
pt.setName("TestProductType");
p.setProductType(pt);
return p;
}
示例4: execute
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
@Override
public void execute(ActionMessagePrinter printer)
throws CmdLineActionException {
try {
Validate.notNull(productId, "Must specify productid");
Validate.notNull(productTypeName, "Must specify productTypeName");
FileManagerClient client = getClient();
Product product = new Product();
// TODO(bfoster): Not sure why ProductType is needed here.
ProductType pt = client.getProductTypeByName(productTypeName);
if (pt == null) {
throw new Exception("FileManager returned null ProductType");
}
product.setProductType(pt);
product.setProductId(productId);
printer.println("Product: [id=" + productId + ", transferPct="
+ client.getProductPctTransferred(product) + "]");
} catch (Exception e) {
throw new CmdLineActionException("Failed to get percent transferred"
+ " for product id '" + productId + "' and ProductType name '"
+ productTypeName + "' : " + e.getMessage(), e);
}
}
示例5: getProductByName
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
@Override
public Product getProductByName(String productName) {
lastMethodCallDetails = new MethodCallDetails("getProductByName",
Lists.newArrayList((Object) productName));
Product p = new Product();
p.setProductId("TestProductId");
p.setProductName(productName);
p.setProductReferences(Lists.newArrayList(
new Reference("file:/orig/file", "file:/ds/file", 3)));
p.setProductStructure(Product.STRUCTURE_FLAT);
p.setTransferStatus(Product.STATUS_RECEIVED);
ProductType pt = new ProductType();
pt.setName("TestProductType");
p.setProductType(pt);
return p;
}
示例6: setUp
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
Product p = new Product();
p.setProductId("TestProductID");
Metadata m = new Metadata();
m.addMetadata(CoreMetKeys.FILENAME, "datafile.dat");
m.addMetadata("Owners", Arrays.asList("Chad", "Cam"));
qr1 = new QueryResult(p, m);
Metadata m2 = new Metadata();
m2.addMetadata(CoreMetKeys.FILENAME, "textfile.dat");
m2.addMetadata("Owners", Arrays.asList("Bob", "Billy"));
qr2 = new QueryResult(p, m2);
Metadata filename = new Metadata();
filename.addMetadata(CoreMetKeys.FILENAME, "foo.txt");
qrfilename = new QueryResult(p, filename);
Metadata owners = new Metadata();
owners.addMetadata("Owners", Arrays.asList("Dave", "Dan"));
qrowners = new QueryResult(p, owners);
qrnull = new QueryResult(p, new Metadata());
qrnull2 = new QueryResult(p, new Metadata());
}
示例7: getClient
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
@Override
public FileManagerClient getClient() throws MalformedURLException,
ConnectionException {
return new DummyFileManagerClient(new URL("http://localhost:9000"),
false) {
@Override
public Product getProductById(String productId) {
Product p = new Product();
p.setProductId(productId);
p.setProductName(PRODUCT_NAME);
return p;
}
@Override
public List<Reference> getProductReferences(Product product) {
return null;
}
};
}
示例8: getClient
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
public FileManagerClient getClient() throws MalformedURLException,
ConnectionException {
return new DummyFileManagerClient(new URL("http://localhost:9000"),
false) {
public Product getProductById(String productId) {
Product p = new Product();
p.setProductId(productId);
p.setProductName(PRODUCT_NAME);
ProductType pt = new ProductType();
pt.setName(PRODUCT_TYPE_NAME);
p.setProductType(pt);
p.setProductStructure(PRODUCT_STRUCTURE);
p.setTransferStatus(PRODUCT_STATUS);
p.setRootRef(new Reference("file:/dummy/path", ROOT_REF, 2));
p.setProductReferences(Lists.newArrayList(new Reference(
ORIG_REF_1, DS_REF_1, FILE_SIZE_REF_1), new Reference(
ORIG_REF_2, DS_REF_2, FILE_SIZE_REF_2)));
return p;
}
};
}
示例9: getCurrentFileTransfers
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
@Override
public List<FileTransferStatus> getCurrentFileTransfers() {
lastMethodCallDetails = new MethodCallDetails("getCurrentFileTransfers",
Lists.newArrayList());
FileTransferStatus status = new FileTransferStatus();
status.setBytesTransferred(10);
status.setFileRef(new Reference("file:/orig/file", "file:/ds/file", 4));
Product p = new Product();
p.setProductId("TestProductId");
status.setParentProduct(p);
return Lists.newArrayList(status);
}
示例10: getFirstPage
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
@Override
public ProductPage getFirstPage(ProductType pt) {
ProductPage pp = new ProductPage();
pp.setPageNum(PAGE_NUM);
pp.setTotalPages(TOTAL_PAGES);
pp.setPageSize(PAGE_SIZE);
Product p1 = new Product();
p1.setProductId(PRODUCT_ID_1);
p1.setProductName(PRODUCT_NAME_1);
p1.setProductType(pt);
p1.setProductStructure(PRODUCT_STRUCTURE);
p1.setTransferStatus(PRODUCT_STATUS);
Product p2 = new Product();
p2.setProductId(PRODUCT_ID_2);
p2.setProductName(PRODUCT_NAME_2);
p2.setProductType(pt);
p2.setProductStructure(PRODUCT_STRUCTURE);
p2.setTransferStatus(PRODUCT_STATUS);
Product p3 = new Product();
p3.setProductId(PRODUCT_ID_3);
p3.setProductName(PRODUCT_NAME_3);
p3.setProductType(pt);
p3.setProductStructure(PRODUCT_STRUCTURE);
p3.setTransferStatus(PRODUCT_STATUS);
pp.setPageProducts(Lists.newArrayList(p1, p2, p3));
return pp;
}
示例11: getNextPage
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
@Override
public ProductPage getNextPage(ProductType pt, ProductPage currentPage) {
ProductPage pp = new ProductPage();
pp.setPageNum(currentPage.getPageNum() + 1);
pp.setTotalPages(currentPage.getTotalPages());
pp.setPageSize(currentPage.getPageSize());
Product p4 = new Product();
p4.setProductId(PRODUCT_ID_4);
p4.setProductName(PRODUCT_NAME_4);
p4.setProductType(pt);
p4.setProductStructure(PRODUCT_STRUCTURE);
p4.setTransferStatus(PRODUCT_STATUS);
pp.setPageProducts(Lists.newArrayList(p4));
return pp;
}
示例12: getPrevPage
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
@Override
public ProductPage getPrevPage(ProductType pt, ProductPage currentPage) {
ProductPage pp = new ProductPage();
pp.setPageNum(currentPage.getPageNum() - 1);
pp.setTotalPages(currentPage.getTotalPages());
pp.setPageSize(currentPage.getPageSize());
Product p4 = new Product();
p4.setProductId(PRODUCT_ID_4);
p4.setProductName(PRODUCT_NAME_4);
p4.setProductType(pt);
p4.setProductStructure(PRODUCT_STRUCTURE);
p4.setTransferStatus(PRODUCT_STATUS);
pp.setPageProducts(Lists.newArrayList(p4));
return pp;
}
示例13: getCurrentFileTransfer
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
@Override
public FileTransferStatus getCurrentFileTransfer() {
lastMethodCallDetails = new MethodCallDetails("getCurrentFileTransfer",
Lists.newArrayList());
FileTransferStatus status = new FileTransferStatus();
status.setBytesTransferred(10);
status.setFileRef(new Reference("file:/orig/file", "file:/ds/file", 4));
Product p = new Product();
p.setProductId("TestProductId");
status.setParentProduct(p);
return status;
}
示例14: testXmlMarshalling
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
/**
* Tests that {@link TransferResource transfer resources} are marshalled to
* the expected XML format.
* @throws IOException if the {@link Diff} constructor fails
* @throws JAXBException if the {@link JAXBContext} or {@link Marshaller} fail
* @throws MimeTypeException if {@link MimeTypes#forName(String)} fails
* @throws SAXException if the {@link Diff} constructor fails
*/
@Test
public void testXmlMarshalling() throws IOException, JAXBException,
MimeTypeException, SAXException
{
// Create a TransferResource using ProductType, Product, Metadata, Reference
// and FileTransferStatus instances.
Hashtable metadataEntries = new Hashtable<String, Object>();
metadataEntries.put("CAS.ProductReceivedTime", "2013-09-12T16:25:50.662Z");
Metadata metadata = new Metadata();
metadata.addMetadata(metadataEntries);
Reference reference = new Reference("original", "dataStore", 1000,
new MimeTypes().forName("text/plain"));
ProductType productType = new ProductType("1", "GenericFile", "test type",
"repository", "versioner");
Product product = new Product();
product.setProductId("123");
product.setProductName("test product");
product.setProductStructure(Product.STRUCTURE_FLAT);
product.setProductType(productType);
FileTransferStatus status = new FileTransferStatus(reference, 1000, 100,
product);
TransferResource resource = new TransferResource(product, metadata, status);
// Generate the expected output.
String expectedXml =
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"
+ "<transfer>"
+ "<productName>" + product.getProductName() + "</productName>"
+ "<productId>" + product.getProductId() + "</productId>"
+ "<productTypeName>" + productType.getName() + "</productTypeName>"
+ "<dataStoreReference>"
+ reference.getDataStoreReference()
+ "</dataStoreReference>"
+ "<origReference>"
+ reference.getOrigReference()
+ "</origReference>"
+ "<mimeType>" + reference.getMimeType().getName() + "</mimeType>"
+ "<fileSize>" + reference.getFileSize() + "</fileSize>"
+ "<totalBytes>" + reference.getFileSize() + "</totalBytes>"
+ "<bytesTransferred>"
+ status.getBytesTransferred()
+ "</bytesTransferred>"
+ "<percentComplete>"
+ status.computePctTransferred() * 100
+ "</percentComplete>"
+ "<productReceivedTime>"
+ metadata.getAllValues().get(0)
+ "</productReceivedTime>"
+ "</transfer>";
// Set up a JAXB context and marshall the DatasetResource to XML.
JAXBContext context = JAXBContext.newInstance(resource.getClass());
Marshaller marshaller = context.createMarshaller();
StringWriter writer = new StringWriter();
marshaller.marshal(resource, writer);
// Compare the expected and actual outputs.
XMLUnit.setIgnoreWhitespace(true);
XMLUnit.setIgnoreComments(true);
XMLUnit.setIgnoreAttributeOrder(true);
Diff diff = new Diff(expectedXml, writer.toString());
assertTrue("The output XML was different to the expected XML: "
+ diff.toString(), diff.identical());
}
示例15: testQuery
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
public void testQuery() throws Exception {
// ingest first file
Product testProduct = getTestProduct();
testProduct.setProductId("23");
Metadata prodMet = new Metadata();
URL ingestUrl = this.getClass().getResource(
"/ingest");
prodMet.addMetadata(CoreMetKeys.FILE_LOCATION, new File(
ingestUrl.getFile()).getCanonicalPath());
prodMet.addMetadata(CoreMetKeys.FILENAME, "test-file-1.txt");
prodMet.addMetadata("CAS.ProductName", "TestFile1");
prodMet.addMetadata(CoreMetKeys.PRODUCT_TYPE, "GenericFile");
prodMet.addMetadata("NominalDate", "2008-01-20");
prodMet.addMetadata("DataVersion", "3.6");
myCat.addMetadata(prodMet, testProduct);
// ingest second file
testProduct.setProductId("24");
prodMet.replaceMetadata(CoreMetKeys.FILENAME, "test-file-2.txt");
prodMet.replaceMetadata("CAS.ProductName", "TestFile2");
myCat.addMetadata(prodMet, testProduct);
// ingest thrid file
testProduct.setProductId("25");
prodMet.replaceMetadata(CoreMetKeys.FILENAME, "test-file-2.txt");
prodMet.replaceMetadata("CAS.ProductName", "TestFile3");
prodMet.replaceMetadata("DataVersion", "4.6");
myCat.addMetadata(prodMet, testProduct);
// perform first query
Query query = new Query();
query
.addCriterion(SqlParser
.parseSqlWhereClause("CAS.ProductName != 'TestFile3' AND (Filename == 'test-file-1.txt' OR Filename == 'test-file-2.txt') AND CAS.ProductName != 'TestFile2'"));
System.out.println(query);
List<String> productIds = myCat.query(query, testProduct
.getProductType());
System.out.println(productIds);
assertEquals("[23]", productIds.toString());
// perform second query
query = new Query();
query
.addCriterion(SqlParser
.parseSqlWhereClause("Filename == 'test-file-1.txt' OR (Filename == 'test-file-2.txt' AND CAS.ProductName != 'TestFile2')"));
System.out.println(query);
productIds = myCat.query(query, testProduct.getProductType());
System.out.println(productIds);
assertEquals("[25, 23]", productIds.toString());
// perform second query
query = new Query();
query
.addCriterion(SqlParser
.parseSqlWhereClause("NominalDate == '2008-01-20' AND DataVersion >= '3.6' AND DataVersion <= '4.0'"));
System.out.println(query);
productIds = myCat.query(query, testProduct.getProductType());
System.out.println(productIds);
assertEquals("[24, 23]", productIds.toString());
}