/** Clear the instance. */ public static void clear() { if (avatarObject != null) { avatarObject.setContents(null); avatarObject.commit(); } instance = null; }
/** * 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; }
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; }
/** * Set the system AvatarManager instance. * * @param avatarManager */ public static void set(AvatarManager avatarManager) { instance = avatarManager; avatarObject = PersistentStore.getPersistentObject(KEY); synchronized (avatarObject) { avatarObject.setContents(instance); } }
/** * 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(); }
/** * 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; } }
/** 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) { } }
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); }
/** * 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; }
public void setNewItem(boolean newItem) { this.newItem = newItem; notificationObject.commit(); }
public void setNotified(boolean notified) { this.notified = notified; notificationObject.commit(); }
public void setCounting(boolean counting) { this.counting = counting; notificationObject.commit(); }
public static void clear() { notificationObject.setContents(null); notificationObject.commit(); instance = null; }