Examples of UPInvalidParameterException


Examples of com.uplibrary.upexception.UPInvalidParameterException

     * @throws IOException if connection hangs.
     * @throws UPInvalidParameterException if the parameters specified are invalid.
     */
    public final UPModel getModels(final String modelRequested) throws IOException, UPInvalidParameterException {
        if (modelRequested==null || modelRequested.isEmpty()) {
            throw new UPInvalidParameterException("The model requested is not valid");
        }
        this.setUrl("https://api.uniparthenope.it/meteo/models/getmodels");
        final String requestedModel = this.connect().getJSONObject("models").getString(modelRequested);
        if (requestedModel!=null) {
            return new UPModel(modelRequested,requestedModel);
View Full Code Here

Examples of com.uplibrary.upexception.UPInvalidParameterException

     * @throws IOException if connection hangs.
     * @throws UPInvalidParameterException if parameters specified are invalid.
     */
    public final ArrayList<UPOutput> getOutputs(final String model) throws IOException, UPInvalidParameterException {
        if (model == null || model.isEmpty()) {
            throw new UPInvalidParameterException("The model can not be a null or an empty string");
        }
        this.setUrl("https://api.uniparthenope.it/meteo/"+model+"/getoutputs");
        final JSONObject requestsOutputs = this.connect().getJSONObject("outputs");
        final Iterator it = requestsOutputs.keys();
        ArrayList<UPOutput> outputs = new ArrayList<>();
View Full Code Here

Examples of com.uplibrary.upexception.UPInvalidParameterException

     * @throws IOException if connection hangs.
     * @throws UPInvalidParameterException if invalid parameters are specified.
     */
    public final UPOutput getOutputs(final String model, final String outputRequested) throws IOException, UPInvalidParameterException {
        if (model == null || model.isEmpty()) {
            throw new UPInvalidParameterException("The model can not be a null or an empty string");
        } else if (outputRequested==null || outputRequested.isEmpty()) {
            throw new UPInvalidParameterException("The output requested can not be null or an empty string");
        }
        this.setUrl("https://api.uniparthenope.it/meteo/"+model+"/getoutputs");
        final Object requestedOutput = this.connect().getJSONObject("outputs").get(outputRequested);
        if (requestedOutput != null) {
            return new UPOutput(outputRequested,requestedOutput.toString());
View Full Code Here

Examples of com.uplibrary.upexception.UPInvalidParameterException

     * @throws IOException if connection hangs.
     * @throws UPInvalidParameterException if invalid parameters are specified.
     */
    public final ArrayList<UPPlace> getPlaceByName(final String placeName) throws IOException, UPInvalidParameterException {
        if (placeName==null || placeName.isEmpty()) {
            throw new UPInvalidParameterException("Place name can not be null or an empty string");
        }
        this.setUrl("https://api.uniparthenope.it/meteo/byplacename/"+placeName);
        final JSONArray placesJson = this.connect().getJSONArray("places");
        ArrayList<UPPlace> places = new ArrayList<>(placesJson.size());
        for (int i = 0; i  < placesJson.size(); ++i) {
View Full Code Here

Examples of com.uplibrary.upexception.UPInvalidParameterException

     * @throws IOException if connection hangs.
     * @throws UPInvalidParameterException if invalid parameters are specified.
     */
    public final UPPlace getPlaceByIdentifier(final String identifier) throws IOException, UPInvalidParameterException {
        if (identifier==null || identifier.isEmpty()) {
            throw new UPInvalidParameterException("Identifier can not be a null or an empty string");
        }
        this.setUrl("https://api.uniparthenope.it/meteo/byid/"+identifier);
        final JSONArray placesJson = this.connect().getJSONArray("places");
        if (placesJson.size() > 0) {
            return this.parsePlaces(placesJson.getJSONObject(0));
View Full Code Here

Examples of com.uplibrary.upexception.UPInvalidParameterException

     * @throws IllegalAccessException if internal error occurs.
     * @throws NoSuchMethodException if internal error occurs.
     */
    public final UPForecast getPlaceForecasts(final String identifier) throws IOException, UPInvalidParameterException, InvocationTargetException, IllegalAccessException, NoSuchMethodException {
        if (identifier==null || identifier.isEmpty()) {
            throw new UPInvalidParameterException("Place identifier can not be null or an empty string");
        }
        this.setUrl("https://api.uniparthenope.it/meteo/" + identifier + "/modeloutput");
        return this.parseJsonForecasts();
    }
View Full Code Here

Examples of com.uplibrary.upexception.UPInvalidParameterException

     * @throws IllegalAccessException if internal errors occurs.
     * @throws InvocationTargetException if internal errors occurs.
     */
    public final UPForecast getPlaceForecasts(final String identifier, final String model, final String output) throws IOException, UPInvalidParameterException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
        if (identifier==null || identifier.isEmpty()) {
            throw new UPInvalidParameterException("Identifier can not be null or an empty string");
        } else if (model==null || model.isEmpty()) {
            throw new UPInvalidParameterException("Model can not be null or an empty string");
        } else if (output==null || output.isEmpty()) {
            throw new UPInvalidParameterException("Output can not be null or an empty string");
        }
        this.setUrl("https://api.uniparthenope.it/meteo/"+identifier+"/"+model+"/"+output+"/modeloutput");
        return this.parseJsonForecasts();
    }
View Full Code Here

Examples of com.uplibrary.upexception.UPInvalidParameterException

     * @throws InvocationTargetException if internal errors occurs.
     * @throws IllegalAccessException if internal errors occurs.
     */
    public final UPForecast getPlaceForecasts(final String identifier, final String model, final String output, final UPDateTime time) throws IOException, UPInvalidParameterException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
        if (identifier==null || identifier.isEmpty()) {
            throw new UPInvalidParameterException("Identifier can not be null or an empty string");
        } else if (model==null || model.isEmpty()) {
            throw new UPInvalidParameterException("Model can not be null or an empty string");
        } else if (output==null || output.isEmpty()) {
            throw new UPInvalidParameterException("Output can not be null or an empty string");
        } else if (time==null) {
            throw new UPInvalidParameterException("The time must be specified in this API");
        }
        this.setUrl("https://api.uniparthenope.it/meteo/"+identifier+"/"+model+"/"+output+"/"+time.getYear()+"/"+time.getMonth()+"/"+time.getDay()+"/"+time.getHour()+"/modeloutput");
        return this.parseJsonForecasts();
    }
View Full Code Here

Examples of com.uplibrary.upexception.UPInvalidParameterException

     * @return a reference to enable cascade calls.
     * @throws UPInvalidParameterException if model name is null or an empty string
     */
    protected final UPModel setModelName(final String modelName) throws UPInvalidParameterException {
        if (modelName==null || modelName.isEmpty()) {
            throw new UPInvalidParameterException("Model name can not be null or an empty string");
        }
        this.modelName = modelName;
        return this;
    }
View Full Code Here

Examples of com.uplibrary.upexception.UPInvalidParameterException

     * @return a reference to enable cascade calls
     * @throws UPInvalidParameterException if model description is null or an empty string
     */
    protected final UPModel setModelDescription(final String modelDescription) throws UPInvalidParameterException {
        if (modelDescription==null) {
            throw new UPInvalidParameterException("Model description can not be null");
        } else if (modelDescription.isEmpty()) {
            this.modelDescription = "No description supplied";
        } else {
            this.modelDescription = modelDescription;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.