picturehelper.java

来自「一个免费wap站」· Java 代码 · 共 66 行

JAVA
66
字号
package com.eline.wap.resource.client;

import com.eline.wap.common.model.Page;
import com.eline.wap.resource.dao.PictureDAO;
import com.eline.wap.resource.dao.ResourceDAOFactory;
import com.eline.wap.resource.exceptions.ResourceDAOSysException;
import com.eline.wap.resource.exceptions.ResourceException;
import com.eline.wap.resource.model.Picture;
import com.eline.wap.resource.model.PictureCondition;

public class PictureHelper {

	private PictureDAO dao = null;

	public Page searchPictures(PictureCondition condition, int start, int count) throws ResourceException {
		try {
			if (dao == null)
				dao = ResourceDAOFactory.getPictureDAO();
			return dao.searchPictures(condition, start, count);
		} catch (ResourceDAOSysException e) {
			throw new ResourceException(e.getMessage());
		}
	}
	
	public void createPicture(Picture item) throws ResourceException {
		try {
			if (dao == null)
				dao = ResourceDAOFactory.getPictureDAO();
			dao.createPicture(item);
		} catch (ResourceDAOSysException e) {
			throw new ResourceException(e.getMessage());
		}
	}
	
	public void updatePicture(Picture item) throws ResourceException {
		try {
			if (dao == null)
				dao = ResourceDAOFactory.getPictureDAO();
			dao.updatePicture(item);
		} catch (ResourceDAOSysException e) {
			throw new ResourceException(e.getMessage());
		}
	}

	public void deletePicture(int pictureId) throws ResourceException {
		try {
			if (dao == null)
				dao = ResourceDAOFactory.getPictureDAO();
			dao.deletePicture(pictureId);
		} catch (ResourceDAOSysException e) {
			throw new ResourceException(e.getMessage());
		}
	}

	public Picture getPicture(int pictureId) throws ResourceException {
		try {
			if (dao == null)
				dao = ResourceDAOFactory.getPictureDAO();
			return dao.getPicture(pictureId);
		} catch (ResourceDAOSysException e) {
			throw new ResourceException(e.getMessage());
		}
	}

}

⌨️ 快捷键说明

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