⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 graphictypeserviceimpl.java

📁 基于java的组态软件。使用了hibernate和spring技术
💻 JAVA
字号:
/*
 * Created on 2005-8-7
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package service.impl;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;


import service.IGraphicTypeService;
import viewBeans.SelectedListBean;
import domain.GraphicType;
import domain.dao.GraphicTypeDAO;

/**
 * <p>Title: GraphicTypeService.java</p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: SCUT Copyright (c) 2005</p>
 *
 * <p>Company: KHC</p>
 * 
 * @author yukizh
 * 
 * @version 1.0
 */
public class GraphicTypeServiceImpl implements IGraphicTypeService {
    private List graphicTypeList = null;
    private GraphicTypeDAO graphicTypeDAO = null;
    
    /* (non-Javadoc)
     * @see service.IGraphicTypeService#getGraphicTypeList()
     */
    public List getGraphicTypeList() {
        List list =  graphicTypeDAO.loadAll();
        if(list == null)
            list =  new ArrayList();
        Set set = new HashSet(list);
        ArrayList arraylist = new ArrayList();
        arraylist.addAll(set);
        graphicTypeList = arraylist ;
        return arraylist;
    }

    /* (non-Javadoc)
     * @see service.IGraphicTypeService#findGraphicTypeById(int)
     */
    public GraphicType findGraphicTypeById(int id) {
       if(id < 0)
         return (GraphicType)getGraphicTypeList().get(0);   
       else
       return graphicTypeDAO.load(new Integer(id));
    }
    
    /**
     * @param graphicTypeDAO The graphicTypeDAO to set.
     */
    public void setGraphicTypeDAO(GraphicTypeDAO graphicTypeDAO) {
        this.graphicTypeDAO = graphicTypeDAO;
    }
    
    /* (non-Javadoc)
     * @see service.IGraphicTypeService#getGraphicItemListByTypeId(int)
     */
    public List getGraphicItemListByTypeId(int id) {
        List list = new ArrayList();
        GraphicType type = findGraphicTypeById(id);
        if(type == null)
            return list;
        
        Set graphicItemSet = type.getGraphicItemSet();
        if(graphicItemSet != null)
            list.addAll(graphicItemSet);
        return list;     
    }

    /* (non-Javadoc)
     * @see service.IGraphicTypeService#getListBeanByTypeId(int)
     */
    public SelectedListBean getListBeanByTypeId(int id) {
        SelectedListBean bean = new SelectedListBean();
        List list = new ArrayList();
        GraphicType type = findGraphicTypeById(id);
        if(type == null)
            return bean;
        bean.setSelectedIndex(type.getId().intValue());
        Set graphicItemSet = type.getGraphicItemSet();
        if(graphicItemSet != null)
            list.addAll(graphicItemSet);
        bean.setSelectedlist(list);
        return bean;   
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -