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

📄 userpreferencesettingsimpl.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.data.beans.v1.PreferenceSettingsType;

public class UserPreferenceSettingsImpl implements IPreferenceSettings {

	private static final String ERROR_NULL_USER_OBJECT = "Object not injected with User object.";
	
	/**
	 * Logger to use to log messages from this class.
	 */
	private static final Logger LOG = LogManager.getLogger(UserPreferenceSettingsImpl.class);

	/**
	 * Reference to associated User for these settings.
	 */
	private IUser m_user;
	
	/*
	 * (non-Javadoc)
	 * @see com.esri.solutions.jitk.personalization.data.IPreferenceSettings#getPreferenceSettings()
	 */
	public PreferenceSettingsType getPreferenceSettings()
			throws PersonalizationException {

		if (m_user == null) {
			LOG.error(ERROR_NULL_USER_OBJECT);
			throw new IllegalStateException (ERROR_NULL_USER_OBJECT);
		}
		
		return m_user.getPreferenceSettings();
	}

	/*
	 * (non-Javadoc)
	 * @see com.esri.solutions.jitk.personalization.data.IPreferenceSettings#save()
	 */
	public void save() throws PersonalizationException {
		if (m_user == null) {
			LOG.error(ERROR_NULL_USER_OBJECT);
			throw new IllegalStateException (ERROR_NULL_USER_OBJECT);
		}
		
		m_user.save();

	}
	
	/**
	 * Sets the reference to the User that these Preference Settings
	 * are associated with.
	 * 
	 * @param user Reference to the {@link IUser} object, cannot
	 * 				be <code>null</code>.
	 * 
	 * @throws NullPointerException		Thrown if the <code>user</code>
	 * 									argument is <code>null</code>.
	 */
	public void setUser (IUser user) {
		if (user == null) {
			throw new NullPointerException ();
		}
		
		m_user = user;
	}
}

⌨️ 快捷键说明

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