/**
 * Copyright 2008-2009 DRIVER PROJECT (Bielefeld University)
 * Original author: Marek Imialek <marek.imialek at uni-bielefeld.de>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package eu.dnetlib.data.utility.download.dataprov;

import java.util.ArrayList;

import org.apache.log4j.Logger;

/**
 * Data provider search properties.
 * 
 * @author <a href="mailto:marek.imialek at uni-bielefeld.de">Marek Imialek</a>
 * @version
 */
public class DataProviderSearchProperties extends DataProviderProperties {


	/** The Constant log. */
	protected static final Logger log = Logger
			.getLogger(DataProviderSearchProperties.class);

	/** The id. */
	private String id;

	/** The cache. */
	private ArrayList<String> cache;

	/** Number of results is set in constructor only. */
	private int numberOfCacheResults;

	/** The total number of results. */
	private int totalNumberOfResults;

	/** The status. */
	private String status;
	
	/** The return xmls. */
	private boolean  returnXmls = false;

	/**
	 * Default constructor.
	 * 
	 * @param expiryTime the expiry time
	 * @param cache the cache
	 */
	public DataProviderSearchProperties(int expiryTime, ArrayList<String> cache) {
		super(expiryTime);
		this.cache = cache;
		if (cache != null)
			this.numberOfCacheResults = cache.size();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see de.unibielefeld.driver.is.dataprov.DataProviderProperties#getNumberOfResults()
	 */
	@Override
	public int getNumberOfCacheResults() {
		return this.numberOfCacheResults;
	}

	/**
	 * Gets the id.
	 * 
	 * @return the id
	 */
	public String getId() {
		return this.id;
	}

	/**
	 * Sets the id.
	 * 
	 * @param id the new id
	 */
	public void setId(String id) {
		this.id = id;
	}


	/**
	 * Gets the cache.
	 * 
	 * @return the cache
	 */
	public ArrayList<String> getCache() {
		return this.cache;
	}

	/**
	 * Sets the cache.
	 * 
	 * @param cache the new cache
	 */
	public void setCache(ArrayList<String> cache) {
		this.cache = cache;
	}

	/* (non-Javadoc)
	 * @see eu.dnetlib.data.utility.download.dataprov.DataProviderProperties#getTotalNumberOfResults()
	 */
	@Override
	public int getTotalNumberOfResults() {
		return this.totalNumberOfResults;
	}

	/**
	 * Sets the total number of results.
	 * 
	 * @param totalNumberOfResults the new total number of results
	 */
	public void setTotalNumberOfResults(int totalNumberOfResults) {
		this.totalNumberOfResults = totalNumberOfResults;
	}

	public void setStatus(String status) {
		this.status = status;
		
	}
	
	/**
	 * Gets the status.
	 * 
	 * @return the status
	 */
	public String getStatus() {
		return this.status;
	}

	/**
	 * Sets the return xmls.
	 * 
	 * @param b the new return xmls
	 */
	public void setReturnXmls(boolean b) {
		this.returnXmls = b;
		
	}
	
	/**
	 * Return xmls.
	 * 
	 * @return true, if successful
	 */
	public boolean returnXmls() {
		return this.returnXmls;
	}
	
}
