
de.knightsoftnet.validators.client.services.PhoneNumberRestService Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gwt-bean-validators-spring-gwtp Show documentation
Show all versions of gwt-bean-validators-spring-gwtp Show documentation
The GWT Bean Validators is a collection of JSR-303/JSR-349/JSR 380 bean validators. It can be used on server
and with the help of GWT even on client side. This packages contains rest services and validator
for phone numbers based on gwtp-rest dispatcher and spring to reduce client side code.
/*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license
* agreements. See the NOTICE file distributed with this work for additional information regarding
* copyright ownership. The ASF licenses this file to You 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 de.knightsoftnet.validators.client.services;
import de.knightsoftnet.validators.shared.Parameters;
import de.knightsoftnet.validators.shared.ResourcePaths.PhoneNumber;
import de.knightsoftnet.validators.shared.data.PhoneNumberData;
import de.knightsoftnet.validators.shared.data.PhoneNumberDataWithFormats;
import de.knightsoftnet.validators.shared.data.ValueWithPos;
import de.knightsoftnet.validators.shared.data.ValueWithPosAndCountry;
import com.gwtplatform.dispatch.rest.shared.RestAction;
import java.util.List;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.QueryParam;
@Path(PhoneNumber.ROOT)
public interface PhoneNumberRestService {
@GET
@Path(PhoneNumber.PARSE_PHONE_NUMBER)
RestAction parsePhoneNumber(
@QueryParam(Parameters.LANGUAGE) final String planguage,
@QueryParam(Parameters.COUNTRY) final String pcountry,
@QueryParam(Parameters.PHONE_NUMBER) final String pphoneNumber);
@PUT
@Path(PhoneNumber.PARSE_WITH_POS)
RestAction> parsePhoneNumber(
final ValueWithPosAndCountry pphoneNumber);
/**
* parse and reformat the phone number in all available formats.
*
* @param planguage language to use
* @param pcountry default country
* @param pphoneNumber phone number to format
* @return PhoneNumberDataWithFormats
*/
@GET
@Path(PhoneNumber.PARSE_AND_FORMAT)
RestAction parseAndFormatPhoneNumber(
@QueryParam(Parameters.LANGUAGE) final String planguage,
@QueryParam(Parameters.COUNTRY) final String pcountry,
@QueryParam(Parameters.PHONE_NUMBER) final String pphoneNumber);
@GET
@Path(PhoneNumber.FORMAT_E123)
RestAction formatE123(@QueryParam(Parameters.LANGUAGE) final String planguage,
@QueryParam(Parameters.COUNTRY) final String pcountry,
@QueryParam(Parameters.PHONE_NUMBER) final String pphoneNumber);
@PUT
@Path(PhoneNumber.FORMAT_E123_WITH_POS)
RestAction> formatE123WithPos(
final ValueWithPosAndCountry pphoneNumber);
@GET
@Path(PhoneNumber.FORMAT_E123_INTERNATIONAL)
RestAction formatE123International(
@QueryParam(Parameters.LANGUAGE) final String planguage,
@QueryParam(Parameters.COUNTRY) final String pcountry,
@QueryParam(Parameters.PHONE_NUMBER) final String pphoneNumber);
@PUT
@Path(PhoneNumber.FORMAT_E123_INTERNATIONAL_WITH_POS)
RestAction> formatE123InternationalWithPos(
final ValueWithPosAndCountry pphoneNumber);
@GET
@Path(PhoneNumber.FORMAT_E123_NATIONAL)
RestAction formatE123National(@QueryParam(Parameters.LANGUAGE) final String planguage,
@QueryParam(Parameters.COUNTRY) final String pcountry,
@QueryParam(Parameters.PHONE_NUMBER) final String pphoneNumber);
@PUT
@Path(PhoneNumber.FORMAT_E123_NATIONAL_WITH_POS)
RestAction> formatE123NationalWithPos(
final ValueWithPosAndCountry pphoneNumber);
@GET
@Path(PhoneNumber.FORMAT_DIN5008)
RestAction formatDin5008(@QueryParam(Parameters.LANGUAGE) final String planguage,
@QueryParam(Parameters.COUNTRY) final String pcountry,
@QueryParam(Parameters.PHONE_NUMBER) final String pphoneNumber);
@PUT
@Path(PhoneNumber.FORMAT_DIN5008_WITH_POS)
RestAction> formatDin5008WithPos(
final ValueWithPosAndCountry pphoneNumber);
@GET
@Path(PhoneNumber.FORMAT_DIN5008_INTERNATIONAL)
RestAction formatDin5008International(
@QueryParam(Parameters.LANGUAGE) final String planguage,
@QueryParam(Parameters.COUNTRY) final String pcountry,
@QueryParam(Parameters.PHONE_NUMBER) final String pphoneNumber);
@PUT
@Path(PhoneNumber.FORMAT_DIN5008_INTERNATIONAL_WITH_POS)
RestAction> formatDin5008InternationalWithPos(
final ValueWithPosAndCountry pphoneNumber);
@GET
@Path(PhoneNumber.FORMAT_DIN5008_NATIONAL)
RestAction formatDin5008National(@QueryParam(Parameters.LANGUAGE) final String planguage,
@QueryParam(Parameters.COUNTRY) final String pcountry,
@QueryParam(Parameters.PHONE_NUMBER) final String pphoneNumber);
@PUT
@Path(PhoneNumber.FORMAT_DIN5008_NATIONAL_WITH_POS)
RestAction> formatDin5008NationalWithPos(
final ValueWithPosAndCountry pphoneNumber);
@GET
@Path(PhoneNumber.FORMAT_RFC3966)
RestAction formatRfc3966(@QueryParam(Parameters.LANGUAGE) final String planguage,
@QueryParam(Parameters.COUNTRY) final String pcountry,
@QueryParam(Parameters.PHONE_NUMBER) final String pphoneNumber);
@PUT
@Path(PhoneNumber.FORMAT_RFC3966_WITH_POS)
RestAction> formatRfc3966WithPos(
final ValueWithPosAndCountry pphoneNumber);
@GET
@Path(PhoneNumber.FORMAT_MS)
RestAction formatMs(@QueryParam(Parameters.LANGUAGE) final String planguage,
@QueryParam(Parameters.COUNTRY) final String pcountry,
@QueryParam(Parameters.PHONE_NUMBER) final String pphoneNumber);
@PUT
@Path(PhoneNumber.FORMAT_MS_WITH_POS)
RestAction> formatMsWithPos(
final ValueWithPosAndCountry pphoneNumber);
@GET
@Path(PhoneNumber.FORMAT_URL)
RestAction formatUrl(@QueryParam(Parameters.LANGUAGE) final String planguage,
@QueryParam(Parameters.COUNTRY) final String pcountry,
@QueryParam(Parameters.PHONE_NUMBER) final String pphoneNumber);
@PUT
@Path(PhoneNumber.FORMAT_URL_WITH_POS)
RestAction> formatUrlWithPos(
final ValueWithPosAndCountry pphoneNumber);
@GET
@Path(PhoneNumber.FORMAT_COMMON)
RestAction formatCommon(@QueryParam(Parameters.LANGUAGE) final String planguage,
@QueryParam(Parameters.COUNTRY) final String pcountry,
@QueryParam(Parameters.PHONE_NUMBER) final String pphoneNumber);
@PUT
@Path(PhoneNumber.FORMAT_COMMON_WITH_POS)
RestAction> formatCommonWithPos(
final ValueWithPosAndCountry pphoneNumber);
@GET
@Path(PhoneNumber.FORMAT_COMMON_INTERNATIONAL)
RestAction formatCommonInternational(
@QueryParam(Parameters.LANGUAGE) final String planguage,
@QueryParam(Parameters.COUNTRY) final String pcountry,
@QueryParam(Parameters.PHONE_NUMBER) final String pphoneNumber);
@PUT
@Path(PhoneNumber.FORMAT_COMMON_INTERNATIONAL_WITH_POS)
RestAction> formatCommonInternationalWithPos(
final ValueWithPosAndCountry pphoneNumber);
@GET
@Path(PhoneNumber.FORMAT_COMMON_NATIONAL)
RestAction formatCommonNational(@QueryParam(Parameters.LANGUAGE) final String planguage,
@QueryParam(Parameters.COUNTRY) final String pcountry,
@QueryParam(Parameters.PHONE_NUMBER) final String pphoneNumber);
@PUT
@Path(PhoneNumber.FORMAT_COMMON_NATIONAL_WITH_POS)
RestAction> formatCommonNationalWithPos(
final ValueWithPosAndCountry pphoneNumber);
@GET
@Path(PhoneNumber.GET_SUGGESTIONS)
RestAction> getSuggestions(
@QueryParam(Parameters.LANGUAGE) final String planguage,
@QueryParam(Parameters.SEARCH) final String psearch,
@QueryParam(Parameters.LIMIT) final int plimit);
/**
* validate a phone number.
*
* @param pcountry default country
* @param pphoneNumber phone number to check
* @param pdin5008 set to true if DIN 5008 format is allowed
* @param pe123 set to true if E123 format is allowed
* @param puri set to true if URI format is allowed
* @param pms set to true if Microsoft format is allowed
* @param pcommon set to true if common format is allowed
* @return true if number is valid
*/
@GET
@Path(PhoneNumber.VALIDATE)
RestAction validate(@QueryParam(Parameters.COUNTRY) final String pcountry,
@QueryParam(Parameters.PHONE_NUMBER) final String pphoneNumber,
@QueryParam(Parameters.DIN_5008) final Boolean pdin5008,
@QueryParam(Parameters.E123) final Boolean pe123,
@QueryParam(Parameters.URI) final Boolean puri, @QueryParam(Parameters.MS) final Boolean pms,
@QueryParam(Parameters.COMMON) final Boolean pcommon);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy