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

com.evrythng.thng.resource.model.store.Application Maven / Gradle / Ivy

There is a newer version: 1.33
Show newest version
/*
 * (c) Copyright 2012 EVRYTHNG Ltd London / Zurich
 * www.evrythng.com
 */
package com.evrythng.thng.resource.model.store;

import com.evrythng.thng.resource.model.access.SocialNetwork;
import com.evrythng.thng.resource.model.core.DurableResourceModel;
import com.fasterxml.jackson.annotation.JsonIgnore;

import java.util.HashMap;
import java.util.Map;

/**
 * A registered Application in the EVRYTHNG engine.
 */
public class Application extends DurableResourceModel {

	private static final long serialVersionUID = -5251229000992852717L;
	public static final String SN_FACEBOOK = "facebook";
	private String name;
	private String description;
	private String project;
	private String appApiKey;
	private Map socialNetworks;
	private String defaultUrl;

	/**
	 * @return the name
	 */
	public String getName() {

		return name;
	}

	/**
	 * @param name the name to set
	 */
	public void setName(final String name) {

		this.name = name;
	}

	/**
	 * @return the description
	 */
	public String getDescription() {

		return description;
	}

	/**
	 * @param description the description to set
	 */
	public void setDescription(final String description) {

		this.description = description;
	}

	/**
	 * @return the socialNetworks
	 */
	public Map getSocialNetworks() {

		return socialNetworks;
	}

	/**
	 * @param socialNetworks the socialNetworks to set
	 */
	public void setSocialNetworks(final Map socialNetworks) {

		this.socialNetworks = socialNetworks;
	}

	/**
	 * @return the appApiKey
	 */
	public String getAppApiKey() {

		return appApiKey;
	}

	/**
	 * @return the defaultUrl
	 */
	public String getDefaultUrl() {

		return defaultUrl;
	}

	/**
	 * @param defaultUrl the defaultUrl to set
	 */
	public void setDefaultUrl(final String defaultUrl) {

		this.defaultUrl = defaultUrl;
	}

	public String getProject() {

		return project;
	}

	public void setProject(final String project) {

		this.project = project;
	}

	@Override
	public String toString() {

		return "Application [name=" + name + ", description=" + description + ", appApiKey=" + appApiKey + "]";
	}

	// === helpers methods ================================================= //

	/**
	 * This convenience method set / replace the {@link SocialNetwork} object in the social networks map. It creates the map if necessary.
	 */
	@JsonIgnore
	public void defineSocialNetwork(final String snName, final SocialNetwork socialNetwork) {

		if (socialNetworks == null) {
			socialNetworks = new HashMap<>();
		}

		socialNetworks.put(snName, socialNetwork);
	}

	/**
	 * Set the Facebook social network to the given value.
	 */
	@JsonIgnore
	public void defineFacebook(final SocialNetwork socialNetwork) {

		defineSocialNetwork(SN_FACEBOOK, socialNetwork);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy