/
ServiceItem.java
66 lines (59 loc) · 1.79 KB
/
ServiceItem.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package com.tomclaw.mandarin.xmpp;
import com.tomclaw.tcuilite.GroupChild;
import com.tomclaw.utils.LogUtil;
import java.util.Vector;
/**
* Solkin Igor Viktorovich, TomClaw Software, 2003-2013
* http://www.tomclaw.com/
* @author Solkin
*/
public class ServiceItem extends GroupChild {
public String jid = null;
public String node = null;
public Vector features = null;
/** Identity **/
public Vector identityes = null;
public ServiceItem( String jid, String node, String name ) {
super( "" );
this.jid = jid;
this.node = node;
this.name = name;
if ( name != null && name.length() > 0 ) {
this.title = name;
} else {
this.title = jid;
}
}
public Identity getIdentityByCategory( String category ) {
if ( identityes != null && !identityes.isEmpty() ) {
for ( int c = 0; c < identityes.size(); c++ ) {
if ( ( ( Identity ) identityes.elementAt( c ) ).category.equals( category ) ) {
return ( Identity ) identityes.elementAt( c );
}
}
}
return null;
}
public Identity getIdentityByType( String type ) {
if ( identityes != null && !identityes.isEmpty() ) {
for ( int c = 0; c < identityes.size(); c++ ) {
if ( ( ( Identity ) identityes.elementAt( c ) ).type.equals( type ) ) {
return ( Identity ) identityes.elementAt( c );
}
}
}
return null;
}
public boolean containsFeature( String feature ) {
LogUtil.outMessage( "Features present: " + ( features != null ) );
if ( features != null ) {
for ( int c = 0; c < features.size(); c++ ) {
LogUtil.outMessage( ( String ) features.elementAt( c ) );
if ( ( ( String ) features.elementAt( c ) ).equals( feature ) ) {
return true;
}
}
}
return false;
}
}