a sysadmin to create mass quantities of user accounts automatically by uploading an XML file
174 lines
4.2 KiB
Java
174 lines
4.2 KiB
Java
/*
|
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
|
* (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.mozilla.org/MPL/>.
|
|
*
|
|
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
|
|
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
|
* language governing rights and limitations under the License.
|
|
*
|
|
* The Original Code is the Venice Web Communities System.
|
|
*
|
|
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
|
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
|
* Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
|
*
|
|
* Contributor(s):
|
|
*/
|
|
package com.silverwrist.venice.util;
|
|
|
|
import org.w3c.dom.*;
|
|
import com.silverwrist.util.*;
|
|
import com.silverwrist.venice.except.*;
|
|
|
|
public class VCardPhone
|
|
{
|
|
/*--------------------------------------------------------------------------------
|
|
* Predicate class to use for searches
|
|
*--------------------------------------------------------------------------------
|
|
*/
|
|
|
|
static abstract class Predicate
|
|
{
|
|
public abstract boolean test(VCardPhone p);
|
|
|
|
} // end class Predicate
|
|
|
|
/*--------------------------------------------------------------------------------
|
|
* Attributes
|
|
*--------------------------------------------------------------------------------
|
|
*/
|
|
|
|
private boolean home_phone;
|
|
private boolean work_phone;
|
|
private boolean voice_phone;
|
|
private boolean fax_phone;
|
|
private boolean pager;
|
|
private boolean message;
|
|
private boolean cell_phone;
|
|
private boolean video_phone;
|
|
private boolean bbs_phone;
|
|
private boolean modem_phone;
|
|
private boolean isdn_phone;
|
|
private boolean pcs_phone;
|
|
private boolean preferred;
|
|
private String number;
|
|
|
|
/*--------------------------------------------------------------------------------
|
|
* Constructor
|
|
*--------------------------------------------------------------------------------
|
|
*/
|
|
|
|
VCardPhone(Element elt)
|
|
{
|
|
DOMElementHelper h = new DOMElementHelper(elt);
|
|
home_phone = h.hasChildElement("HOME");
|
|
work_phone = h.hasChildElement("WORK");
|
|
voice_phone = h.hasChildElement("VOICE");
|
|
fax_phone = h.hasChildElement("FAX");
|
|
pager = h.hasChildElement("PAGER");
|
|
message = h.hasChildElement("MSG");
|
|
cell_phone = h.hasChildElement("CELL");
|
|
video_phone = h.hasChildElement("VIDEO");
|
|
bbs_phone = h.hasChildElement("BBS");
|
|
modem_phone = h.hasChildElement("MODEM");
|
|
isdn_phone = h.hasChildElement("ISDN");
|
|
pcs_phone = h.hasChildElement("PCS");
|
|
preferred = h.hasChildElement("PREF");
|
|
number = VCard.cleanup(h.getSubElementText("NUMBER"));
|
|
if (number==null)
|
|
number = VCard.cleanup(h.getElementText());
|
|
|
|
} // end constructor
|
|
|
|
/*--------------------------------------------------------------------------------
|
|
* External getters/setters
|
|
*--------------------------------------------------------------------------------
|
|
*/
|
|
|
|
public final boolean isHomePhone()
|
|
{
|
|
return home_phone;
|
|
|
|
} // end isHomePhone
|
|
|
|
public final boolean isWorkPhone()
|
|
{
|
|
return work_phone;
|
|
|
|
} // end isWorkPhone
|
|
|
|
public final boolean isVoicePhone()
|
|
{
|
|
return voice_phone;
|
|
|
|
} // end isVoicePhone
|
|
|
|
public final boolean isFax()
|
|
{
|
|
return fax_phone;
|
|
|
|
} // end isFax
|
|
|
|
public final boolean isPager()
|
|
{
|
|
return pager;
|
|
|
|
} // end isPager
|
|
|
|
public final boolean isMessage()
|
|
{
|
|
return message;
|
|
|
|
} // end isMessage
|
|
|
|
public final boolean isCellPhone()
|
|
{
|
|
return cell_phone;
|
|
|
|
} // end isCellPhone
|
|
|
|
public final boolean isVideoPhone()
|
|
{
|
|
return video_phone;
|
|
|
|
} // end isVideoPhone
|
|
|
|
public final boolean isBBS()
|
|
{
|
|
return bbs_phone;
|
|
|
|
} // end isBBS
|
|
|
|
public final boolean isModemPhone()
|
|
{
|
|
return modem_phone;
|
|
|
|
} // end isModemPhone
|
|
|
|
public final boolean isISDNPhone()
|
|
{
|
|
return isdn_phone;
|
|
|
|
} // end isISDNPhone
|
|
|
|
public final boolean isPCSPhone()
|
|
{
|
|
return pcs_phone;
|
|
|
|
} // end isPCSPhone
|
|
|
|
public final boolean isPreferred()
|
|
{
|
|
return preferred;
|
|
|
|
} // end isPreferred
|
|
|
|
public final String getNumber()
|
|
{
|
|
return number;
|
|
|
|
} // end getNumber
|
|
|
|
} // end class VCardPhone
|