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

com.syncthemall.diffbot.model.frontpage.Frontpage Maven / Gradle / Ivy

/**
 * The MIT License
 * Copyright (c) 2013 Pierre-Denis Vanduynslager
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
package com.syncthemall.diffbot.model.frontpage;

import java.io.Serializable;
import java.util.List;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

import com.syncthemall.diffbot.model.Model;
import com.syncthemall.diffbot.model.PageType;

/**
 * The result of a front page extraction by Diffbot (Frontpage API).
 * 
 * @author Pierre-Denis Vanduynslager 
 */
@XmlRootElement(name = "dml")
public final class Frontpage extends Model implements Serializable {

	/** Serial code version serialVersionUID. **/
	private static final long serialVersionUID = 7531133216091403402L;

	private long id;
	private List items;
	private Info info;

	/**
	 * Default constructor.
	 */
	public Frontpage() {
		super();
	}

	@Override
	public PageType getType() {
		return PageType.FRONTPAGE;
	}

	@Override
	public String getUrl() {
		if (this.info != null) {
			return this.info.getSourceURL();
		}
		return null;
	}

	@Override
	public String toString() {
		return String.format("Frontpage [url=%s]", getUrl());
	}

	/**
	 * @return the list of {@code Item} of the extracted page
	 */
	@XmlElement(name = "item")
	public List getItems() {
		return items;
	}

	/**
	 * @return the {@code Info} of the extracted page
	 */
	@XmlElement
	public Info getInfo() {
		return info;
	}

	/**
	 * @return the id of the extracted page (generated by Diffbot)
	 */
	@XmlElement
	public long getId() {
		return id;
	}

	/**
	 * @param items the list of {@code Item} of the extracted page
	 */
	public void setItems(final List items) {
		this.items = items;
	}

	/**
	 * @param id the id of the extracted page (generated by Diffbot)
	 */
	public void setId(final long id) {
		this.id = id;
	}

	/**
	 * @param info the {@code Info} of the extracted page
	 */
	public void setInfo(final Info info) {
		this.info = info;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy