Esempio n. 1
0
 /** Clear the instance. */
 public static void clear() {
   if (avatarObject != null) {
     avatarObject.setContents(null);
     avatarObject.commit();
   }
   instance = null;
 }
Esempio n. 2
0
 /**
  * Retrieves the system's AvatarManager instance.
  *
  * @return Instance of AvatarManager.
  */
 public static AvatarManager getInstance() {
   if (instance == null) {
     avatarObject = PersistentStore.getPersistentObject(KEY);
     if (avatarObject.getContents() == null) {
       instance = new AvatarManager();
       synchronized (avatarObject) {
         avatarObject.setContents(instance);
       }
     } else {
       instance = (AvatarManager) avatarObject.getContents();
     }
   }
   return instance;
 }
Esempio n. 3
0
 public static NotificationManager getInstance() {
   if (instance == null) {
     notificationObject = PersistentStore.getPersistentObject(KEY);
     if (notificationObject.getContents() == null) {
       instance = new NotificationManager();
       synchronized (notificationObject) {
         notificationObject.setContents(instance);
       }
     } else {
       instance = (NotificationManager) notificationObject.getContents();
     }
   }
   return instance;
 }
Esempio n. 4
0
 /**
  * Set the system AvatarManager instance.
  *
  * @param avatarManager
  */
 public static void set(AvatarManager avatarManager) {
   instance = avatarManager;
   avatarObject = PersistentStore.getPersistentObject(KEY);
   synchronized (avatarObject) {
     avatarObject.setContents(instance);
   }
 }
Esempio n. 5
0
 /**
  * Set the indicated Avatar video played.
  *
  * @param unitIndex Index of Unit.
  * @param lessonIndex Index of Lesson.
  */
 public void setFilePlayed(int unitIndex, int lessonIndex) {
   String fileName = getFileName(unitIndex, lessonIndex);
   AvatarItem item = (AvatarItem) units.get(fileName);
   item.setHasPlay(true);
   units.put(fileName, item);
   avatarObject.commit();
 }
Esempio n. 6
0
 /**
  * Metodo que permite actualizar el objeto de usuario en la base de datos persistente
  *
  * @return
  */
 private boolean actualizar() {
   try {
     persist.commit();
     return true;
   } catch (Exception e) {
     return false;
   }
 }
Esempio n. 7
0
 /** Constructor del DAO para el Usuario */
 public UsuarioDB() {
   // setUrl();
   persist = PersistentStore.getPersistentObject(IDSTORE);
   try {
     usuario = (Usuario) persist.getContents();
   } catch (Exception e) {
     usuario = null;
   }
   try {
     if (usuario == null) {
       // usuario = new Usuario();
       // persist.setContents(usuario);
       persist.commit();
     }
   } catch (Exception e) {
   }
 }
Esempio n. 8
0
  private void startCounting() {
    nextUpdate = System.currentTimeMillis() + (12 * DateTimeUtilities.ONEHOUR);
    //		nextUpdate = System.currentTimeMillis() + (1 * DateTimeUtilities.ONEMINUTE);
    counting = true;
    notified = false;
    newItem = false;

    notificationObject.commit();

    System.out.println("[NotificationManager] now is " + System.currentTimeMillis());
    System.out.println("[NotificationManager] next update is " + nextUpdate);
  }
Esempio n. 9
0
  /**
   * Metodo que permite validar si los datos ingresados son de un usuario valido
   *
   * @return si es que el usuario es valido
   */
  public boolean validar() {
    SoapObject request = new SoapObject("http://tempuri.org", metodoWeb);
    request.addProperty("in0", codigo);
    request.addProperty("in1", clave);

    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
    envelope.bodyOut = request;
    HttpTransport ht = new HttpTransport(URL);

    envelope.encodingStyle = SoapSerializationEnvelope.ENC;
    try {
      ht.call("http://tempuri.org/" + metodoWeb, envelope);
      SoapObject result = (SoapObject) envelope.getResponse();

      usuario = new Usuario();
      usuario.setCodigo(getCodigo());
      usuario.setCodigoTrabajador(result.getProperty("codigoTrabajador").toString());
      usuario.setClave(getClave());
      usuario.setNombre(
          result.getProperty("apellidoPaterno").toString()
              + " "
              + result.getProperty("nombre").toString());
      usuario.setAutoValidar(false);
      usuario.setVersion(Sistema.getVersion());
      usuario.setImsi(Sistema.getImsi());
      usuario.setFechaDesdeCM("");
      usuario.setFechaHastaCM("");
      usuario.setFechaValidacion(Fechas.dateToString("yyyyMMdd"));
      persist.setContents(usuario);
      persist.commit();
      return true;

    } catch (Exception e) {
      usuario = null;
      e.printStackTrace();
    }
    return false;
  }
Esempio n. 10
0
 public void setNewItem(boolean newItem) {
   this.newItem = newItem;
   notificationObject.commit();
 }
Esempio n. 11
0
 public void setNotified(boolean notified) {
   this.notified = notified;
   notificationObject.commit();
 }
Esempio n. 12
0
 public void setCounting(boolean counting) {
   this.counting = counting;
   notificationObject.commit();
 }
Esempio n. 13
0
 public static void clear() {
   notificationObject.setContents(null);
   notificationObject.commit();
   instance = null;
 }