Esempio n. 1
0
  /**
   * Registra nelle preferenze i nuovi valori che diventeranno i vecchi per la prossima sintesi
   * Sovrascritto
   */
  @Override
  protected void elaboraPreferenze() {
    Pref pref;
    String chiave;
    Object valore;

    for (Map.Entry mappa : mappaSintesi.entrySet()) {
      chiave = (String) mappa.getKey();
      valore = mappa.getValue();
      pref = Pref.findByCode(chiave);
      pref.setValore(valore);
      pref.save();
    } // end of for cycle

    mappaSintesi.clear();
  } // fine del metodo
Esempio n. 2
0
  /** Riga col numero di giorni */
  private ArrayList getRigaGiorni() {
    String prefCode = CostBio.STAT_NUM_GIORNI;
    String descrizione = tagPath + "Giorni|Giorni interessati";
    int oldValue = Pref.getInt(prefCode, 366);
    int newValue = Giorno.count();
    String nota = "Previsto il [[29 febbraio]] per gli [[Anno bisestile|anni bisestili]]";

    return getRigaBase(true, descrizione, nota, oldValue, newValue, prefCode);
  } // fine del metodo
Esempio n. 3
0
  /** Riga coi giorni di attesa */
  private ArrayList getRigaAttesa() {
    String prefCode = CostBio.STAT_GIORNI_ATTESA;
    String descrizione = "Giorni di attesa";
    int oldValue = Pref.getInt(prefCode, 5);
    int newValue = NUOVA_ATTESA;
    String nota =
        "Giorni di attesa '''indicativi''' prima che ogni singola voce venga ricontrollata per registrare eventuali modifiche intervenute nei parametri significativi.";

    return getRigaBase(false, descrizione, nota, oldValue, newValue, prefCode);
  } // fine del metodo
Esempio n. 4
0
  /** Riga col numero di nazionalità */
  private ArrayList getRigaNazionalita() {
    String prefCode = CostBio.STAT_NUM_NAZIONALITA;
    String descrizione = tagPath + "Nazionalità|Nazionalità utilizzate";
    int oldValue = Pref.getInt(prefCode, 300);
    int newValue = 87;
    String nota =
        "Le nazionalità sono quelle '''convenzionalmente''' previste dalla comunità ed inserite nell'elenco utilizzato dal template Bio";

    return getRigaBase(true, descrizione, nota, oldValue, newValue, prefCode);
  } // fine del metodo
Esempio n. 5
0
  /** Riga col numero di attività */
  private ArrayList getRigaAttivita() {
    String prefCode = CostBio.STAT_NUM_ATTIVITA;
    String descrizione = tagPath + "Attività|Attività utilizzate";
    int oldValue = Pref.getInt(prefCode, 600);
    int newValue = Attivita.countDistinct();
    String nota =
        "Le attività sono quelle '''convenzionalmente''' previste dalla comunità ed inserite nell'elenco utilizzato dal template Bio";

    return getRigaBase(true, descrizione, nota, oldValue, newValue, prefCode);
  } // fine del metodo
Esempio n. 6
0
  /** Riga col numero di anni */
  private ArrayList getRigaAnni() {
    String prefCode = CostBio.STAT_NUM_ANNI;
    int anniPreCristo = 1000;
    String descrizione = tagPath + "Anni|Anni interessati";
    int oldValue = Pref.getInt(prefCode, 3000);
    int newValue = LibDate.getYear() + anniPreCristo;
    String nota = "Potenzialmente dal [[1000 a.C.]] al [[{{CURRENTYEAR}}]]";

    return getRigaBase(true, descrizione, nota, oldValue, newValue, prefCode);
  } // fine del metodo
Esempio n. 7
0
  /** Riga col numero di voci */
  private ArrayList getRigaVoci() {
    String prefCode = CostBio.STAT_NUM_VOCI;
    String descrizione = ":Categoria:BioBot|Template bio";
    int oldValue = Pref.getInt(prefCode, 300000);
    int newValue = Bio.count();
    String nota =
        "Una differenza di '''poche unità''' tra le pagine della categoria e le voci gestite dal bot è '''fisiologica''' e dovuta ad imprecisioni nella redazione del tmpl Bio";

    return getRigaBase(true, descrizione, nota, oldValue, newValue, prefCode);
  } // fine del metodo
Esempio n. 8
0
  /** Corpo con elenco delle pagine */
  private String creaElenco() {
    String testoTabella = CostBio.VUOTO;
    String riga = CostBio.VUOTO;
    ArrayList listaPagine = new ArrayList();
    ArrayList listaRiga;
    HashMap mappaTavola = new HashMap();
    Cognome cognome;
    String cognomeText;
    int num;
    int taglioPagine = Pref.getInt(CostBio.TAGLIO_NOMI_PAGINA);
    String numText;
    String tag = "Persone di cognome ";
    ArrayList titoli = new ArrayList();
    titoli.add(LibWiki.setBold("Cognome"));
    titoli.add(LibWiki.setBold("Voci"));

    for (Map.Entry mappa : mappaCognomi.entrySet()) {

      cognome = (Cognome) mappa.getKey();
      cognomeText = cognome.getCognome();
      num = (Integer) mappa.getValue();
      numText = LibNum.format(num);
      if (num >= taglioPagine) {
        cognomeText = tag + cognomeText + CostBio.PIPE + cognomeText;
        cognomeText = LibWiki.setQuadre(cognomeText);
        cognomeText = LibWiki.setBold(cognomeText);
      } // end of if cycle

      listaRiga = new ArrayList();
      listaRiga.add(cognomeText);
      listaRiga.add(num);
      listaPagine.add(listaRiga);
    } // end of for cycle
    mappaTavola.put(Cost.KEY_MAPPA_SORTABLE_BOOLEAN, true);
    mappaTavola.put(Cost.KEY_MAPPA_TITOLI, titoli);
    mappaTavola.put(Cost.KEY_MAPPA_RIGHE_LISTA, listaPagine);
    testoTabella = LibWiki.creaTable(mappaTavola);

    return testoTabella;
  } // fine del metodo
Esempio n. 9
0
  /** Corpo della pagina Sovrascritto */
  @Override
  protected String elaboraBody() {
    String text = CostBio.VUOTO;
    int numCognomi = mappaCognomi.size();
    int numVoci = Bio.count();
    int taglioVoci = Pref.getInt(CostBio.TAGLIO_NOMI_ELENCO);

    text += A_CAPO;
    text += "==Nomi==";
    text += A_CAPO;
    text += "Elenco dei ";
    text += LibWiki.setBold(LibNum.format(numCognomi));
    text += " cognomi '''differenti'''  utilizzati nelle ";
    text += LibWiki.setBold(LibNum.format(numVoci));
    text += " voci biografiche con occorrenze maggiori di ";
    text += LibWiki.setBold(taglioVoci);
    text += A_CAPO;
    text += creaElenco();
    text += A_CAPO;

    return text;
  } // fine del metodo
Esempio n. 10
0
  /** Titoli della tabella di sintesi */
  private ArrayList<String> getCaption() {
    ArrayList<String> titoli = new ArrayList<String>();
    String statistiche = "Statistiche";
    Date oldDate = Pref.getDate(CostBio.STAT_DATA_ULTIMA_SINTESI, LibTime.adesso());
    String vecchiaData = LibTime.getGioMeseAnnoLungo(oldDate);
    String nuovaData = LibTime.getGioMeseAnnoLungo(new Date());
    String differenze = "&nbsp;&nbsp;&nbsp;&nbsp;Δ";

    // valore per le preferenze
    mappaSintesi.put(CostBio.STAT_DATA_ULTIMA_SINTESI, new Date());

    statistiche = regolaSpazi(statistiche);
    vecchiaData = regolaSpazi(vecchiaData);
    nuovaData = regolaSpazi(nuovaData);
    differenze = regolaSpazi(differenze);

    titoli.add(statistiche);
    titoli.add(vecchiaData);
    titoli.add(nuovaData);
    titoli.add(differenze);

    return titoli;
  } // fine del metodo
Esempio n. 11
0
 /** Retrieves this preference's value as Resource */
 public Resource getResource() {
   return Pref.getResource(code, null, defaultValue);
 }
Esempio n. 12
0
 /** Retrieves this preference's value as Image */
 public Image getImage() {
   return Pref.getImage(code, null, defaultValue);
 }
Esempio n. 13
0
 /** Retrieves this preference's value as String */
 public String getString() {
   return Pref.getString(code, null, defaultValue);
 }
Esempio n. 14
0
 /** Retrieves this preference's value as int */
 public int getInt() {
   return Pref.getInt(code, null, defaultValue);
 }
Esempio n. 15
0
 /** Retrieves this preference's value as BigDecimal */
 public BigDecimal getDecimal() {
   return Pref.getDecimal(code, null, defaultValue);
 }
Esempio n. 16
0
 /** Retrieves this preference's value as Date */
 public Date getDate() {
   return Pref.getDate(code, null, defaultValue);
 }
Esempio n. 17
0
 /** Retrieves this preference's value as byte[] */
 public byte[] getBytes() {
   return Pref.getBytes(code, null, defaultValue);
 }
Esempio n. 18
0
 /**
  * Writes a value in the storage for this preference
  *
  * <p>If the preference does not exist it is created now.
  *
  * @param value the value
  */
 public void put(Object value) {
   Pref.put(code, type, value);
 }
Esempio n. 19
0
 /**
  * Removes this preference from the storage.
  *
  * <p>
  */
 public void remove() {
   Pref.remove(code, null);
 }
Esempio n. 20
0
 /** Retrieves this preference's value as boolean */
 public boolean getBool() {
   return Pref.getBool(code, null, defaultValue);
 }