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

rapture.common.client.HttpActivityApi Maven / Gradle / Ivy

/**
 * The MIT License (MIT)
 *
 * Copyright (C) 2011-2016 Incapture Technologies LLC
 *
 * 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.
 */

/**
 * This file is autogenerated and any changes will be overwritten.
 */

package rapture.common.client;

import java.util.List;
import java.util.Map;
import rapture.common.api.ActivityApi;
import rapture.common.api.ScriptActivityApi;
import rapture.common.CallingContext;
import rapture.common.model.GeneralResponse;
import rapture.common.model.BasePayload;
import rapture.common.exception.RaptureException;
import rapture.common.impl.jackson.JacksonUtil;

import com.fasterxml.jackson.core.type.TypeReference;

import org.apache.log4j.Logger;

import rapture.common.Activity;
import rapture.common.ActivityQueryResponse;

import rapture.common.shared.activity.CreateActivityPayload;

import rapture.common.shared.activity.UpdateActivityPayload;

import rapture.common.shared.activity.FinishActivityPayload;

import rapture.common.shared.activity.RequestAbortActivityPayload;

import rapture.common.shared.activity.QueryByExpiryTimePayload;

import rapture.common.shared.activity.GetByIdPayload;


@SuppressWarnings("all")
public class HttpActivityApi extends BaseHttpApi implements ActivityApi, ScriptActivityApi {
        private static final Logger log = Logger.getLogger(HttpActivityApi.class);

	public HttpActivityApi(HttpLoginApi login) {
		super(login, "activity");
	}
		
	    private static final class CreateActivityTypeReference extends TypeReference {
	    }    
	    @Override
	    public String createActivity(CallingContext context, String description, String message, Long progress, Long max) {
	        CreateActivityPayload requestObj = new CreateActivityPayload();
	        requestObj.setContext(context == null ? this.getContext() : context);
	        requestObj.setDescription(description);
	        requestObj.setMessage(message);
	        requestObj.setProgress(progress);
	        requestObj.setMax(max);
	        return doRequest(requestObj, "CREATEACTIVITY", new CreateActivityTypeReference());    }

	    private static final class UpdateActivityTypeReference extends TypeReference {
	    }    
	    @Override
	    public Boolean updateActivity(CallingContext context, String activityId, String message, Long progress, Long max) {
	        UpdateActivityPayload requestObj = new UpdateActivityPayload();
	        requestObj.setContext(context == null ? this.getContext() : context);
	        requestObj.setActivityId(activityId);
	        requestObj.setMessage(message);
	        requestObj.setProgress(progress);
	        requestObj.setMax(max);
	        return doRequest(requestObj, "UPDATEACTIVITY", new UpdateActivityTypeReference());    }

	    private static final class FinishActivityTypeReference extends TypeReference {
	    }    
	    @Override
	    public Boolean finishActivity(CallingContext context, String activityId, String message) {
	        FinishActivityPayload requestObj = new FinishActivityPayload();
	        requestObj.setContext(context == null ? this.getContext() : context);
	        requestObj.setActivityId(activityId);
	        requestObj.setMessage(message);
	        return doRequest(requestObj, "FINISHACTIVITY", new FinishActivityTypeReference());    }

	    private static final class RequestAbortActivityTypeReference extends TypeReference {
	    }    
	    @Override
	    public Boolean requestAbortActivity(CallingContext context, String activityId, String message) {
	        RequestAbortActivityPayload requestObj = new RequestAbortActivityPayload();
	        requestObj.setContext(context == null ? this.getContext() : context);
	        requestObj.setActivityId(activityId);
	        requestObj.setMessage(message);
	        return doRequest(requestObj, "REQUESTABORTACTIVITY", new RequestAbortActivityTypeReference());    }

	    private static final class QueryByExpiryTimeTypeReference extends TypeReference {
	    }    
	    @Override
	    public ActivityQueryResponse queryByExpiryTime(CallingContext context, String nextBatchId, Long batchSize, Long lastSeen) {
	        QueryByExpiryTimePayload requestObj = new QueryByExpiryTimePayload();
	        requestObj.setContext(context == null ? this.getContext() : context);
	        requestObj.setNextBatchId(nextBatchId);
	        requestObj.setBatchSize(batchSize);
	        requestObj.setLastSeen(lastSeen);
	        return doRequest(requestObj, "QUERYBYEXPIRYTIME", new QueryByExpiryTimeTypeReference());    }

	    private static final class GetByIdTypeReference extends TypeReference {
	    }    
	    @Override
	    public Activity getById(CallingContext context, String activityId) {
	        GetByIdPayload requestObj = new GetByIdPayload();
	        requestObj.setContext(context == null ? this.getContext() : context);
	        requestObj.setActivityId(activityId);
	        return doRequest(requestObj, "GETBYID", new GetByIdTypeReference());    }

	
	    @Override
	    public String createActivity(String description, String message, Long progress, Long max) {
	        return createActivity(null,description,message,progress,max);    }

	    @Override
	    public Boolean updateActivity(String activityId, String message, Long progress, Long max) {
	        return updateActivity(null,activityId,message,progress,max);    }

	    @Override
	    public Boolean finishActivity(String activityId, String message) {
	        return finishActivity(null,activityId,message);    }

	    @Override
	    public Boolean requestAbortActivity(String activityId, String message) {
	        return requestAbortActivity(null,activityId,message);    }

	    @Override
	    public ActivityQueryResponse queryByExpiryTime(String nextBatchId, Long batchSize, Long lastSeen) {
	        return queryByExpiryTime(null,nextBatchId,batchSize,lastSeen);    }

	    @Override
	    public Activity getById(String activityId) {
	        return getById(null,activityId);    }

}






© 2015 - 2025 Weber Informatics LLC | Privacy Policy