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

📄 personalizationdatafactoryimpl.java

📁 esri的ArcGIS Server超级学习模板程序(for java)
💻 JAVA
字号:
package com.esri.solutions.jitk.personalization.data;

import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;

import com.esri.solutions.jitk.personalization.PersonalizationException;
import com.esri.solutions.jitk.personalization.dao.IPersonalizationDAOProfile;

/**
 * Implementation of {@link IPersonalizationDataFactory}.  This
 * implementation will create {@link PersonalizationDataImpl}
 * objects.  This implementation relies on a {@link IPersonalizationDAOProfile}
 * object to reference the DAOs for Personalization Data.
 */
public class PersonalizationDataFactoryImpl implements
		IPersonalizationDataFactory {

	/**
	 * Logger to use to log messages from this class.
	 */
	private static final Logger LOG = LogManager.getLogger(PersonalizationDataFactoryImpl.class);

	private static final String ERROR_NULL_PROFILE_OBJECT = "Object was not injected with IPersonalizationDAOProfile object.";
	
	/**
	 * Reference to profile of DAO objects.
	 */
	private IPersonalizationDAOProfile m_daoProfile;

	/**
	 * Reference to User Factory object
	 */
	private IUserFactory m_userFactory;
	
	/*
	 * (non-Javadoc)
	 * @see com.esri.solutions.jitk.personalization.data.IPersonalizationDataFactory#create(com.esri.solutions.jitk.personalization.data.User)
	 */
	public IPersonalizationData create(IUserId userId)
			throws PersonalizationException {
		
		if (userId == null) {
			throw new NullPointerException ();
		}
		if (m_daoProfile == null) {
			LOG.error(ERROR_NULL_PROFILE_OBJECT);
			throw new IllegalStateException ();
		}
		
		IUser user = m_userFactory.createUser(userId);
		
		PersonalizationDataImpl data = null;
		data = new PersonalizationDataImpl();
		data.setCurrentUser(user);
		data.setPersonalizationDAOProfile(m_daoProfile);
		
		return data;
		
	}

	/**
	 * Sets the reference to the Profile object that contains the
	 * DAO objects.
	 * 
	 * @param profile	Manages references to DAO objects, cannot
	 * 					be <code>null</code>.
	 * 
	 * @throws NullPointerException		Thrown if the <code>profile</code>
	 * 									argument is <code>null</code>.
	 */
	public void setPersonalizationDAOProfile (IPersonalizationDAOProfile profile) {
		if (profile == null) {
			throw new NullPointerException();
		}
		m_daoProfile = profile;
	}
	
	/**
	 * Sets the reference to the UserFactory object that creates User
	 * objects from a UserID object.
	 * 
	 * @param factory	Creates User objects.
	 * @throws NullPointerException		Thrown if the <code>factory</code>
	 * 									argument is <code>null</code>.
	 */
	public void setUserFactory (IUserFactory factory) {
		if (factory == null) {
			throw new NullPointerException();
		}
		m_userFactory = factory;
	}
}

⌨️ 快捷键说明

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