blob: a48d6600e6e7ac5ac9e486393332998ed8c59098 (
plain)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
/*
* Jitsi, the OpenSource Java VoIP and Instant Messaging client.
*
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed 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 net.java.sip.communicator.service.protocol.event;
import java.util.*;
import net.java.sip.communicator.service.protocol.*;
/**
* Events of this class represent the fact that a server stored
* subscription/contact has been moved from one server stored group to another.
* Such events are only generated by implementations of
* OperationSetPersistentPresence as non persistent presence operation sets do
* not support the notion of server stored groups.
*
* @author Emil Ivov
*/
public class SubscriptionMovedEvent
extends EventObject
{
/**
* Serial version UID.
*/
private static final long serialVersionUID = 0L;
private ContactGroup oldParent = null;
private ContactGroup newParent = null;
private ProtocolProviderService sourceProvider = null;
/**
* Creates an event instance with the specified source contact and old and
* new parent.
*
* @param sourceContact the <tt>Contact</tt> that has been moved.
* @param sourceProvider a reference to the <tt>ProtocolProviderService</tt>
* that the source <tt>Contact</tt> belongs to.
* @param oldParent the <tt>ContactGroup</tt> that has previously been
* the parent
* @param newParent the new <tt>ContactGroup</tt> parent of
* <tt>sourceContact</tt>
*/
public SubscriptionMovedEvent(Contact sourceContact,
ProtocolProviderService sourceProvider,
ContactGroup oldParent,
ContactGroup newParent)
{
super(sourceContact);
this.oldParent = oldParent;
this.newParent = newParent;
this.sourceProvider = sourceProvider;
}
/**
* Returns a reference to the contact that has been moved.
* @return a reference to the <tt>Contact</tt> that has been moved.
*/
public Contact getSourceContact()
{
return (Contact)getSource();
}
/**
* Returns a reference to the ContactGroup that contained the source contact
* before it was moved.
* @return a reference to the previous <tt>ContactGroup</tt> parent of
* the source <tt>Contact</tt>.
*/
public ContactGroup getOldParentGroup()
{
return oldParent;
}
/**
* Returns a reference to the ContactGroup that currently contains the
* source contact.
*
* @return a reference to the current <tt>ContactGroup</tt> parent of
* the source <tt>Contact</tt>.
*/
public ContactGroup getNewParentGroup()
{
return newParent;
}
/**
* Returns the provider that the source contact belongs to.
* @return the provider that the source contact belongs to.
*/
public ProtocolProviderService getSourceProvider()
{
return sourceProvider;
}
/**
* Returns a String representation of this ContactPresenceStatusChangeEvent
*
* @return A a String representation of this
* SubscriptionMovedEvent.
*/
@Override
public String toString()
{
StringBuffer buff
= new StringBuffer("SubscriptionMovedEvent-[ ContactID=");
buff.append(getSourceContact().getAddress());
buff.append(", OldParentGroup=").append(getOldParentGroup().getGroupName());
buff.append(", NewParentGroup=").append(getNewParentGroup().getGroupName());
return buff.toString();
}
}
|