}
else if(EncodingType.SEVEN_BIT.getType().equalsIgnoreCase(val)) {
vcardType.setEncodingType(EncodingType.SEVEN_BIT);
}
else {
throw new VCardParseException("Invalid encoding type \""+val+"\"");
}
}
else if("LANGUAGE".equalsIgnoreCase(nam)) {
vcardType.setLanguage(val);
}
else if("TYPE".equalsIgnoreCase(nam)) {
switch(typeName)
{
case PHOTO:
case LOGO:
{
if(vcardType instanceof PhotoFeature) {
ImageMediaType mediaType = ImageMediaType.valueOf(val);
if(mediaType == null){
mediaType = new ImageMediaType(val, val, val);
}
((PhotoFeature)vcardType).setImageMediaType(mediaType);
}
if(vcardType instanceof LogoFeature) {
ImageMediaType mediaType = ImageMediaType.valueOf(val);
if(mediaType == null){
mediaType = new ImageMediaType(val, val, val);
}
((LogoFeature)vcardType).setImageMediaType(mediaType);
}
break;
}
case SOUND:
{
if(vcardType instanceof SoundFeature) {
AudioMediaType mediaType = AudioMediaType.valueOf(val);
if(mediaType == null) {
mediaType = new AudioMediaType(val, val, val);
}
((SoundFeature)vcardType).setAudioMediaType(mediaType);
}
break;
}
case KEY:
{
if(vcardType instanceof KeyFeature) {
KeyTextType keyTextType = KeyTextType.valueOf(val);
if(keyTextType == null) {
keyTextType = new KeyTextType(val, val, val);
}
((KeyFeature)vcardType).setKeyTextType(keyTextType);
}
break;
}
case ADR:
{
if(vcardType instanceof AdrFeature) {
if(val.indexOf(',') != -1) {
String[] typeValueList = val.split(",");
for(String typeValue : typeValueList) {
setAdrParamType((AdrType)vcardType, typeValue);
}
}
else {
setAdrParamType((AdrType)vcardType, val);
}
}
break;
}
case LABEL:
{
if(vcardType instanceof LabelFeature) {
if(val.indexOf(',') != -1) {
String[] typeValueList = val.split(",");
for(String typeValue : typeValueList) {
setLabelParamType((LabelType)vcardType, typeValue);
}
}
else {
setLabelParamType((LabelType)vcardType, val);
}
}
break;
}
case TEL:
{
if(vcardType instanceof TelFeature) {
if(val.indexOf(',') != -1) {
String[] typeValueList = pt.getValue().split(",");
for(String typeValue : typeValueList) {
setTelParamType((TelType)vcardType, typeValue);
}
}
else {
setTelParamType((TelType)vcardType, val);
}
}
break;
}
case EMAIL:
{
if(vcardType instanceof EmailFeature) {
if(val.indexOf(',') != -1) {
String[] typeValueList = pt.getValue().split(",");
for(String typeValue : typeValueList) {
setEmailParamType((EmailType)vcardType, typeValue);
}
}
else {
setEmailParamType((EmailType)vcardType, val);
}
}
break;
}
case URL:
{
if(vcardType instanceof UrlFeature) {
if(val.indexOf(',') != -1) {
String[] typeValueList = pt.getValue().split(",");
for(String typeValue : typeValueList) {
setUrlParamType((UrlType)vcardType, typeValue);
}
}
else {
setUrlParamType((UrlType)vcardType, val);
}
}
break;
}
case IMPP:
{
if(vcardType instanceof ImppFeature) {
if(val.indexOf(',') != -1) {
String[] typeValueList = pt.getValue().split(",");
for(String typeValue : typeValueList) {
setImppParamType((ImppType)vcardType, typeValue);
}
}
else {
setImppParamType((ImppType)vcardType, val);
}
}
break;
}
default:
{
if(val.indexOf(',') != -1) {
String[] typeValueList = pt.getValue().split(",");
for(String typeValue : typeValueList) {
vcardType.addExtendedParam(new ExtendedParamType(nam, typeValue, VCardTypeName.XTENDED));
}
}
else {
vcardType.addExtendedParam(new ExtendedParamType(nam, val, VCardTypeName.XTENDED));
}
break;
}
}//switch type name
}
else if("VALUE".equalsIgnoreCase(nam)) {
if("URI".equalsIgnoreCase(val)) {
vcardType.setEncodingType(EncodingType.EIGHT_BIT);
}
else if("DATE".equalsIgnoreCase(val)) {
switch(typeName)
{
case BDAY:
{
if(vcardType instanceof BDayFeature) {
((BDayFeature)vcardType).setParam(BDayParamType.DATE);
}
break;
}
}
}
else if("DATE-TIME".equalsIgnoreCase(val)) {
switch(typeName)
{
case BDAY:
{
if(vcardType instanceof BDayFeature) {
((BDayFeature)vcardType).setParam(BDayParamType.DATE_TIME);
}
break;
}
}
}
else if("TEXT".equalsIgnoreCase(val)) {
switch(typeName)
{
case TZ:
{
if(vcardType instanceof TzFeature) {
((TzType)vcardType).setParamType(TzParamType.TEXT);
}
break;
}
}
}
else if("UTC-OFFSET".equalsIgnoreCase(val)) {
switch(typeName)
{
case TZ:
{
if(vcardType instanceof TzFeature) {
((TzType)vcardType).setParamType(TzParamType.UTC_OFFSET);
}
break;
}
}
}
else {
throw new VCardParseException("Invalid value type \""+val+"\"");
}
}
else {
vcardType.addExtendedParam(new ExtendedParamType(nam, val, typeName));
}