/** * {@inheritDoc} */ public Telephone createProperty(final List<Parameter> params, final String value) throws URISyntaxException { return new Telephone(params, value); }
/** * @param group a property group * @param uri specifies the URI of a telephone definition * @param types optional parameter types */ public Telephone(Group group, URI uri, Type...types) { super(group, Id.TEL); this.uri = normalise(uri); getParameters().add(Value.URI); for (Type type : types) { getParameters().add(type); } }
private void createTel(URI uri, URI prop, Telephone telephone) throws RDFHandlerException, RDFParseException { URI r_tel; if(telephone.getUri() != null) { r_tel = createURI(telephone.getUri().toString()); } else { r_tel = createURI("tel:"+telephone.getValue()); } if(telephone.getParameter(Parameter.Id.TYPE) != null) { Type type = (Type)telephone.getParameter(Parameter.Id.TYPE); for(String value : type.getTypes()) { if("HOME".equals(value)) { URI p_home = createURI(NS_VCARD + "homeTel"); rdfHandler.handleStatement(createStatement(uri,p_home,r_tel)); } else if("WORK".equals(value)) { URI p_work = createURI(NS_VCARD + "workTel"); rdfHandler.handleStatement(createStatement(uri,p_work,r_tel)); } else if("CELL".equals(value)) { URI p_work = createURI(NS_VCARD + "mobileTel"); rdfHandler.handleStatement(createStatement(uri,p_work,r_tel)); } else { rdfHandler.handleStatement(createStatement(uri,prop,r_tel)); } break; // only first one } } else { rdfHandler.handleStatement(createStatement(uri,prop,r_tel)); } }
/** * Factory constructor. * * @param group a property group * @param params property parameters * @param value string representation of a property value * @throws URISyntaxException where the specified value is not a valid URI */ public Telephone(Group group, List<Parameter> params, String value) throws URISyntaxException { super(group, Id.TEL, params); if (Value.URI.equals(getParameter(Parameter.Id.VALUE))) { this.uri = normalise(new URI(value.trim().replaceAll("\\s+", "-"))); } else { this.value = value; } }
/** * Provide backwards-compatibility for vCard 3.0. * @param value a non-URI value * @param types optional parameter types */ public Telephone(String value, Type...types) { super(null, Id.TEL); this.value = value; for (Type type : types) { getParameters().add(type); } }
private void createTel(URI uri, URI prop, Telephone telephone) throws RDFHandlerException, RDFParseException { URI r_tel; if(telephone.getUri() != null) { r_tel = createURI(telephone.getUri().toString()); } else { r_tel = createURI("tel:"+telephone.getValue()); } if(telephone.getParameter(Parameter.Id.TYPE) != null) { Type type = (Type)telephone.getParameter(Parameter.Id.TYPE); for(String value : type.getTypes()) { if("HOME".equals(value)) { URI p_home = createURI(NS_VCARD + "homeTel"); rdfHandler.handleStatement(createStatement(uri,p_home,r_tel)); } else if("WORK".equals(value)) { URI p_work = createURI(NS_VCARD + "workTel"); rdfHandler.handleStatement(createStatement(uri,p_work,r_tel)); } else if("CELL".equals(value)) { URI p_work = createURI(NS_VCARD + "mobileTel"); rdfHandler.handleStatement(createStatement(uri,p_work,r_tel)); } else { rdfHandler.handleStatement(createStatement(uri,prop,r_tel)); } break; // only first one } } else { rdfHandler.handleStatement(createStatement(uri,prop,r_tel)); } }
/** * Factory constructor. * @param group a property group * @param params property parameters * @param value string representation of a property value * @throws URISyntaxException where the specified value is not a valid URI */ public Telephone(Group group, List<Parameter> params, String value) throws URISyntaxException { super(group, Id.TEL, params); if (Value.URI.equals(getParameter(Parameter.Id.VALUE))) { this.uri = normalise(new URI(value.trim().replaceAll("\\s+", "-"))); } else { this.value = value; } }
/** * Provide backwards-compatibility for vCard 3.0. * * @param value a non-URI value * @param types optional parameter types */ public Telephone(String value, Type... types) { super(null, Id.TEL); this.value = value; for (Type type : types) { getParameters().add(type); } }
/** * @param group a property group * @param uri specifies the URI of a telephone definition * @param types optional parameter types */ public Telephone(Group group, URI uri, Type... types) { super(group, Id.TEL); this.uri = normalise(uri); getParameters().add(Value.URI); for (Type type : types) { getParameters().add(type); } }
/** * {@inheritDoc} */ public Telephone createProperty(final Group group, final List<Parameter> params, final String value) throws URISyntaxException { return new Telephone(group, params, value); } }
/** * {@inheritDoc} */ @Override public void validate() throws ValidationException { for (Parameter param : getParameters()) { final Parameter.Id id = param.getId(); if (!Parameter.Id.PID.equals(id) && !Parameter.Id.PREF.equals(id) && !Parameter.Id.TYPE.equals(id)) { throw new ValidationException(MessageFormat.format(ILLEGAL_PARAMETER_MESSAGE, id)); } } }
/** * {@inheritDoc} */ public Telephone createProperty(final List<Parameter> params, final String value) throws URISyntaxException { return new Telephone(params, value); }
/** * {@inheritDoc} */ @Override public void validate() throws ValidationException { for (Parameter param : getParameters()) { final Parameter.Id id = param.getId(); if (!Parameter.Id.PID.equals(id) && !Parameter.Id.PREF.equals(id) && !Parameter.Id.TYPE.equals(id)) { throw new ValidationException(MessageFormat.format(ILLEGAL_PARAMETER_MESSAGE, id)); } } }
/** * {@inheritDoc} */ public Telephone createProperty(final Group group, final List<Parameter> params, final String value) throws URISyntaxException, ParseException { return new Telephone(group, params, value); } }