/**
 * 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.sts.dataprov;

import java.util.ArrayList;
import java.util.List;

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 structure id. */
	private String structureId;
	
	/** The structure subtype. */
	private String structureSubtype;

	/** The object types. */
	private List<String> objectTypes;

	/** 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 return ur is flag. */
	private boolean returnURIsFlag;

	/**
	 * 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();
		else
			log
					.error("got null cache in constructor, cannot set valid numberOfResults!");
	}

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

	/*
	 * (non-Javadoc)
	 * 
	 * @see de.unibielefeld.driver.is.dataprov.DataProviderProperties#getType()
	 */
	@Override
	Type getType() {
		return Type.DELIVER;
	}

	/**
	 * 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.sts.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;
	}
	
	/**
	 * Gets the structure id.
	 * 
	 * @return the structure id
	 */
	public String getStructureId() {
		return structureId;
	}

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

	/**
	 * Gets the structure subtype.
	 * 
	 * @return the structure subtype
	 */
	public String getStructureSubtype() {
		return structureSubtype;
	}

	/**
	 * Sets the structure subtype.
	 * 
	 * @param structureSubtype the new structure subtype
	 */
	public void setStructureSubtype(String structureSubtype) {
		this.structureSubtype = structureSubtype;
	}

	/**
	 * Gets the object types.
	 * 
	 * @return the object types
	 */
	public List<String> getObjectTypes() {
		return objectTypes;
	}

	/**
	 * Sets the object types.
	 * 
	 * @param objectTypes the new object types
	 */
	public void setObjectTypes(List<String> objectTypes) {
		this.objectTypes = objectTypes;
	}

	/**
	 * Sets the return ur is flag.
	 * 
	 * @param returnURIsFlag the new return ur is flag
	 */
	public void setReturnURIsFlag(boolean returnURIsFlag) {
		this.returnURIsFlag = returnURIsFlag;
	}
	
	/**
	 * Gets the return ur is flag.
	 * 
	 * @return the return ur is flag
	 */
	public boolean getReturnURIsFlag() {
		return this.returnURIsFlag; 
		
	}
}
