mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-25 21:42:07 +01:00
Fix style issues in Workgroup Macros
This commit is contained in:
parent
74e3d56ba2
commit
4c13ea4125
1 changed files with 56 additions and 62 deletions
|
@ -126,80 +126,74 @@ public class Macros extends IQ {
|
|||
}
|
||||
|
||||
public Macro parseMacro(XmlPullParser parser) throws XmlPullParserException, IOException {
|
||||
// CHECKSTYLE:OFF
|
||||
Macro macro = new Macro();
|
||||
boolean done = false;
|
||||
Macro macro = new Macro();
|
||||
boolean done = false;
|
||||
while (!done) {
|
||||
int eventType = parser.next();
|
||||
if (eventType == XmlPullParser.START_TAG) {
|
||||
if (parser.getName().equals("title")) {
|
||||
parser.next();
|
||||
macro.setTitle(parser.getText());
|
||||
}
|
||||
else if (parser.getName().equals("description")) {
|
||||
macro.setDescription(parser.nextText());
|
||||
}
|
||||
else if (parser.getName().equals("response")) {
|
||||
macro.setResponse(parser.nextText());
|
||||
}
|
||||
else if (parser.getName().equals("type")) {
|
||||
macro.setType(Integer.valueOf(parser.nextText()).intValue());
|
||||
}
|
||||
}
|
||||
else if (eventType == XmlPullParser.END_TAG) {
|
||||
if (parser.getName().equals("macro")) {
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
int eventType = parser.next();
|
||||
if (eventType == XmlPullParser.START_TAG) {
|
||||
if (parser.getName().equals("title")) {
|
||||
parser.next();
|
||||
macro.setTitle(parser.getText());
|
||||
}
|
||||
else if (parser.getName().equals("description")) {
|
||||
macro.setDescription(parser.nextText());
|
||||
}
|
||||
else if (parser.getName().equals("response")) {
|
||||
macro.setResponse(parser.nextText());
|
||||
}
|
||||
else if (parser.getName().equals("type")) {
|
||||
macro.setType(Integer.valueOf(parser.nextText()).intValue());
|
||||
}
|
||||
}
|
||||
else if (eventType == XmlPullParser.END_TAG) {
|
||||
if (parser.getName().equals("macro")) {
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return macro;
|
||||
// CHECKSTYLE:ON
|
||||
return macro;
|
||||
}
|
||||
|
||||
public MacroGroup parseMacroGroup(XmlPullParser parser) throws XmlPullParserException, IOException {
|
||||
// CHECKSTYLE:OFF
|
||||
MacroGroup group = new MacroGroup();
|
||||
MacroGroup group = new MacroGroup();
|
||||
|
||||
boolean done = false;
|
||||
while (!done) {
|
||||
int eventType = parser.next();
|
||||
if (eventType == XmlPullParser.START_TAG) {
|
||||
if (parser.getName().equals("macrogroup")) {
|
||||
group.addMacroGroup(parseMacroGroup(parser));
|
||||
}
|
||||
if (parser.getName().equals("title")) {
|
||||
group.setTitle(parser.nextText());
|
||||
}
|
||||
if (parser.getName().equals("macro")) {
|
||||
group.addMacro(parseMacro(parser));
|
||||
}
|
||||
}
|
||||
else if (eventType == XmlPullParser.END_TAG) {
|
||||
if (parser.getName().equals("macrogroup")) {
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
int eventType = parser.next();
|
||||
if (eventType == XmlPullParser.START_TAG) {
|
||||
if (parser.getName().equals("macrogroup")) {
|
||||
group.addMacroGroup(parseMacroGroup(parser));
|
||||
}
|
||||
if (parser.getName().equals("title")) {
|
||||
group.setTitle(parser.nextText());
|
||||
}
|
||||
if (parser.getName().equals("macro")) {
|
||||
group.addMacro(parseMacro(parser));
|
||||
}
|
||||
}
|
||||
else if (eventType == XmlPullParser.END_TAG) {
|
||||
if (parser.getName().equals("macrogroup")) {
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return group;
|
||||
// CHECKSTYLE:ON
|
||||
return group;
|
||||
}
|
||||
|
||||
public MacroGroup parseMacroGroups(String macros) throws XmlPullParserException, IOException {
|
||||
// CHECKSTYLE:OFF
|
||||
MacroGroup group = null;
|
||||
XmlPullParser parser = XmlPullParserFactory.newInstance().newPullParser();
|
||||
parser.setInput(new StringReader(macros));
|
||||
int eventType = parser.getEventType();
|
||||
while (eventType != XmlPullParser.END_DOCUMENT) {
|
||||
eventType = parser.next();
|
||||
if (eventType == XmlPullParser.START_TAG) {
|
||||
if (parser.getName().equals("macrogroup")) {
|
||||
group = parseMacroGroup(parser);
|
||||
}
|
||||
}
|
||||
}
|
||||
return group;
|
||||
// CHECKSTYLE:ON
|
||||
MacroGroup group = null;
|
||||
XmlPullParser parser = XmlPullParserFactory.newInstance().newPullParser();
|
||||
parser.setInput(new StringReader(macros));
|
||||
int eventType = parser.getEventType();
|
||||
while (eventType != XmlPullParser.END_DOCUMENT) {
|
||||
eventType = parser.next();
|
||||
if (eventType == XmlPullParser.START_TAG) {
|
||||
if (parser.getName().equals("macrogroup")) {
|
||||
group = parseMacroGroup(parser);
|
||||
}
|
||||
}
|
||||
}
|
||||
return group;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue