org.broadleafcommerce.core.order.fulfillment.domain.FulfillmentBandImpl Maven / Gradle / Ivy
/*
* Copyright 2008-2013 the original author or authors.
*
* 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.
*/
package org.broadleafcommerce.core.order.fulfillment.domain;
import org.broadleafcommerce.common.presentation.AdminPresentation;
import org.broadleafcommerce.common.presentation.client.SupportedFieldType;
import org.broadleafcommerce.core.order.service.type.FulfillmentBandResultAmountType;
import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import java.math.BigDecimal;
/**
*
* @author Phillip Verheyden
* @see {@link FulfillmentPriceBandImpl}, {@link FulfillmentWeightBandImpl}
*/
@MappedSuperclass
public abstract class FulfillmentBandImpl implements FulfillmentBand {
private static final long serialVersionUID = 1L;
@Column(name="RESULT_AMOUNT", precision=19, scale=5, nullable = false)
protected BigDecimal resultAmount;
@Column(name="RESULT_AMOUNT_TYPE", nullable = false)
@AdminPresentation(friendlyName="Result Type", fieldType=SupportedFieldType.BROADLEAF_ENUMERATION, broadleafEnumeration="org.broadleafcommerce.core.order.service.type.FulfillmentBandResultAmountType")
protected String resultAmountType = FulfillmentBandResultAmountType.RATE.getType();
@Override
public BigDecimal getResultAmount() {
return resultAmount;
}
@Override
public void setResultAmount(BigDecimal resultAmount) {
this.resultAmount = resultAmount;
}
@Override
public FulfillmentBandResultAmountType getResultAmountType() {
return FulfillmentBandResultAmountType.getInstance(resultAmountType);
}
@Override
public void setResultAmountType(FulfillmentBandResultAmountType resultAmountType) {
this.resultAmountType = resultAmountType.getType();
}
}