public static WorksheetEntry fromParser(XmlPullParser parser)
      throws XmlPullParserException, IOException {
    final int depth = parser.getDepth();
    final WorksheetEntry entry = new WorksheetEntry();

    String tag = null;
    int type;
    while (((type = parser.next()) != END_TAG || parser.getDepth() > depth)
        && type != END_DOCUMENT) {
      if (type == START_TAG) {
        tag = parser.getName();
        if (LINK.equals(tag)) {
          final String rel = parser.getAttributeValue(null, REL);
          final String href = parser.getAttributeValue(null, HREF);
          if (REL_LISTFEED.equals(rel)) {
            entry.mListFeed = href;
          }
        }
      } else if (type == END_TAG) {
        tag = null;
      } else if (type == TEXT) {
        final String text = parser.getText();
        if (TITLE.equals(tag)) {
          entry.mTitle = text;
        } else if (UPDATED.equals(tag)) {
          entry.mUpdated = ParserUtils.parseTime(text);
        }
      }
    }
    return entry;
  }
  public String activate() {
    getInstance().setValide(true);

    // Enregistrement de la demande
    String retour = super.update();
    if (!UPDATED.equals(retour)) {
      throw new BSException("error.demande.update");
    }

    events.raiseTransactionSuccessEvent("demandeAdded", getInstance());

    return UPDATED;
  }
  private void doFreeze(FreezeActionDef freezeActionDef) throws ActionInvocationException {
    TtGen ttGen = ttRepository.loadTT(getTTId(freezeActionDef));

    TtGenHome ttGenHome = TtGenHome.createInstance(ttGen);
    ttGenHome.setId(ttGen.getId());
    if (UPDATED.equals(ttGenHome.freeze())) {
      supportInfoLogger.saveSupportInfo(freezeActionDef);
    } else {
      throw new ActionInvocationException(
          String.format(
              "Freeze operation failed for TT with id: %s, please check prev. logs for error",
              ttGen.getId()));
    }
  }
  @Override
  @Transactional
  public String update() {
    info("Atempt to update request {0} for user {1}", getInstance(), utilisateurCourant);

    try {
      // Verification du pseudo
      if (!annonceHome.validerDateDebut() || !annonceHome.validerDateFin()) {
        return "dates_incorrectes";
      }

      // Maj du lieu
      getInstance().setLieuDepart(annonceHome.getLieuDepart().getLieu());
      getInstance().setLieuArrivee(annonceHome.getLieuArrivee().getLieu());

      getInstance().setDateMaj(new Date());

      getInstance().setNote(demandeHelper.getNote(getInstance()));

      // Enregistrement de l'utilisateur
      String retour = super.update();
      if (!UPDATED.equals(retour)) {
        throw new BSException("error.demande.update");
      }

      // annonceList.updateDemande(getInstance());
      events.raiseTransactionSuccessEvent("demandeUpdated", getInstance());

      info("Updated request {0} for user {1}", getInstance(), utilisateurCourant);

      return UPDATED;
    } catch (BSException bse) {
      error(
          "Error while updating request {0} for user {1} : {2} ",
          getInstance(), utilisateurCourant, bse.getMessage());
      throw bse;
    } catch (Exception e) {
      error(
          "Error while updating request {0} for user {1} : {2} ",
          getInstance(), utilisateurCourant, e.getMessage());
      throw new BSException("error.demande.update");
    }
  }
  @Transactional
  public String updateNote(Demande demande) {
    setInstance(demande);
    setDemandeNumAnnonce(demande.getNumAnnonce());
    wire();
    if (utilisateurCourant != null)
      info("Atempt to update Note request {0} for user {1}", getInstance(), utilisateurCourant);
    else info("Atempt to update Note request {0} for user {1}", getInstance(), "batch");

    try {
      demande.setNote(demandeHelper.getNote(getInstance()));

      // Enregistrement de la demande
      String retour = super.update();
      if (!UPDATED.equals(retour)) {
        throw new BSException("error.demande.update");
      }

      events.raiseTransactionSuccessEvent("demandeUpdated", getInstance());

      if (utilisateurCourant != null)
        info("Updated request {0} for user {1}", getInstance(), utilisateurCourant);
      else info("Updated request {0} for user {1}", getInstance(), "batch");

      return UPDATED;
    } catch (BSException bse) {
      error(
          "Error while updating Note request {0} for user {1} : {2} ",
          getInstance(), utilisateurCourant, bse.getMessage());
      throw bse;
    } catch (Exception e) {
      error(
          "Error while updating Note request {0} for user {1} : {2} ",
          getInstance(), utilisateurCourant, e.getMessage());
      throw new BSException("error.demande.update");
    }
  }