Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * #%L
   * BroadleafCommerce Framework
   * %%
   * Copyright (C) 2009 - 2013 Broadleaf Commerce
   * %%
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
  * 
  *       http://www.apache.org/licenses/LICENSE-2.0
  * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * #L%
  */
 package org.broadleafcommerce.core.order.dao;
 
 
 import java.util.List;
 
 @Repository("blFulfillmentGroupDao")
 public class FulfillmentGroupDaoImpl implements FulfillmentGroupDao {
 
     @PersistenceContext(unitName = "blPU")
     protected EntityManager em;
 
     @Resource(name="blEntityConfiguration")
 
     @Override
     public FulfillmentGroup save(final FulfillmentGroup fulfillmentGroup) {
         return .merge(fulfillmentGroup);
     }
 
     @Override
     public FulfillmentGroup readFulfillmentGroupById(final Long fulfillmentGroupId) {
         return .find(FulfillmentGroupImpl.classfulfillmentGroupId);
     }
 
     @Override
         final Query query = .createNamedQuery("BC_READ_DEFAULT_FULFILLMENT_GROUP_BY_ORDER_ID");
         query.setParameter("orderId"order.getId());
         @SuppressWarnings("unchecked")
         List<FulfillmentGroupImplfulfillmentGroups = query.getResultList();
         return fulfillmentGroups == null || fulfillmentGroups.isEmpty() ? null : fulfillmentGroups.get(0);
     }
 
     @Override
     public void delete(FulfillmentGroup fulfillmentGroup) {
         if (!.contains(fulfillmentGroup)) {
             fulfillmentGroup = readFulfillmentGroupById(fulfillmentGroup.getId());
         }
         .remove(fulfillmentGroup);
     }
 
     @Override
     public FulfillmentGroup createDefault() {
         final FulfillmentGroup fg = ((FulfillmentGroup.createEntityInstance("org.broadleafcommerce.core.order.domain.FulfillmentGroup"));
         fg.setPrimary(true);
         return fg;
     }
 
     @Override
     public FulfillmentGroup create() {
         final FulfillmentGroup fg =  ((FulfillmentGroup.createEntityInstance("org.broadleafcommerce.core.order.domain.FulfillmentGroup"));
         return fg;
     }
 
     @Override
         return ((FulfillmentGroupFee.createEntityInstance("org.broadleafcommerce.core.order.domain.FulfillmentGroupFee"));
     }
 
     @SuppressWarnings("unchecked")
     @Override
             int maxResults) {
         Query query = .createNamedQuery("BC_READ_UNFULFILLED_FULFILLMENT_GROUP_ASC");
         query.setFirstResult(start);
         query.setMaxResults(maxResults);
         return query.getResultList();
     }
 
    @SuppressWarnings("unchecked")
    @Override
            int maxResults) {
        Query query = .createNamedQuery("BC_READ_PARTIALLY_FULFILLED_FULFILLMENT_GROUP_ASC");
        query.setFirstResult(start);
        query.setMaxResults(maxResults);
        
        return query.getResultList();
    }
    @SuppressWarnings("unchecked")
    @Override
            int maxResults) {
        Query query = .createNamedQuery("BC_READ_UNPROCESSED_FULFILLMENT_GROUP_ASC");
        query.setFirstResult(start);
        query.setMaxResults(maxResults);
        
        return query.getResultList();
    }
    @SuppressWarnings("unchecked")
    @Override
            FulfillmentGroupStatusType statusint startint maxResultsboolean ascending) {
        Query query = null;
        if (ascending) {
            query = .createNamedQuery("BC_READ_FULFILLMENT_GROUP_BY_STATUS_ASC");
        } else {
            query = .createNamedQuery("BC_READ_FULFILLMENT_GROUP_BY_STATUS_DESC");
        }
        query.setParameter("status"status.getType());
        query.setFirstResult(start);
        query.setMaxResults(maxResults);
        
        return query.getResultList();
    }
    @Override
            FulfillmentGroupStatusType statusint startint maxResults) {
        return readFulfillmentGroupsByStatus(statusstartmaxResultstrue);
    }
    @SuppressWarnings("unchecked")
    @Override
        Query query = .createNamedQuery("BC_READ_MAX_FULFILLMENT_GROUP_SEQUENCE");
        query.setParameter("orderId"order.getId());
        List<Integermax = query.getResultList();
        if (max != null && !max.isEmpty()) {
            Integer maxNumber = max.get(0);
            if (maxNumber == null) {
                return 1;
            }
            return maxNumber + 1;
        }
        return 1;
    }
New to GrepCode? Check out our FAQ X