/**
 * Copyright 2009-2012 OpenAIRE 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.udm;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.xml.ws.wsaddressing.W3CEndpointReference;

/**
 * The Interface IUsageDataMergingService.
 * 
 * @author <a href="mailto:marek.imialek at uni-bielefeld.de">Marek Imialek</a>
 */
@WebService
public interface IUsageDataMergingService {

	/**
	 * Identifies service version.
	 * 
	 * @return the string
	 */
	@WebMethod(operationName="identify", action="identify")
	public String identify();
	
	/**
	 * Gets data from all "harvesting" mdstores for defined date range.
	 * If the date range parameters are not defined then all records are
	 * returned. The date format for the range parameters is as following:
	 * YYYY-MM-DD
	 * 
	 * @param dateFrom the date from
	 * @param dateUntil the date until
	 * 
	 * @return Reference to the ResultSet containing requested records 
	 * 
	 * @throws UsageDataMergingServiceException the usage data merging service exception
	 */
	@WebMethod(operationName = "getAllRecords", action = "getAllRecords")
	public W3CEndpointReference getAllRecords(
			@WebParam(name = "dateFrom")  String dateFrom, 
			@WebParam(name = "dateUntil") String dateUntil
	)throws UsageDataMergingServiceException;
	
	/**
	 * Gets records harvested from specified repository for defined date range. 
	 * The results can be sorted by the value specified by the sortBy
	 * parameter. At the moment functions supports only sorting by 
	 * records identifiers ("identifier"). The date format for the range 
	 * parameters is as following: YYYY-MM-DD
	 * 
	 * @param dateFrom the date from
	 * @param dateUntil the date until
	 * @param repositoryIdentifier the repository identifier
	 * @param sortBy the sort key, supported keys: identifier
	 * 
	 * @return Reference to the ResultSet containing requested records 
	 * 
	 * @throws UsageDataMergingServiceException the usage data merging service exception
	 */
	@WebMethod(operationName = "getRepositoryRecords", action = "getRepositoryRecords")
	public W3CEndpointReference getRepositoryRecords(
			@WebParam(name = "dateFrom")  String dateFrom, 
			@WebParam(name = "dateUntil") String dateUntil,
			@WebParam(name = "repositoryIdentifier") String repositoryIdentifier,
			@WebParam(name = "sortBy") String sortBy		
	)throws UsageDataMergingServiceException;
	
}
