Examples of ProductType


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

                    || typeRepo == null) {
                System.err.println(addProductTypeOperation);
                System.exit(1);
            }

            ProductType type = new ProductType();
            type.setName(typeName);
            type.setDescription(typeDesc);
            type.setProductRepositoryPath(typeRepo);
            type.setVersioner(typeVers);

            System.out.println("addProductType: Result: "
                    + client.addProductType(type));

        } else if (operation.equals("--ingestProduct")) {
            String productName = null, productStructure = null, productTypeName = null, metadataFileName = null;
            boolean clientTransfer = false;
            String dataTransferClass = null;
            Vector<String> refs = null;

            for (int i = 4; i < args.length; i++) {
                if (args[i].equals("--productName")) {
                    productName = args[++i];
                } else if (args[i].equals("--productStructure")) {
                    productStructure = args[++i];
                } else if (args[i].equals("--productTypeName")) {
                    productTypeName = args[++i];
                } else if (args[i].equals("--metadataFile")) {
                    metadataFileName = args[++i];
                } else if (args[i].equals("--refs")) {
                    refs = new Vector<String>();
                    for (int j = i + 1; j < args.length; j++) {
                        refs.add(args[j]);
                    }
                } else if (args[i].equals("--clientTransfer")) {
                    clientTransfer = true;
                } else if (args[i].equals("--dataTransfer")) {
                    dataTransferClass = args[++i];
                }
            }

            if (productName == null || productStructure == null
                    || productTypeName == null || metadataFileName == null
                    || refs == null
                    || (clientTransfer && dataTransferClass == null)) {
                System.err.println(ingestProductOperation);
                System.exit(1);
            }

            Product product = new Product();
            product.setProductName(productName);
            product.setProductStructure(productStructure);
            product
                    .setProductType(client
                            .getProductTypeByName(productTypeName));

            if (clientTransfer) {
                client.setDataTransfer(GenericFileManagerObjectFactory
                        .getDataTransferServiceFromFactory(dataTransferClass));
            }

            // need to build up the ref uri list in case the Product structure
            // is
            // heirarchical
            if (product.getProductStructure().equals(
                    Product.STRUCTURE_HIERARCHICAL)) {
                String ref = (String) refs.get(0);
                refs.addAll(VersioningUtils.getURIsFromDir(new File(
                        new URI(ref))));
            }

            // add Product References from the URI list
            VersioningUtils.addRefsFromUris(product, refs);

            try {
                Metadata metadata = null;
                URL metaUrl = new File(new URI(metadataFileName)).toURL();
                metadata = new SerializableMetadata(metaUrl.openStream());
                System.out.println("ingestProduct: Result: "
                        + client.ingestProduct(product, metadata,
                                clientTransfer));
            } catch (Exception e) {
                e.printStackTrace();
                LOG.log(Level.SEVERE, "Exception ingesting product!: Message: "
                        + e.getMessage());
                throw new RuntimeException(e);
            }

        } else if (operation.equals("--hasProduct")) {
            String productName = null;

            for (int i = 4; i < args.length; i++) {
                if (args[i].equals("--productName")) {
                    productName = args[++i];
                }
            }

            if (productName == null) {
                System.err.println(hasProductOperation);
                System.exit(1);
            }

            try {
                System.out.println("hasProduct: Result: "
                        + client.hasProduct(productName));
            } catch (Exception e) {
                e.printStackTrace();
                throw new RuntimeException(e);
            }
        } else if (operation.equals("--getProductTypeByName")) {
            String productTypeName = null;

            for (int i = 4; i < args.length; i++) {
                if (args[i].equals("--productTypeName")) {
                    productTypeName = args[++i];
                }
            }

            if (productTypeName == null) {
                System.err.println(getProductTypeByNameOperation);
                System.exit(1);
            }

            try {
                ProductType type = client.getProductTypeByName(productTypeName);
                System.out.println("getProductTypeByName: Result: [name="
                        + type.getName() + ", description="
                        + type.getDescription() + ", id="
                        + type.getProductTypeId() + ", versionerClass="
                        + type.getVersioner() + ", repositoryPath="
                        + type.getProductRepositoryPath() + "]");
            } catch (Exception e) {
                e.printStackTrace();
                throw new RuntimeException(e);
            }
        } else if (operation.equals("--getNumProducts")) {
            String typeName = null;

            for (int i = 4; i < args.length; i++) {
                if (args[i].equals("--productTypeName")) {
                    typeName = args[++i];
                }
            }

            if (typeName == null) {
                System.err.println(getNumProductsOperation);
                System.exit(1);
            }

            try {
                System.out.println("Type: ["
                        + typeName
                        + "], Num Products: ["
                        + client.getNumProducts(client
                                .getProductTypeByName(typeName)) + "]");
            } catch (Exception e) {
                e.printStackTrace();
                throw new RuntimeException(e);
            }
        } else if (operation.equals("--getFirstPage")) {
            String typeName = null;

            for (int i = 4; i < args.length; i++) {
                if (args[i].equals("--productTypeName")) {
                    typeName = args[++i];
                }
            }

            if (typeName == null) {
                System.err.println(getFirstPageOperation);
                System.exit(1);
            }

            try {
                ProductType type = client.getProductTypeByName(typeName);
                ProductPage firstPage = client.getFirstPage(type);

                System.out.println("Page: [num=" + firstPage.getPageNum()
                        + ", totalPages=" + firstPage.getTotalPages()
                        + ", pageSize=" + firstPage.getPageSize() + "]");
                System.out.println("Products:");

                if (firstPage.getPageProducts() != null
                        && firstPage.getPageProducts().size() > 0) {
                    for (Iterator<Product> i = firstPage.getPageProducts()
                            .iterator(); i.hasNext();) {
                        Product p = i.next();
                        System.out.println("Product: [id=" + p.getProductId()
                                + ",name=" + p.getProductName() + ",type="
                                + p.getProductType().getName() + ",structure="
                                + p.getProductStructure() + ", transferStatus="
                                + p.getTransferStatus() + "]");
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
                throw new RuntimeException(e);
            }

        } else if (operation.equals("--getNextPage")) {
            String typeName = null;
            int currentPageNum = -1;

            for (int i = 4; i < args.length; i++) {
                if (args[i].equals("--productTypeName")) {
                    typeName = args[++i];
                } else if (args[i].equals("--currentPageNum")) {
                    currentPageNum = Integer.parseInt(args[++i]);
                }
            }

            if (typeName == null || currentPageNum == -1) {
                System.err.println(getNextPageOperation);
                System.exit(1);
            }

            try {
                ProductType type = client.getProductTypeByName(typeName);
                ProductPage firstPage = client.getFirstPage(type);
                ProductPage currentPage = new ProductPage();
                currentPage.setPageNum(currentPageNum);
                currentPage.setPageSize(firstPage.getPageSize());
                currentPage.setTotalPages(firstPage.getTotalPages());
                ProductPage nextPage = client.getNextPage(type, currentPage);

                System.out.println("Page: [num=" + nextPage.getPageNum()
                        + ", totalPages=" + nextPage.getTotalPages()
                        + ", pageSize=" + nextPage.getPageSize() + "]");
                System.out.println("Products:");

                if (nextPage.getPageProducts() != null
                        && nextPage.getPageProducts().size() > 0) {
                    for (Iterator<Product> i = nextPage.getPageProducts()
                            .iterator(); i.hasNext();) {
                        Product p = i.next();
                        System.out.println("Product: [id=" + p.getProductId()
                                + ",name=" + p.getProductName() + ",type="
                                + p.getProductType().getName() + ",structure="
                                + p.getProductStructure() + ", transferStatus="
                                + p.getTransferStatus() + "]");
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
                throw new RuntimeException(e);
            }
        } else if (operation.equals("--getPrevPage")) {
            String typeName = null;
            int currentPageNum = -1;

            for (int i = 4; i < args.length; i++) {
                if (args[i].equals("--productTypeName")) {
                    typeName = args[++i];
                } else if (args[i].equals("--currentPageNum")) {
                    currentPageNum = Integer.parseInt(args[++i]);
                }
            }

            if (typeName == null || currentPageNum == -1) {
                System.err.println(getNextPageOperation);
                System.exit(1);
            }

            try {
                ProductType type = client.getProductTypeByName(typeName);
                ProductPage firstPage = client.getFirstPage(type);
                ProductPage currentPage = new ProductPage();
                currentPage.setPageNum(currentPageNum);
                currentPage.setPageSize(firstPage.getPageSize());
                currentPage.setTotalPages(firstPage.getTotalPages());
                ProductPage prevPage = client.getPrevPage(type, currentPage);

                System.out.println("Page: [num=" + prevPage.getPageNum()
                        + ", totalPages=" + prevPage.getTotalPages()
                        + ", pageSize=" + prevPage.getPageSize() + "]");
                System.out.println("Products:");

                if (prevPage.getPageProducts() != null
                        && prevPage.getPageProducts().size() > 0) {
                    for (Iterator<Product> i = prevPage.getPageProducts()
                            .iterator(); i.hasNext();) {
                        Product p = i.next();
                        System.out.println("Product: [id=" + p.getProductId()
                                + ",name=" + p.getProductName() + ",type="
                                + p.getProductType().getName() + ",structure="
                                + p.getProductStructure() + ", transferStatus="
                                + p.getTransferStatus() + "]");
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
                throw new RuntimeException(e);
            }
        } else if (operation.equals("--getLastPage")) {
            String typeName = null;

            for (int i = 4; i < args.length; i++) {
                if (args[i].equals("--productTypeName")) {
                    typeName = args[++i];
                }
            }

            if (typeName == null) {
                System.err.println(getLastPageOperation);
                System.exit(1);
            }

            try {
                ProductType type = client.getProductTypeByName(typeName);
                ProductPage lastPage = client.getLastPage(type);

                System.out.println("Page: [num=" + lastPage.getPageNum()
                        + ", totalPages=" + lastPage.getTotalPages()
                        + ", pageSize=" + lastPage.getPageSize() + "]");
View Full Code Here

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

    public List findProfiles(XMLQuery query) throws ProfileException {
        List profs = new Vector();

        if (productTypeFilter != null && productTypeFilter.size() > 0) {
            for (Iterator i = productTypeFilter.iterator(); i.hasNext();) {
                ProductType type = (ProductType) i.next();
                Query cQuery = convertQuery(query);

                profs.addAll(queryAndBuildProfiles(type, cQuery));
            }
        }
View Full Code Here

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

        return products;
    }

    private ProductType safeGetProductTypeByName(String name) {
        ProductType type = null;

        try {
            type = fmClient.getProductTypeByName(name);
        } catch (Exception e) {
            e.printStackTrace();
View Full Code Here

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

            // split the string on ","
            String[] typeNames = productTypeNames.split(",");

            if (typeNames != null) {
                for (int i = 0; i < typeNames.length; i++) {
                    ProductType type = safeGetProductTypeByName(typeNames[i]);
                    typeFilter.add(type);
                }
            } else {
                LOG.log(Level.WARNING,
                        "Unable to parse comma delimited type string: ["
View Full Code Here

Examples of org.blueoxygen.postila.materialmanagement.materialmanagementrules.entity.ProductType

  public String execute(){
    if(getProductType().getName() == null || "".equalsIgnoreCase(getProductType().getId())){
      addActionError("Name is required");
    }
   
    ProductType productType;
    if(getProductType().getId() == null || "".equalsIgnoreCase(getProductType().getId())){
      productType = new ProductType();
      logInfo = new LogInformation();
      logInfo.setCreateBy(sessionCredentials.getCurrentUser().getId());
      logInfo.setCreateDate(new Timestamp(System.currentTimeMillis()));
    } else {
      productType = new ProductType();
      logInfo = productType.getLogInformation();
    }

    logInfo.setActiveFlag(getActive());
    logInfo.setLastUpdateBy(sessionCredentials.getCurrentUser().getId());
    logInfo.setLastUpdateDate(new Timestamp(System.currentTimeMillis()));
   
   
    productType.setLogInformation(logInfo);
    productType.setName(getProductType().getName());
    productType.setDescription(getProductType().getDescription());
   
    manager.save(productType);
    setProductType(productType);
    return SUCCESS;
  }
View Full Code Here

Examples of org.drools.examples.templates.ProductType

    public void testCompiler() throws Exception {
        ArrayList<FeeScheduleRule> rules = new ArrayList<FeeScheduleRule>();
        FeeScheduleType standard = new FeeScheduleType( "STANDARD" );
        FeeScheduleType flat = new FeeScheduleType( "FLAT" );
        ProductType sblc = new ProductType( "SBLC" );
        ProductType rrc = new ProductType( "RRC" );
        ActivityType iss = new ActivityType( "ISS" );
        ActivityType osx = new ActivityType( "OSX" );
        FeeType commission = new FeeType( "Commission" );
        FeeType postage = new FeeType( "Postage" );
        FeeType telex = new FeeType( "Telex" );
View Full Code Here

Examples of oss.ngocminh.lego.data.ProductType

  protected void doGet(HttpServletRequest request,
      HttpServletResponse response) throws ServletException, IOException {
    try {
      Connection conn = getConnection();
      ProductDAO productDAO = new ProductDAO(conn);
      ProductType type = ProductType.valueOf(request.getParameter("type"));
      List<Entity> products = productDAO.findByType(type.name());
      productDAO.fetchImage(products);
      conn.close();
     
      request.setAttribute("type", type);
      request.setAttribute("products", products);
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.