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.inventory.domain;
 
 
 import java.util.Date;
 
The Class SkuAvailabilityImpl is the default implementation of SkuAvailability.

This class is retrieved using the AvailabilityService. The service allows availability to be be location specific (e.g. for store specific inventory availability)

This implementation uses a Hibernate implementation of JPA configured through annotations. The Entity references the following tables: BLC_SKU_AVAILABILITY

Deprecated:
This is no longer required and is instead implemented as a third-party inventory module
Author(s):
bpolster
See also:
org.broadleafcommerce.core.catalog.domain.Sku
 
 @Table(name = "BLC_SKU_AVAILABILITY")
 @Cache(usage = ., region="blInventoryElements")
 public class SkuAvailabilityImpl implements SkuAvailability {

    
The Constant serialVersionUID.
 
     private static final long serialVersionUID = 1L;

    
The id.
 
     @Id
     @GeneratedValue(generator = "SkuAvailabilityId")
     @GenericGenerator(
         name="SkuAvailabilityId",
         strategy="org.broadleafcommerce.common.persistence.IdOverrideTableGenerator",
         parameters = {
             @Parameter(name="segment_value", value="SkuAvailabilityImpl"),
             @Parameter(name="entity_name", value="org.broadleafcommerce.core.inventory.domain.SkuAvailabilityImpl")
         }
     )
     @Column(name = "SKU_AVAILABILITY_ID")
     @AdminPresentation(friendlyName = "SkuAvailabilityImpl_Sku_Availability_ID", group = "SkuAvailabilityImpl_Primary_Key", visibility = .)
     protected Long id;

    
The sale price.
 
     @Column(name = "SKU_ID")
     @Index(name="SKUAVAIL_SKU_INDEX", columnNames={"SKU_ID"})
     @AdminPresentation(friendlyName = "SkuAvailabilityImpl_Sku_ID", visibility = .)
     protected Long skuId;

    
The retail price.
 
     @Column(name = "LOCATION_ID")
     @Index(name="SKUAVAIL_LOCATION_INDEX", columnNames={"LOCATION_ID"})
     @AdminPresentation(friendlyName = "SkuAvailabilityImpl_Location_ID", group = "SkuAvailabilityImpl_Description")
     protected Long locationId;

    
The quantity on hand.
 
     @Column(name = "QTY_ON_HAND")
     @AdminPresentation(friendlyName = "SkuAvailabilityImpl_Quantity_On_Hand", group = "SkuAvailabilityImpl_Description")
    protected Integer quantityOnHand;

    
The reserve quantity.
    @Column(name = "RESERVE_QTY")
    @AdminPresentation(friendlyName = "SkuAvailabilityImpl_Reserve_Quantity", group = "SkuAvailabilityImpl_Description")
    protected Integer reserveQuantity;

    
The description.
    @Column(name = "AVAILABILITY_STATUS")
    @Index(name="SKUAVAIL_STATUS_INDEX", columnNames={"AVAILABILITY_STATUS"})
    @AdminPresentation(friendlyName = "SkuAvailabilityImpl_Availability_Status", group = "SkuAvailabilityImpl_Description", fieldType= ., broadleafEnumeration="org.broadleafcommerce.core.inventory.service.type.AvailabilityStatusType")
    protected String availabilityStatus;

    
The date this product will be available.
    @Column(name = "AVAILABILITY_DATE")
    @AdminPresentation(friendlyName = "SkuAvailabilityImpl_Available_Date", group = "SkuAvailabilityImpl_Description")
    protected Date availabilityDate;
    @Override
    public Long getId() {
        return ;
    }
    @Override
    public Long getLocationId() {
        return ;
    }
    @Override
    public Integer getQuantityOnHand() {
        return ;
    }
    @Override
    public Long getSkuId() {
        return ;
    }
    @Override
    public void setId(Long id) {
        this. = id;
    }
    @Override
    public void setLocationId(Long locationId) {
        this. = locationId;
    }
    @Override
    public void setQuantityOnHand(Integer qoh) {
        this. = qoh;
    }
    @Override
    public void setSkuId(Long skuId) {
        this. = skuId;
    }
    @Override
    public Date getAvailabilityDate() {
        return ;
    }
    @Override
    public void setAvailabilityDate(Date availabilityDate) {
        this. = availabilityDate;
    }
    
    @Override
        return AvailabilityStatusType.getInstance();
    }
    @Override
    public void setAvailabilityStatus(final AvailabilityStatusType availabilityStatus) {
        if (availabilityStatus != null) {
            this. = availabilityStatus.getType();
        }
    }

    
Returns the reserve quantity. Nulls will be treated the same as 0. Implementations may want to manage a reserve quantity at each location so that the available quantity for purchases is the quantityOnHand - reserveQuantity.
    @Override
    public Integer getReserveQuantity() {
        return ;
    }

    
Sets the reserve quantity. Implementations may want to manage a reserve quantity at each location so that the available quantity for purchases is the quantityOnHand - reserveQuantity.
    @Override
    public void setReserveQuantity(Integer reserveQuantity) {
        this. = reserveQuantity;
    }

    
Returns the getQuantityOnHand() - getReserveQuantity(). Preferred implementation is to return null if getQuantityOnHand() is null and to treat a null in getReserveQuantity() as ZERO.
    @Override
    public Integer getAvailableQuantity() {
        if (getQuantityOnHand() == null || getReserveQuantity() == null) {
            return getQuantityOnHand();
        } else {
            return getQuantityOnHand() - getReserveQuantity();
        }
    }
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + (( == null) ? 0 : .hashCode());
        result = prime * result + (( == null) ? 0 : .hashCode());
        return result;
    }
    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        SkuAvailabilityImpl other = (SkuAvailabilityImplobj;
        if ( != null && other.id != null) {
            return .equals(other.id);
        }
        if ( == null) {
            if (other.locationId != null)
                return false;
        } else if (!.equals(other.locationId))
            return false;
        if ( == null) {
            if (other.skuId != null)
                return false;
        } else if (!.equals(other.skuId))
            return false;
        return true;
    }
New to GrepCode? Check out our FAQ X