return address;
}
public Vector<?> getShippingMethods() throws Exception {
Vector<ShippingMethod> shippingMethods = new Vector<ShippingMethod>();
CustomerAddress address = getEffectiveShippingAddress();
if (address == null) {
return shippingMethods;
}
Long countryId = null;
if (address.getCountry() != null) {
countryId = address.getCountry().getCountryId();
}
Long stateId = null;
if (address.getState() != null) {
stateId = address.getState().getStateId();
}
Vector<ShippingRegion> matchedRegion = new Vector<ShippingRegion>();
EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
Query query = em.createQuery("from ShippingRegion " +
"where siteId = :siteId ");
query.setParameter("siteId", contentSessionKey.getSiteId());
Iterator<?> iterator = query.getResultList().iterator();
ShippingRegion defaultRegion = null;
while (iterator.hasNext()) {
ShippingRegion shippingRegion = (ShippingRegion) iterator.next();
if (shippingRegion.getPublished() == Constants.VALUE_NO) {
continue;
}
if (shippingRegion.getSystemRecord() == Constants.VALUE_YES) {
if (shippingRegion.getPublished() == Constants.VALUE_YES) {
defaultRegion = shippingRegion;
continue;
}
}
boolean isFound = false;
Iterator<?> countries = shippingRegion.getCountries().iterator();
while (countries.hasNext()) {
Country country = (Country) countries.next();
if (country.getCountryId().equals(countryId)) {
isFound = true;
}
}
if (!isFound) {
Iterator<?> states = shippingRegion.getStates().iterator();
while (states.hasNext()) {
State state = (State) states.next();
if (state.getStateId().equals(stateId)) {
isFound = true;
}
}
}
String zipCode = address.getCustZipCode();
if (!isFound && !Format.isNullOrEmpty(zipCode)) {
for (ShippingRegionZip shippingRegionZip : shippingRegion.getZipCodes()) {
if (shippingRegionZip.getZipCodeExpression() == Constants.VALUE_YES) {
if (zipCode.matches(shippingRegionZip.getZipCodeStart())) {
isFound = true;