Package no.ugland.utransprod.service

Examples of no.ugland.utransprod.service.ConstructionTypeArticleManager


    Set<ArticleTypeAttribute> articleAttributes = articleType
        .getArticleTypeAttributes();
    Set<ConstructionTypeArticleAttribute> attributes;
    ConstructionTypeArticleAttribute newAttribute;

    ConstructionTypeArticleManager constructionTypeArticleManager = (ConstructionTypeArticleManager) ModelUtil
        .getBean("constructionTypeArticleManager");

    for (ConstructionTypeArticle consArticle : articles) {
      constructionTypeArticleManager.lazyLoad(consArticle,
          new LazyLoadEnum[][] { { LazyLoadEnum.ATTRIBUTES,
              LazyLoadEnum.NONE } });
      attributes = consArticle.getAttributes();
      for (ArticleTypeAttribute articleTypeAttribute : articleAttributes) {
        if (!constructionTypeHasAttribute(attributes,
            articleTypeAttribute)) {
          newAttribute = new ConstructionTypeArticleAttribute(null,
              consArticle, articleTypeAttribute,
              Util.convertNumberToBoolean(articleTypeAttribute
                  .getAttribute().getYesNo()) ? "Nei" : "",
              null);
          attributes.add(newAttribute);
        }
      }
      constructionTypeArticleManager
          .saveConstructionTypeArticle(consArticle);
    }
  }
View Full Code Here


   *
   */
  public static void setGavlKledning() {
    ConstructionTypeManager constructionTypeManager = (ConstructionTypeManager) ModelUtil
        .getBean("constructionTypeManager");
    ConstructionTypeArticleManager constructionTypeArticleManager = (ConstructionTypeArticleManager) ModelUtil
    .getBean("constructionTypeArticleManager");
    OrderLineManager orderLineManager = (OrderLineManager) ModelUtil
        .getBean("orderLineManager");
   

    List<ConstructionType> garasjer = constructionTypeManager.findAllIncludeMaster();

    Set<ConstructionTypeArticle> artikler;

    ConstructionTypeArticle gavl = null;
    ConstructionTypeArticle kledning = null;

    for (ConstructionType garasje : garasjer) {
      constructionTypeManager
          .lazyLoad(
              garasje,
              new LazyLoadConstructionTypeEnum[] { LazyLoadConstructionTypeEnum.CONSTRUCTION_TYPE_ARTICLE });
      artikler = garasje.getConstructionTypeArticles();


      for (ConstructionTypeArticle artikkel : artikler) {
       
        if (artikkel.getArticleName().equalsIgnoreCase("Gavl")) {
          gavl = artikkel;
          break;

        }
      }
     
     

      ConstructionTypeArticle gavlkledning = null;

      for (ConstructionTypeArticle artikkel : artikler) {
        Set<ConstructionTypeArticle> gavlkledningArtikler;
        if (artikkel.getArticleName().equalsIgnoreCase("Gavlkledning")) {
          gavlkledning = artikkel;
          constructionTypeManager
              .lazyLoadArticle(
                  artikkel,
                  new LazyLoadConstructionTypeArticleEnum[] { LazyLoadConstructionTypeArticleEnum.CONSTRUCTION_TYPE_ARTICLES });
          gavlkledningArtikler = artikkel
              .getConstructionTypeArticles();

          for (ConstructionTypeArticle gavlkledningArtikkel : gavlkledningArtikler) {
            if (gavlkledningArtikkel.getArticleName()
                .equalsIgnoreCase("Kledning")) {
              gavlkledningArtikkel
                  .setConstructionTypeArticleRef(gavl);
              kledning=gavlkledningArtikkel;
            }

          }
         
          if(kledning!=null){
          constructionTypeArticleManager.saveConstructionTypeArticle(kledning);
          }

          constructionTypeManager
              .lazyLoadArticle(
                  gavlkledning,
                  new LazyLoadConstructionTypeArticleEnum[] { LazyLoadConstructionTypeArticleEnum.ORDER_LINE });
          Set<OrderLine> orderLines = gavlkledning.getOrderLines();
          Order order = null;
          Set<OrderLine> orderOrderLines;
          OrderLine gavlOrderLine = null;

          for (OrderLine orderLine : orderLines) {
            order = orderLine.getOrder();
            orderLineManager
                .lazyLoadOrder(
                    order,
                    new LazyLoadOrderEnum[] { LazyLoadOrderEnum.ORDER_LINES });

            orderOrderLines = order.getOrderLines();

            gavlOrderLine=null;
            for (OrderLine orderOrderLine : orderOrderLines) {
              if (orderOrderLine.getArticleName()
                  .equalsIgnoreCase("Gavl")) {
                gavlOrderLine = orderOrderLine;
              }
            }

            //if(gavlOrderLine!=null){
           
            for (OrderLine orderOrderLine : orderOrderLines) {
              if (orderOrderLine.getArticlePath()
                  .equalsIgnoreCase("Gavlkledning$Kledning")) {
                if(gavlOrderLine==null){
                  gavlOrderLine=new OrderLine(null,orderOrderLine.getOrder(),gavl,null,null,null,null,null,null,null,"Gavl",null,1,null,null,null,null,null,null,null,null,null);
                  orderLineManager.saveOrderLine(gavlOrderLine);
                }
                orderOrderLine.setOrderLineRef(gavlOrderLine);
                orderOrderLine.setArticlePath("Gavl$Kledning");
                orderLineManager.saveOrderLine(orderOrderLine);
                orderLineManager.lazyLoadTree(gavlOrderLine);
                gavlOrderLine.setAttributeInfo(gavlOrderLine.getAttributesAsString());
                orderLineManager.saveOrderLine(gavlOrderLine);
              }
            }
            //}

            // gavlkledning.removeOrderLine(orderLine);

          }

          // garasje.removeConstructionArticle(gavlkledning);
          constructionTypeManager.saveConstructionType(garasje);

        }
      }
      constructionTypeArticleManager.saveConstructionTypeArticle(gavl);
    }
  }
View Full Code Here

TOP

Related Classes of no.ugland.utransprod.service.ConstructionTypeArticleManager

Copyright © 2018 www.massapicom. 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.