本文整理汇总了Java中org.apache.oodt.cas.filemgr.structs.Product.setProductType方法的典型用法代码示例。如果您正苦于以下问题:Java Product.setProductType方法的具体用法?Java Product.setProductType怎么用?Java Product.setProductType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.oodt.cas.filemgr.structs.Product
的用法示例。
在下文中一共展示了Product.setProductType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
};
}
示例2: 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;
}
示例3: 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;
}
示例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: setUp
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
@Before
public void setUp() {
properties = new Properties();
properties.setProperty("org.apache.oodt.cas.filemgr.versioning.configuration.test_type",
"/[Year]/[Month]/[Day]/[Filename]");
versioner = new ConfigurableMetadataBasedFileVersioner(properties);
metadata = new Metadata();
metadata.addMetadata("Year", "2013");
metadata.addMetadata("Month", "03");
metadata.addMetadata("Day", "23");
metadata.addMetadata("Filename", "test.dat");
product = new Product();
product.setProductStructure(Product.STRUCTURE_FLAT);
ProductType pt = new ProductType();
pt.setProductRepositoryPath("file:/base/path");
pt.setName("TEST_TYPE");
product.setProductType(pt);
Reference ref = new Reference();
ref.setOrigReference("/path/to/file");
product.setProductReferences(Lists.newArrayList(ref));
}
示例6: quickPrintProductHealth
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
private void quickPrintProductHealth() {
if (getFmUp()) {
System.out.println("Latest " + TOP_N_PRODUCTS + " products ingested:");
List prods = this.fm.safeGetTopNProducts(TOP_N_PRODUCTS);
if (prods != null && prods.size() > 0) {
for (Object prod : prods) {
Product p = (Product) prod;
p.setProductType(fm.safeGetProductTypeById(p.getProductType()
.getProductTypeId()));
p.setProductReferences(fm.safeGetProductReferences(p));
Metadata prodMet = fm.safeGetMetadata(p);
System.out.println(fm.getFilePath(p) + " at: "
+ prodMet.getMetadata("CAS." + PRODUCT_RECEVIED_TIME));
}
}
}
}
示例7: 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;
}
示例8: toScienceDataProduct
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
public static Product toScienceDataProduct(ResultSet rs) throws SQLException {
Product product = new Product();
product.setProductId(rs.getString("granule_id"));
product.setProductName(rs.getString("filename"));
product.setProductStructure(Product.STRUCTURE_FLAT);
product.setTransferStatus(Product.STATUS_RECEIVED);
ProductType type = new ProductType();
type.setProductTypeId(rs.getString("dataset_id"));
product.setProductType(type);
return product;
}
示例9: setProductType
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
private void setProductType(List<Product> products) throws RepositoryManagerException {
if (products != null && products.size() > 0) {
for (Product p : products) {
p.setProductType(repositoryManager.getProductTypeById(p
.getProductType().getProductTypeId()));
}
}
}
示例10: testVersionerNoStatic
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
public void testVersionerNoStatic() {
String filePathSpec = "/[ProductType]/[ProductionDate]/[Filename]";
Product product = new Product();
product.setProductStructure(Product.STRUCTURE_FLAT);
ProductType type = new ProductType();
type.setProductRepositoryPath(productTypePath);
product.setProductType(type);
Metadata metadata = new Metadata();
metadata.addMetadata("ProductType", "FooFile");
metadata.addMetadata("ProductionDate", "060804");
metadata.addMetadata("Filename", "foo.txt");
Reference r = new Reference();
product.getProductReferences().add(r);
MetadataBasedFileVersioner versioner = new MetadataBasedFileVersioner(
filePathSpec);
try {
versioner.createDataStoreReferences(product, metadata);
} catch (VersioningException e) {
fail(e.getMessage());
}
String expected = "file:/foo/bar/FooFile/060804/foo.txt";
assertEquals("The reference: [" + r.getDataStoreReference()
+ "] is not equal to: [" + expected + "]", expected, r
.getDataStoreReference());
}
示例11: testVersionerWithStatic
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
public void testVersionerWithStatic() {
String filePathSpec = "/[ProductType]/some/other/path[ProductionDate]/[Filename]";
Product product = new Product();
product.setProductStructure(Product.STRUCTURE_FLAT);
ProductType type = new ProductType();
type.setProductRepositoryPath(productTypePath);
product.setProductType(type);
Metadata metadata = new Metadata();
metadata.addMetadata("ProductType", "FooFile");
metadata.addMetadata("ProductionDate", "060804");
metadata.addMetadata("Filename", "foo.txt");
Reference r = new Reference();
product.getProductReferences().add(r);
MetadataBasedFileVersioner versioner = new MetadataBasedFileVersioner(
filePathSpec);
try {
versioner.createDataStoreReferences(product, metadata);
} catch (VersioningException e) {
fail(e.getMessage());
}
String expected = "file:/foo/bar/FooFile/some/other/path060804/foo.txt";
assertEquals("The reference: [" + r.getDataStoreReference()
+ "] is not equal to: [" + expected + "]", expected, r
.getDataStoreReference());
}
示例12: testVersioning
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
public void testVersioning(){
Product product = new Product();
ProductType type = new ProductType();
type.setProductRepositoryPath(productRepoPath);
product.setProductStructure(Product.STRUCTURE_FLAT);
product.setProductType(type);
Metadata metadata = new Metadata();
metadata.addMetadata(SingleFileBasicVersioner.FILENAME_FIELD, "testfile.txt");
Reference r = new Reference();
r.setOrigReference(origFileRef);
product.getProductReferences().add(r);
SingleFileBasicVersioner versioner = new SingleFileBasicVersioner();
try{
versioner.createDataStoreReferences(product, metadata);
}
catch(VersioningException e){
fail(e.getMessage());
}
assertEquals("The generated ref: ["+r.getDataStoreReference()+"] is not equal to the expected ref: ["+expectedDestFileRef+"]", expectedDestFileRef, r.getDataStoreReference());
}
示例13: 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;
}
示例14: 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;
}
示例15: 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;
}