1 package org.unicode.cldr.web;
2 
3 import org.unicode.cldr.test.CheckCLDR.CheckStatus;
4 import org.unicode.cldr.web.DataSection.DataRow;
5 import org.unicode.cldr.web.DataSection.DataRow.CandidateItem;
6 
7 /**
8  * Callback interface for handling the results of user input changes to survey
9  * tool data. The survey tool will call these functions to record changes.
10  *
11  * @author srl
12  *
13  */
14 public interface DataSubmissionResultHandler {
15 
16     /**
17      * If nonzero, some results were updated.
18      *
19      * @param resultCount
20      *            number of results which were updated.
21      */
22     void handleResultCount(int resultCount);
23 
24     /**
25      * Items were removed from a row.
26      *
27      * @param row
28      *            which row
29      * @param item
30      *            item which was removed
31      * @param voteRemoved
32      *            The item had the user's vote on it, which was also removed.
33      */
34     void handleRemoveItem(DataRow row, CandidateItem item, boolean voteRemoved);
35 
36     /**
37      * Failure: You didn't have permission to do this operation
38      *
39      * @param p
40      *            Row in question
41      * @param optionalItem
42      *            item in question, or null
43      * @param string
44      *            informational string
45      */
46     void handleNoPermission(DataRow p, CandidateItem optionalItem, String string);
47 
48     /**
49      * A vote was removed
50      *
51      * @param p
52      *            which row
53      * @param voter
54      *            which users' vote
55      * @param item
56      *            which item
57      */
58     void handleRemoveVote(DataRow p, UserRegistry.User voter, CandidateItem item);
59 
60     /**
61      * An requested change was empty.
62      *
63      * @param p
64      *            row
65      */
66     void handleEmptyChangeto(DataRow p);
67 
68     /**
69      * User was already voting for this item
70      *
71      * @param p
72      *            row
73      * @param item
74      *            item
75      */
76     void warnAlreadyVotingFor(DataRow p, CandidateItem item);
77 
78     /**
79      * User voted for an extant item, it was accepted as a vote for that item
80      *
81      * @param p
82      *            row
83      * @param item
84      *            the extant item
85      */
86     void warnAcceptedAsVoteFor(DataRow p, CandidateItem item);
87 
88     /**
89      * A new value was accepted
90      *
91      * @param p
92      *            row
93      * @param choice_v
94      *            new value
95      * @param hadFailures
96      *            true if there were failures
97      */
98     void handleNewValue(DataRow p, String choice_v, boolean hadFailures);
99 
100     /**
101      * Error when adding/changing value.
102      *
103      * @param p
104      *            row
105      * @param status
106      *            which error
107      * @param choice_v
108      *            which new value
109      */
110     void handleError(DataRow p, CheckStatus status, String choice_v);
111 
112     /**
113      * Item was removed
114      *
115      * @param p
116      */
117     void handleRemoved(DataRow p);
118 
119     /**
120      * Vote was accepted
121      *
122      * @param p
123      * @param oldVote
124      * @param value
125      */
126     void handleVote(DataRow p, String oldVote, String value);
127 
128     /**
129      * Internal error, an unknown choice was made.
130      *
131      * @param p
132      * @param choice
133      */
134     void handleUnknownChoice(DataRow p, String choice);
135 
136     /**
137      * @return true if this errored item should NOT be added to the data.
138      * @param p
139      */
140     boolean rejectErrorItem(DataRow p);
141 
142     /**
143      * Note that an item was proposed as an option. Used for UI, to get back the
144      * user's previous request.
145      *
146      * @param p
147      * @param choice_v
148      */
149     void handleProposedValue(DataRow p, String choice_v);
150 
151 }