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

core.dynamic.resources.PostApi Maven / Gradle / Ivy

Go to download

Epikos is a Rest Serivce framework which can be extend to develop any other Rest API/Services. For more detail please checkout github (https://github.com/epikosrest/epikos.git)

There is a newer version: 0.0.7.8.1
Show newest version
package core.dynamic.resources;

import core.domain.enums.ApiValidationStatusCode;
import core.error.ApiValidationStatus;
import core.exception.EpikosException;
import core.lib.Utility;

/**
 * Created by nitina on 12/24/16.
 */
final public class PostApi extends Api{
    @Override
    public ApiValidationStatus isValid() throws EpikosException{

        ApiValidationStatus apiValidity = new ApiValidationStatus(ApiValidationStatusCode.Valid);

        ApiValidationStatus valid = Utility.isValidMethod(getMethod());
        if(!valid.isValidStatus()) {
            apiValidity.setDescription(valid.getDescription());
        }
        valid = Utility.isValidPath(getPath());
        if(!valid.isValidStatus()){
            apiValidity.setDescription(apiValidity.getDescription() + "\n" + valid.getDescription());
        }

        valid = Utility.isValidStatusCode(getStatus());
        if(!valid.isValidStatus()){
            apiValidity.setDescription(apiValidity.getDescription() + "\n" + valid.getDescription());
        }

        valid = Utility.isValidContentType(getConsume());
        if(!valid.isValidStatus()){
            apiValidity.setDescription(apiValidity.getDescription() + "\n" + valid.getDescription());
        }

        valid = Utility.isValidContentType(getProduce());
        if(!valid.isValidStatus()){
            apiValidity.setDescription(apiValidity.getDescription() + "\n" + valid.getDescription());
        }

        valid = Utility.doesPathParamsMatchWithApiPathParam(getPath(),getApiParamList());
        if(!valid.isValidStatus()){
            apiValidity.setDescription(apiValidity.getDescription() + "\n" + valid.getDescription());
        }

        return apiValidity;
        //ToDo: do we need controller validation as well ? Investigate !
        //&& getController()==null?true:Utility.isValidClass(getController());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy