private String getFilePathSpec(ProductType productType) throws VersioningException { String fileSpec = properties.getProperty(BASE_PROPERTY + productType.getName().toLowerCase()); if (Strings.isNullOrEmpty(fileSpec)) { fileSpec = properties.getProperty(BASE_PROPERTY + ALL); if (Strings.isNullOrEmpty(fileSpec)) { throw new VersioningException("Not defined for product type " + productType.getName()); } } return fileSpec; } }
private String getFilePathSpec(ProductType productType) throws VersioningException { String fileSpec = properties.getProperty(BASE_PROPERTY + productType.getName().toLowerCase()); if (Strings.isNullOrEmpty(fileSpec)) { fileSpec = properties.getProperty(BASE_PROPERTY + ALL); if (Strings.isNullOrEmpty(fileSpec)) { throw new VersioningException("Not defined for product type " + productType.getName()); } } return fileSpec; } }
/** * Suppresses exception that occurred with older file managers. */ private ProductPage safeFirstPage(XmlRpcFileManagerClient fmClient, ProductType type) { ProductPage page = null; try { page = fmClient.getFirstPage(type); } catch (Exception e) { LOG.info("No products found for: " + type.getName()); } return page; }
private List<Element> quietGetElements(ProductType type) { List<Element> elementList = new Vector<Element>(); try { elementList = valLayer.getElements(type); } catch (Exception e) { LOG.log(Level.WARNING, "Exception obtaining elements for product type: [" + type.getName() + "]: Message: " + e.getMessage()); } return elementList; }
private List<Element> quietGetElements(ProductType type) { List<Element> elementList = new Vector<Element>(); try { elementList = valLayer.getElements(type); } catch (Exception e) { LOG.log(Level.WARNING, "Exception obtaining elements for product type: [" + type.getName() + "]: Message: " + e.getMessage()); } return elementList; }
@Override public List<Product> getProductsByProductType(ProductType type) throws CatalogException { // build query parameters Map<String, String[]> params = new ConcurrentHashMap<String, String[]>(); params.put("q", new String[] { "*:*" } ); // use the product type name as query parameter params.put("fq", new String[] { Parameters.PRODUCT_TYPE_NAME+":"+type.getName() } ); // query Solr for all matching products return getProducts(params, 0, -1).getProducts(); // get ALL products }
public List<Element> safeGetElementsForProductType(ProductType type) { if (!isConnected()) return Collections.EMPTY_LIST; try { return fm.getElementsByProductType(type); } catch (Exception e) { LOG.log(Level.WARNING, "Unable to obtain elements for product type: [" + type.getName() + "]: Reason: " + e.getMessage()); return new Vector<Element>(); } }
@Override public List<Product> getProductsByProductType(ProductType type) throws CatalogException { // build query parameters Map<String, String[]> params = new ConcurrentHashMap<String, String[]>(); params.put("q", new String[] { "*:*" } ); // use the product type name as query parameter params.put("fq", new String[] { Parameters.PRODUCT_TYPE_NAME+":"+type.getName() } ); // query Solr for all matching products return getProducts(params, 0, -1).getProducts(); // get ALL products }
@Override public int getNumProducts(ProductType type) throws CatalogException { // build query parameters Map<String, String[]> params = new ConcurrentHashMap<String, String[]>(); params.put("q", new String[] { "CAS.ProductTypeName:"+type.getName() } ); params.put("rows", new String[] { "0" } ); // don't return any results // execute query String response = solrClient.query(params, productSerializer.getMimeType()); // parse response QueryResponse queryResponse = productSerializer.deserialize(response); return queryResponse.getNumFound(); }
@Override public List<String> query(Query query, ProductType type) throws CatalogException { String origProductTypeName = type.getName(); type.setName(getProductTypeTableName(origProductTypeName)); List<String> results = super.query(query, type); type.setName(origProductTypeName); return results; }
@Override public ProductPage pagedQuery(Query query, ProductType type, int pageNum) throws CatalogException { String origProductTypeName = type.getName(); type.setName(getProductTypeTableName(origProductTypeName)); ProductPage page = super.pagedQuery(query, type, pageNum); type.setName(origProductTypeName); return page; }
@Override public List<String> query(Query query, ProductType type) throws CatalogException { String origProductTypeName = type.getName(); type.setName(getProductTypeTableName(origProductTypeName)); List<String> results = super.query(query, type); type.setName(origProductTypeName); return results; }
@Override public ProductPage pagedQuery(Query query, ProductType type, int pageNum) throws CatalogException { String origProductTypeName = type.getName(); type.setName(getProductTypeTableName(origProductTypeName)); ProductPage page = super.pagedQuery(query, type, pageNum); type.setName(origProductTypeName); return page; }
public Metadata getMetadata(Product product) throws CatalogException { Metadata met = new Metadata(); met.addMetadata("Filename", product.getProductName()); met.addMetadata("ProductType", product.getProductType().getName()); met.addMetadata("FileLocation", "Unknown"); met.addMetadata("CAS.ProductReceivedTime", DateUtils.toString(Calendar.getInstance())); return met; }
@Override public synchronized void removeMetadata(Metadata metadata, Product product) throws CatalogException { String origProductTypeName = product.getProductType().getName(); product.getProductType().setName( getProductTypeTableName(origProductTypeName)); super.removeMetadata(metadata, product); product.getProductType().setName(origProductTypeName); }
@Override public synchronized void addProductReferences(Product product) throws CatalogException { String origProductTypeName = product.getProductType().getName(); product.getProductType().setName( getProductTypeTableName(origProductTypeName)); super.addProductReferences(product); product.getProductType().setName(origProductTypeName); }
@Override public synchronized void modifyProduct(Product product) throws CatalogException { String origProductTypeName = product.getProductType().getName(); product.getProductType().setName( getProductTypeTableName(origProductTypeName)); super.modifyProduct(product); product.getProductType().setName(origProductTypeName); }
@Override public synchronized void modifyProduct(Product product) throws CatalogException { String origProductTypeName = product.getProductType().getName(); product.getProductType().setName( getProductTypeTableName(origProductTypeName)); super.modifyProduct(product); product.getProductType().setName(origProductTypeName); }
@Override public List<Reference> getProductReferences(Product product) throws CatalogException { String origProductTypeName = product.getProductType().getName(); product.getProductType().setName( getProductTypeTableName(origProductTypeName)); List<Reference> refs = super.getProductReferences(product); product.getProductType().setName(origProductTypeName); return refs; }
@Override public synchronized void addMetadata(Metadata metadata, Product product) throws CatalogException { String origProductTypeName = product.getProductType().getName(); product.getProductType().setName( getProductTypeTableName(origProductTypeName)); super.addMetadata(metadata, product); product.getProductType().setName(origProductTypeName); }