Exemplo n.º 1
0
  private static Iterable<?> readProjectEntry(XmlPullParser parser)
      throws XmlPullParserException, IOException {
    List<Object> project = AdeWebCollections.newArrayList();
    parser.require(XmlPullParser.START_TAG, NAMESPACE, TAG_PROJECT);

    project.add(DEFAULT_ID);
    project.add(parser.getAttributeValue(NAMESPACE, ATTR_NAME));
    project.add(parser.getAttributeValue(NAMESPACE, ATTR_ID));
    project.add(parser.getAttributeValue(NAMESPACE, ATTR_LOADED));

    parser.next();
    parser.require(XmlPullParser.END_TAG, NAMESPACE, TAG_PROJECT);

    return project;
  }
Exemplo n.º 2
0
  private static Iterable<?> readEventEntry(XmlPullParser parser)
      throws XmlPullParserException, IOException {
    List<Object> event = AdeWebCollections.newArrayList();
    parser.require(XmlPullParser.START_TAG, NAMESPACE, TAG_EVENT);

    event.add(DEFAULT_ID);
    event.add(parser.getAttributeValue(NAMESPACE, ATTR_NAME));
    event.add(parser.getAttributeValue(NAMESPACE, ATTR_DATE));
    event.add(parser.getAttributeValue(NAMESPACE, ATTR_START_HOUR));
    event.add(parser.getAttributeValue(NAMESPACE, ATTR_END_HOUR));
    event.add(DEFAULT_ID);
    event.add(DEFAULT_INTEGER);
    event.add(EMPTY_STRING);
    event.add(EMPTY_STRING);
    event.add(EMPTY_STRING);
    event.add(readColor(parser));
    event.add(parser.getAttributeValue(NAMESPACE, ATTR_NOTE));
    event.add(parser.getAttributeValue(NAMESPACE, ATTR_ID));
    event.add(LessonConstants.DELETED_FALSE);
    event.add(parser.getAttributeValue(NAMESPACE, ATTR_LAST_UPDATE));
    event.add(null);
    event.add(null);
    event.add(null);
    event.add(null);
    event.add(parser.getAttributeValue(NAMESPACE, ATTR_CREATION));
    event.add(DEFAULT_INTEGER);
    event.add(Integer.valueOf(LessonConstants.LESSON_TYPE_LESSON));

    parser.nextTag();
    parser.require(XmlPullParser.START_TAG, NAMESPACE, TAG_RESOURCES);
    while (parser.next() != XmlPullParser.END_TAG) {
      if (parser.getEventType() != XmlPullParser.START_TAG) {
        continue;
      }
      readResourceEntry(parser, event);
    }
    parser.require(XmlPullParser.END_TAG, NAMESPACE, TAG_RESOURCES);

    parser.nextTag();
    parser.require(XmlPullParser.START_TAG, NAMESPACE, TAG_ADDITIONAL);
    skip(parser);
    parser.nextTag();
    parser.require(XmlPullParser.END_TAG, NAMESPACE, TAG_EVENT);

    return event;
  }