Examples of ProductType


Examples of org.apache.oodt.cas.filemgr.structs.ProductType

        if (typeList == null || (typeList != null && typeList.size() == 0)) {
            return false;
        }

        for (Iterator i = typeList.iterator(); i.hasNext();) {
            ProductType destType = (ProductType) i.next();
            if (destType.getProductTypeId().equals(type.getProductTypeId())
                    && destType.getName().equals(type.getName())) {
                return true;
            }
        }

        return false;
View Full Code Here

Examples of org.apache.oodt.cas.filemgr.structs.ProductType

      throws ServletException, java.io.IOException {

    // need to know the type of product to get products for
    String productTypeName = req.getParameter("type");
    String productTypeId = req.getParameter("id");
    ProductType type = null;

    List<Product> products = null;

    try {
      if (productTypeName.equals("ALL")) {
View Full Code Here

Examples of org.apache.oodt.cas.filemgr.structs.ProductType

      for (Iterator<Product> i = products.iterator(); i.hasNext();) {
        Product p = i.next();

        String productTypeIdStr = p.getProductType().getProductTypeId();
        ProductType productType = null;

        if (type != null) {
          productType = type;
        } else {
          try {
            productType = fClient.getProductTypeById(productTypeIdStr);
          } catch (RepositoryManagerException e) {
            e.printStackTrace();
            LOG.log(Level.SEVERE,
                "Unable to obtain product type from product type id: ["
                    + ((Product) products.get(0)).getProductType()
                        .getProductTypeId() + "]: Message: " + e.getMessage());
            return;
          }
        }

        p.setProductType(productType);

        Element productRdfDesc = XMLUtils.addNode(doc, rdf, this.rdfConf
            .getTypeNs(productType.getName())
            + ":" + productType.getName());
        XMLUtils.addAttribute(doc, productRdfDesc, "rdf:about", base
            + "?productID=" + p.getProductId());

        // now add all its metadata
        Metadata prodMetadata = safeGetMetadata(p);
View Full Code Here

Examples of org.apache.oodt.cas.filemgr.structs.ProductType

    List<Product> products = null;

    if (types != null && types.size() > 0) {
      products = new Vector<Product>();
      for (Iterator<ProductType> i = types.iterator(); i.hasNext();) {
        ProductType type = i.next();

        ProductPage page = null;

        try {
          page = fClient.getFirstPage(type);
View Full Code Here

Examples of org.apache.oodt.cas.filemgr.structs.ProductType

*
*/
public final class DbStructFactory {

    public static ProductType getProductType(ResultSet rs) throws SQLException {
        ProductType type = new ProductType();
        type.setDescription(rs.getString("product_type_description"));
        type.setName(rs.getString("product_type_name"));
        type.setProductRepositoryPath(rs
                .getString("product_type_repository_path"));
        type.setProductTypeId(String.valueOf(rs.getInt("product_type_id")));
        type.setVersioner(rs.getString("product_type_versioner_class"));

        return type;
    }
View Full Code Here

Examples of org.apache.oodt.cas.filemgr.structs.ProductType

        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;
    }
View Full Code Here

Examples of org.apache.oodt.cas.filemgr.structs.ProductType

    // need to know the type of product to get products for
    String productTypeName = req.getParameter("channel");
    String productTypeId = req.getParameter("id");
    String topN = req.getParameter("topn");
    ProductType type = null;
    int top = 20;

    if (topN != null) {
      top = Integer.valueOf(topN).intValue();
    }

    String requestUrl = req.getRequestURL().toString();
    String base = requestUrl.substring(0, requestUrl.lastIndexOf('/'));

    Metadata channelMet = new Metadata();
    channelMet.addMetadata("ProductType", productTypeName);
    channelMet.addMetadata("ProductTypeId", productTypeId);
    channelMet.addMetadata("TopN", String.valueOf(topN));
    channelMet.addMetadata("BaseUrl", base);

    List products = null;

    try {
      if (productTypeName.equals("ALL")) {
        products = fm.getTopNProducts(top);
      } else {

        try {
          type = fm.getProductTypeById(productTypeId);
        } catch (RepositoryManagerException e) {
          LOG.log(Level.SEVERE,
              "Unable to obtain product type from product type id: ["
                  + productTypeId + "]: Message: " + e.getMessage());
          return;
        }

        products = fm.getTopNProducts(top, type);
      }

    } catch (CatalogException e) {
      e.printStackTrace();
      LOG
          .log(Level.WARNING,
              "Exception getting products from Catalog: Message: "
                  + e.getMessage());
      return;
    }

    if (products != null && products.size() > 0) {
      String channelDesc = null;

      if (!productTypeName.equals("ALL")) {
        channelDesc = type.getDescription();
      } else {
        channelDesc = "ALL";
      }

      try {

        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        factory.setNamespaceAware(true);
        Document doc = factory.newDocumentBuilder().newDocument();

        Element rss = XMLUtils.addNode(doc, doc, "rss");
        XMLUtils.addAttribute(doc, rss, "version", "2.0");
        XMLUtils
            .addAttribute(doc, rss, "xmlns:cas", (String) NS_MAP.get("cas"));
        Element channel = XMLUtils.addNode(doc, rss, "channel");

        XMLUtils.addNode(doc, channel, "title", productTypeName);
        XMLUtils.addNode(doc, channel, "link", RSSUtils.getChannelLink(
            this.conf.getChannelLink(), channelMet));
        XMLUtils.addNode(doc, channel, "description", channelDesc);

        String buildPubDate = dateFormatter.format(new Date());

        XMLUtils.addNode(doc, channel, "language", "en-us");
        XMLUtils.addNode(doc, channel, "copyright", COPYRIGHT_BOILER_PLATE);
        XMLUtils.addNode(doc, channel, "pubDate", buildPubDate);
        XMLUtils.addNode(doc, channel, "category", productTypeName);
        XMLUtils.addNode(doc, channel, "generator", "CAS File Manager");
        XMLUtils.addNode(doc, channel, "lastBuildDate", buildPubDate);

        for (Iterator i = products.iterator(); i.hasNext();) {
          Product p = (Product) i.next();

          String productTypeIdStr = p.getProductType().getProductTypeId();
          ProductType productType = null;

          try {
            productType = fm.getProductTypeById(productTypeIdStr);
          } catch (RepositoryManagerException e) {
            e.printStackTrace();
View Full Code Here

Examples of org.apache.oodt.cas.filemgr.structs.ProductType

   */
  protected void doPut(HttpServletRequest req, HttpServletResponse res)
      throws ServletException, IOException {

    String typeID = req.getParameter("typeID");
    ProductType type = null;

    if (typeID == null) {
      throw new IllegalArgumentException("No typeID parameter specified!");
    }

    try {
      type = client.getProductTypeById(typeID);
    } catch (Exception e) {
      throw new ServletException("Unable to deduce product type: [" + typeID
          + "]: Message: " + e.getMessage());
    }

    // create a temporary product dir: we'll use working dir + typeName
    String productDirPath = workingDirPath + type.getName();
    if (!new File(productDirPath).mkdirs()) {
      LOG.log(Level.WARNING,
          "mkdirs returned false for temporary dataset dir: [" + productDirPath
              + "]: errors may follow");
    }

    // use the pagination API to iterate over each product
    // for each product, zip it up
    // after you zip up all products then create the dataset zip

    ProductPage page = null;

    try {
      page = client.getFirstPage(type);
      if (page == null
          || (page != null && page.getPageProducts() == null)
          || (page != null && page.getPageProducts() != null && page
              .getPageProducts().size() == 0)) {
        throw new ServletException("No products for dataset: ["
            + type.getName() + "]");
      }

      Map productHash = new HashMap();

      do {
View Full Code Here

Examples of org.apache.oodt.cas.filemgr.structs.ProductType

    // need to know the type of product to get products for
    String productTypeName = req.getParameter("type");
    String productTypeId = req.getParameter("typeID");
    ProductTypeFilter filter = new ProductTypeFilter(req.getParameter("filter"));
    ProductType type = null;

    List<ProductType> productTypes = new Vector<ProductType>();

    if (productTypeName.equals("ALL")) {
      productTypes = safeGetProductTypes();
View Full Code Here

Examples of org.apache.oodt.cas.filemgr.structs.ProductType

      Element rdf = XMLUtils.addNode(doc, doc, "rdf:RDF");
      RDFUtils.addNamespaces(doc, rdf, this.rdfConf);

      for (Iterator<ProductType> i = productTypes.iterator(); i.hasNext();) {
        ProductType type = i.next();
       
        Element productTypeRdfDesc = XMLUtils.addNode(doc, rdf, this.rdfConf
            .getTypeNs(type.getName())
            + ":" + type.getName());
        XMLUtils.addAttribute(doc, productTypeRdfDesc, "rdf:about", base
            + "?typeID=" + type.getProductTypeId());

        // for all of its metadata keys and values, loop through them
        // and add RDF nodes underneath the RdfDesc for this product

        if (type.getTypeMetadata() != null) {
          for (Iterator<String> j = type.getTypeMetadata().getHashtable().keySet()
              .iterator(); j.hasNext();) {
            String key = (String) j.next();

            List<String> vals = type.getTypeMetadata().getAllMetadata(key);

            if (vals != null && vals.size() > 0) {

              for (Iterator<String> k = vals.iterator(); k.hasNext();) {
                String val = (String) k.next();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.