private void setProductType(List<Product> products) throws Exception { logger.debug("Setting product types for products: {}", products); if (products != null && products.size() > 0) { for (Iterator<Product> i = products.iterator(); i.hasNext();) { Product p = i.next(); try { p.setProductType(repositoryManager.getProductTypeById(p .getProductType().getProductTypeId())); } catch (RepositoryManagerException e) { logger.error("Unable to set product type for product: {}", p, e); throw new Exception(e.getMessage()); } } } }
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())); } } }
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())); } } }
public CompleteProduct() { product = new Product(); product.setProductType(new ProductType()); metadata = new Metadata(); }
public CompleteProduct() { product = new Product(); product.setProductType(new ProductType()); metadata = new Metadata(); }
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; }
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; }
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; }
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; }
@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; }
@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; }
@Override public void execute(ActionMessagePrinter printer) throws CmdLineActionException { try { Validate.notNull(productId, "Must specify productid"); Validate.notNull(productTypeName, "Must specify productTypeName"); XmlRpcFileManagerClient 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); } }
@Override public void execute(ActionMessagePrinter printer) throws CmdLineActionException { try (FileManagerClient client = getClient()) { Validate.notNull(productId, "Must specify productid"); Validate.notNull(productTypeName, "Must specify productTypeName"); 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); } }
public static Product getDefaultFlatProduct(String name, String defaultProductTypeId) { Product defaultProduct = new Product(); defaultProduct.setProductName(name); defaultProduct.setProductReferences(new Vector<Reference>()); defaultProduct.setProductStructure(Product.STRUCTURE_FLAT); ProductType pType = new ProductType(); pType.setProductTypeId(defaultProductTypeId); defaultProduct.setProductType(pType); defaultProduct.setTransferStatus(Product.STATUS_TRANSFER); return defaultProduct; }
public static Product getDefaultFlatProduct(String name, String defaultProductTypeId) { Product defaultProduct = new Product(); defaultProduct.setProductName(name); defaultProduct.setProductReferences(new Vector<Reference>()); defaultProduct.setProductStructure(Product.STRUCTURE_FLAT); ProductType pType = new ProductType(); pType.setProductTypeId(defaultProductTypeId); defaultProduct.setProductType(pType); defaultProduct.setTransferStatus(Product.STATUS_TRANSFER); return defaultProduct; }
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)); } } } }
private void printProductHealth(PCSHealthMonitorReport report) { if (report.getLatestProductsIngested() != null && report.getLatestProductsIngested().size() > 0) { System.out.println("Latest " + TOP_N_PRODUCTS + " products ingested:"); for (Object o : report.getLatestProductsIngested()) { Product p = (Product) o; 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)); } } }
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)); } } } }
private void printProductHealth(PCSHealthMonitorReport report) { if (report.getLatestProductsIngested() != null && report.getLatestProductsIngested().size() > 0) { System.out.println("Latest " + TOP_N_PRODUCTS + " products ingested:"); for (Object o : report.getLatestProductsIngested()) { Product p = (Product) o; 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)); } } }
public static Product getProduct(AvroProduct avroPoduct){ Product product = new Product(); product.setProductName(avroPoduct.getProductName()); if (avroPoduct.getProductType() != null) product.setProductType(getProductType(avroPoduct.getProductType())); product.setProductStructure(avroPoduct.getProductStructure()); product.setTransferStatus(avroPoduct.getTransferStatus()); //references if (avroPoduct.getReferences() != null) product.setProductReferences(getReferences(avroPoduct.getReferences())); product.setProductId(avroPoduct.getProductId()); if (avroPoduct.getRootRef() != null) product.setRootRef(getReference(avroPoduct.getRootRef())); return product; }