All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.johnnei.enjin.spec.dto.CheckSessionResult Maven / Gradle / Ivy

The newest version!
package org.johnnei.enjin.spec.dto;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class CheckSessionResult {

	private boolean hasIdentity;

	private Map notification_counts;

	private Map pusher_channels;

	private String user_id;

	private String username;

	private String resources;

	private List sites;

	CheckSessionResult() {
		// Constructor for serialization
	}

	private CheckSessionResult(Builder builder) {
		hasIdentity = builder.hasIdentity;
		notification_counts = builder.notification_counts;
		pusher_channels = builder.pusher_channels;
		user_id = builder.user_id;
		username = builder.username;
		resources = builder.resources;
		sites = builder.sites;
	}

	public String getUsername() {
		return username;
	}

	/**
	 * If the session supplied to retrieve this object was valid.
	 * @return
	 */
	public boolean getHasIdentity() {
		return hasIdentity;
	}

	public String getUserId() {
		return user_id;
	}

	public Map getNotificationCounts() {
		return notification_counts;
	}

	public Map getPusherChannels() {
		return pusher_channels;
	}

	public String getResources() {
		return resources;
	}

	public List getSites() {
		return sites;
	}

	public static class Builder {

		private String username;

		private boolean hasIdentity;

		private String user_id;

		private Map notification_counts;

		private Map pusher_channels;

		private String resources;

		private List sites;

		public Builder() {
			notification_counts = new HashMap<>();
			pusher_channels = new HashMap<>();
			sites = new ArrayList<>();
		}

		public Builder setUsername(String username) {
			this.username = username;
			return this;
		}

		public Builder setHasIdentity(boolean hasIdentity) {
			this.hasIdentity = hasIdentity;
			return this;
		}

		public Builder setUserId(String user_id) {
			this.user_id = user_id;
			return this;
		}

		public Builder addNotificationCount(String type, int count) {
			notification_counts.put(type, count);
			return this;
		}

		public Builder addPusherChannels(String name, String value) {
			pusher_channels.put(name, value);
			return this;
		}

		public Builder setResources(String resources) {
			this.resources = resources;
			return this;
		}

		public Builder addSite(Site site) {
			sites.add(site);
			return this;
		}

		public CheckSessionResult build() {
			return new CheckSessionResult(this);
		}

	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy