Package services

Source Code of services.AddressUpdater

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package services;

import services.utils.AddressContainer;
import dao.DAO;
import domain.address.AddressObject;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Required;

/**
*
* @author petr
*/
public class AddressUpdater {

    private DAO dao;

    public AddressContainer getAddressList(int parentId){
        if (parentId != 0){
            AddressObject parent = getDao().getById(AddressObject.class, parentId);
            List<AddressObject> childList = getDao().getChildList(parent);
            AddressContainer ac = new AddressContainer(parent.getType().getLevel(), childList);
            return ac;
        }else{
            return new AddressContainer(parentId, new ArrayList<AddressObject>());
        }
    }

    public DAO getDao() {
        return dao;
    }

    @Required
    public void setDao(DAO dao) {
        this.dao = dao;
    }
}
TOP

Related Classes of services.AddressUpdater

TOP
Copyright © 2018 www.massapi.com. 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.