Exemple #1
0
 /** Parse User validation datetime */
 public static Date parseValidationDateTime(String datetime) {
   return DateTimeFormat.getFormat(
           BaseNLS.constants().format_validation_date()
               + " "
               + BaseNLS.constants().format_validation_time())
       .parse(datetime);
 }
    @SuppressWarnings("deprecation")
    @Override
    public Date parse(DateBox dateBox, String text, boolean reportError) {

      Date date = null;
      try {
        if (text.length() > 0) {
          date = dateTimeFormat.parse(text);
        }
        isValid = true;
      } catch (IllegalArgumentException exception) {
        try {
          date = new Date(text);
          isValid = true;
        } catch (IllegalArgumentException e) {
          isValid = false;
          if (reportError) {
            if (!formatErrorIdentified) {
              delegate.recordError(
                  BaseNLS.messages().error_format_date(BaseNLS.constants().format_date()), text, e);
              formatErrorIdentified = true;
            }
          }
          return null;
        }
      }
      return date;
    }
  @Override
  public void createFilterWidgets() {

    castb_patient_identifiantBox = new TextBox();
    castb_patient_identifiantFilterBox = new ImogFilterBox(castb_patient_identifiantBox);
    castb_patient_identifiantFilterBox.setFilterLabel(NLS.constants().patient_field_identifiant());
    addTableFilter(castb_patient_identifiantFilterBox);
    castb_patient_nomBox = new TextBox();
    castb_patient_nomFilterBox = new ImogFilterBox(castb_patient_nomBox);
    castb_patient_nomFilterBox.setFilterLabel(NLS.constants().patient_field_nom());
    addTableFilter(castb_patient_nomFilterBox);

    dateExamenAfterBox = new DateBox();
    dateExamenAfterBox.setFormat(new SimpleImogDateFormat(DateUtil.getDateFormater()));
    dateExamenAfterFilterBox = new ImogFilterBox(dateExamenAfterBox);
    dateExamenAfterFilterBox.setFilterLabel(
        NLS.constants().examenATB_field_dateExamen()
            + BaseNLS.constants().search_operator_superior());
    addTableFilter(dateExamenAfterFilterBox);

    dateExamenBeforeBox = new DateBox();
    dateExamenBeforeBox.setFormat(new SimpleImogDateFormat(DateUtil.getDateFormater()));
    dateExamenBeforeFilterBox = new ImogFilterBox(dateExamenBeforeBox);
    dateExamenBeforeFilterBox.setFilterLabel(
        NLS.constants().examenATB_field_dateExamen()
            + BaseNLS.constants().search_operator_inferior());
    addTableFilter(dateExamenBeforeFilterBox);

    raisonDepistageBox = new ListBox();
    raisonDepistageBox.addItem("", BaseNLS.constants().enumeration_unknown());
    raisonDepistageBox.setSelectedIndex(0);
    raisonDepistageBox.addItem(
        NLS.constants().examenATB_raisonDepistage_diagnostic_option(),
        EpicamEnumConstants.EXAMENATB_RAISONDEPISTAGE_DIAGNOSTIC);
    raisonDepistageBox.addItem(
        NLS.constants().examenATB_raisonDepistage_suivi_option(),
        EpicamEnumConstants.EXAMENATB_RAISONDEPISTAGE_SUIVI);
    raisonDepistageFilterBox = new ImogFilterBox(raisonDepistageBox);
    raisonDepistageFilterBox.setFilterLabel(NLS.constants().examenATB_field_raisonDepistage());
    addTableFilter(raisonDepistageFilterBox);

    resultatBox = new TextBox();
    resultatFilterBox = new ImogFilterBox(resultatBox);
    resultatFilterBox.setFilterLabel(NLS.constants().examenATB_field_resultat());
    addTableFilter(resultatFilterBox);

    deletedEntityBox = new ImogBooleanAsRadio();
    deletedEntityBox.isStrict(true);
    deletedEntityBox.setEnabled(true);
    deletedEntityBox.setValue(false);
    deletedEntityBoxFilterBox = new ImogFilterBox(deletedEntityBox);
    deletedEntityBoxFilterBox.setFilterLabel(BaseNLS.constants().entity_field_deleted());
    addTableFilter(deletedEntityBoxFilterBox);
  }
  /** Validate fields values */
  public void validateFields() {

    // patient is a required field
    if (patient.getValue() == null)
      delegate.recordError(BaseNLS.messages().error_required(), null, "patient");
    // patientLie is a required field
    if (patientLie.getValue() == null)
      delegate.recordError(BaseNLS.messages().error_required(), null, "patientLie");
    // typeRelation is a required field
    if (typeRelation.getValue() == null)
      delegate.recordError(BaseNLS.messages().error_required(), null, "typeRelation");
  }
  /** Validate fields values */
  public void validateFields() {

    // casTb is a required field
    if (casTb.getValue() == null)
      delegate.recordError(BaseNLS.messages().error_required(), null, "casTb");
    // date is a required field
    if (date.getValueWithoutParseException() == null && date.isValid())
      delegate.recordError(BaseNLS.messages().error_required(), null, "date");
    // raisonDepistage is a required field
    if (raisonDepistage.getValue() == null)
      delegate.recordError(BaseNLS.messages().error_required(), null, "raisonDepistage");
    // resultat is a required field
    if (resultat.getValue() == null)
      delegate.recordError(BaseNLS.messages().error_required(), null, "resultat");
  }
  @Override
  public String fullTextSearch(String text) {

    boolean fullTextSearch = false;
    StringBuffer buffer = new StringBuffer(BaseNLS.constants().label_filtered() + " ");

    if (text == null || (text != null && text.equals(""))) {
      setSearchCriterions(null);
    } else {

      String locale = NLS.constants().locale();

      PriseMedicamentRegimeRequest request = (PriseMedicamentRegimeRequest) getContext();
      newRequest = false;

      ImogJunctionProxy junction = request.create(ImogConjunctionProxy.class);
      List<ImogCriterionProxy> criterias = new ArrayList<ImogCriterionProxy>();

      ImogJunctionProxy disJunction = request.create(ImogDisjunctionProxy.class);
      List<ImogCriterionProxy> criterionList = new ArrayList<ImogCriterionProxy>();

      // Search field Designation
      BasicCriteriaProxy medicament_designationCrit = request.create(BasicCriteriaProxy.class);
      medicament_designationCrit.setField("medicament.designation");
      medicament_designationCrit.setOperation(CriteriaConstants.STRING_OPERATOR_CONTAINS);
      medicament_designationCrit.setValue(text);
      buffer.append(
          "("
              + NLS.constants().medicament_field_designation()
              + ": "
              + text
              + ") "
              + SYMBOL_OR
              + " ");
      criterionList.add(medicament_designationCrit);

      disJunction.setCriterions(criterionList);
      criterias.add(disJunction);
      fullTextSearch = true;

      if (ProfileUtil.isAdmin()) {
        BasicCriteriaProxy isDeletedCrit = request.create(BasicCriteriaProxy.class);
        isDeletedCrit.setField("deleted");
        isDeletedCrit.setOperation(CriteriaConstants.OPERATOR_ISNULL);
        isDeletedCrit.setValue(text);
        criterias.add(isDeletedCrit);
      }
      junction.setCriterions(criterias);

      // add FilterCriteria if exists
      if (isFiltered && filterCriteria != null)
        setSearchCriterions(mergeFilterCriteriaAndFullTextSearchCriterion(request, junction));
      else setSearchCriterions(junction);
    }
    if (fullTextSearch) {
      String message = buffer.toString();
      int lastSymbolIndex = message.lastIndexOf(SYMBOL_OR);
      return message.substring(0, lastSymbolIndex);
    } else return null;
  }
  /**
   * Adds a Filter button that enables to filter the table entries to the wrapper panel
   *
   * @param eventBus
   */
  private void setFilterButton(ImogFilterPanel filterPanel) {

    if (filterPanel != null) {
      filterButton = new PopupButton(BaseNLS.constants().button_filter());
      filterButton.addPopupPanelContent(filterPanel);
      wrapperPanel.addHeaderWidget(filterButton);
    }
  }
  /**
   * Adds a button that enables to go the the Home panel
   *
   * @param eventBus
   * @return
   */
  private PushButton goHomeButton() {

    goHomeButton = new PushButton(BaseNLS.constants().button_home());
    goHomeButton.setStyleName(imogResources.imogStyle().imogButton());
    goHomeButton.addStyleName(imogResources.imogStyle().imogButton2());
    goHomeButton.addStyleName("Dynatable-Button");
    return goHomeButton;
  }
  /** Validate fields values */
  public void validateFields() {

    // cDT is a required field
    if (CDT.getValue() == null)
      delegate.recordError(BaseNLS.messages().error_required(), null, "cDT");
    // lot is a required field
    if (lot.getValue() == null)
      delegate.recordError(BaseNLS.messages().error_required(), null, "lot");
    // quantite is a required field
    if (quantite.getValueWithoutParseException() == null && quantite.isValid())
      delegate.recordError(BaseNLS.messages().error_required(), null, "quantite");
    // quantite shall be superior or equal to '0'
    if (quantite.getValueWithoutParseException() != null
        && !(quantite.getValueWithoutParseException() >= 0))
      delegate.recordError(
          BaseNLS.messages().error_min_num(NLS.constants().sortieLot_field_quantite_min()),
          null,
          "quantite");
  }
  /**
   * Adds create and export buttons to the wrapper panel
   *
   * @param createCommand
   * @param exportButton
   */
  private void setOtherActions(Command createCommand, Command exportCommand) {

    if (createCommand != null || exportCommand != null) {

      plusButton = new PopupButton(BaseNLS.constants().button_plus());

      if (createCommand != null) {
        SimpleMenuItem item =
            new SimpleMenuItem(
                requestFactory.getEventBus(), BaseNLS.constants().button_create(), createCommand);
        plusButton.addPopupPanelContent(item);
      }

      if (exportCommand != null) {
        SimpleMenuItem item =
            new SimpleMenuItem(
                requestFactory.getEventBus(), BaseNLS.constants().button_export(), exportCommand);
        plusButton.addPopupPanelContent(item);
      }

      wrapperPanel.addHeaderWidget(plusButton);
    }
  }
Exemple #11
0
public class DateUtil {

  private static DateTimeFormat dateFormater =
      DateTimeFormat.getFormat(BaseNLS.constants().format_date());
  private static DateTimeFormat dateTimeFormater =
      DateTimeFormat.getFormat(
          BaseNLS.constants().format_date() + " " + BaseNLS.constants().format_time() + " (v)");
  private static DateTimeFormat timeFormater =
      DateTimeFormat.getFormat(BaseNLS.constants().format_time() + " v");

  /** Get Localized date */
  public static String getFormatedDate(Date date) {
    return dateFormater.format(date);
  }

  /** Get Localized datetime */
  public static String getFormatedDateTime(Date datetime) {
    return dateTimeFormater.format(datetime);
  }

  /** Get Localized time */
  public static String getFormatedTime(Date time) {
    return timeFormater.format(time);
  }

  public static String getDate(Date date) {
    return DateTimeFormat.getFormat(BaseNLS.constants().format_date()).format(date);
  }

  public static String getDateTime(Date datetime) {
    return DateTimeFormat.getFormat(
            BaseNLS.constants().format_date() + " " + BaseNLS.constants().format_time())
        .format(datetime);
  }

  public static String getTime(Date time) {
    return DateTimeFormat.getFormat(BaseNLS.constants().format_time()).format(time);
  }

  /** Parse Localized datetime */
  public static Date parseFormatedDateTime(String datetime) {
    return dateTimeFormater.parse(datetime);
  }

  /** Parse validation date */
  public static Date parseValidationDate(String date) {
    return DateTimeFormat.getFormat(BaseNLS.constants().format_validation_date()).parse(date);
  }

  /** Parse User validation datetime */
  public static Date parseValidationDateTime(String datetime) {
    return DateTimeFormat.getFormat(
            BaseNLS.constants().format_validation_date()
                + " "
                + BaseNLS.constants().format_validation_time())
        .parse(datetime);
  }

  /** Parse User validation time */
  public static Date parseValidationTime(String time) {
    return DateTimeFormat.getFormat(BaseNLS.constants().format_validation_time()).parse(time);
  }

  /** Parse User entered date */
  public static Date parseDate(String date) {
    return DateTimeFormat.getFormat(BaseNLS.constants().format_date()).parse(date);
  }

  /** Parse User entered datetime */
  public static Date parseDateTime(String datetime) {
    return DateTimeFormat.getFormat(
            BaseNLS.constants().format_date() + " " + BaseNLS.constants().format_time())
        .parse(datetime);
  }

  /** Parse User entered time */
  public static Date parseTime(String time) {
    return DateTimeFormat.getFormat(BaseNLS.constants().format_time()).parse(time);
  }

  /**
   * Validation test for date
   *
   * @param pattern the validation pattern
   * @param value the value to test
   * @return true if the test matches
   */
  public static boolean matchesDate(String pattern, Date value) {
    try {
      if (pattern.startsWith("<=")) {
        Date limit = parseValidationDate(pattern.substring(2));
        return value.before(limit) || value.compareTo(limit) == 0;
      }

      if (pattern.startsWith("<")) {
        Date limit = parseValidationDate(pattern.substring(1));
        return value.before(limit) && value.compareTo(limit) != 0;
      }

      if (pattern.startsWith(">=")) {
        Date limit = parseValidationDate(pattern.substring(2));
        return value.after(limit) || value.compareTo(limit) == 0;
      }

      if (pattern.startsWith(">")) {
        Date limit = parseValidationDate(pattern.substring(1));
        return value.after(limit) && value.compareTo(limit) != 0;
      }

      if (pattern.startsWith("!=")) {
        Date limit = parseValidationDate(pattern.substring(2));
        return value.compareTo(limit) != 0;
      }

      if (pattern.startsWith("==")) {
        Date limit = parseValidationDate(pattern.substring(2));
        return value.compareTo(limit) == 0;
      }

      if (pattern.contains(";")) {
        String[] integers = pattern.split(";");
        Date limitInf = parseValidationDate(integers[0]);
        Date limitSup = parseValidationDate(integers[1]);
        return value.after(limitInf) && value.before(limitSup);
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }

    return false;
  }

  /**
   * Validation test for date time
   *
   * @param pattern the validation pattern
   * @param value the value to test
   * @return true if the test matches
   */
  public static boolean matchesDateTime(String pattern, Date value) {
    try {
      if (pattern.startsWith("<=")) {
        Date limit = parseValidationDateTime(pattern.substring(2));
        return value.before(limit) || value.compareTo(limit) == 0;
      }

      if (pattern.startsWith("<")) {
        Date limit = parseValidationDateTime(pattern.substring(1));
        return value.before(limit) && value.compareTo(limit) != 0;
      }

      if (pattern.startsWith(">=")) {
        Date limit = parseValidationDateTime(pattern.substring(2));
        return value.after(limit) || value.compareTo(limit) == 0;
      }

      if (pattern.startsWith(">")) {
        Date limit = parseValidationDateTime(pattern.substring(1));
        return value.after(limit) && value.compareTo(limit) != 0;
      }

      if (pattern.startsWith("!=")) {
        Date limit = parseValidationDateTime(pattern.substring(2));
        return value.compareTo(limit) != 0;
      }

      if (pattern.startsWith("==")) {
        Date limit = parseValidationDateTime(pattern.substring(2));
        return value.compareTo(limit) == 0;
      }

      if (pattern.contains(";")) {
        String[] integers = pattern.split(";");
        Date limitInf = parseValidationDateTime(integers[0]);
        Date limitSup = parseValidationDateTime(integers[1]);
        return value.after(limitInf) && value.before(limitSup);
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }

    return false;
  }

  /**
   * Validation test for time
   *
   * @param pattern the validation pattern
   * @param value the value to test
   * @return true if the test matches
   */
  public static boolean matchesTime(String pattern, Date value) {
    try {
      if (pattern.startsWith("<=")) {
        Date limit = parseValidationTime(pattern.substring(2));
        return value.before(limit) || value.compareTo(limit) == 0;
      }

      if (pattern.startsWith("<")) {
        Date limit = parseValidationTime(pattern.substring(1));
        return value.before(limit) && value.compareTo(limit) != 0;
      }

      if (pattern.startsWith(">=")) {
        Date limit = parseValidationTime(pattern.substring(2));
        return value.after(limit) || value.compareTo(limit) == 0;
      }

      if (pattern.startsWith(">")) {
        Date limit = parseValidationTime(pattern.substring(1));
        return value.after(limit) && value.compareTo(limit) != 0;
      }

      if (pattern.startsWith("!=")) {
        Date limit = parseValidationTime(pattern.substring(2));
        return value.compareTo(limit) != 0;
      }

      if (pattern.startsWith("==")) {
        Date limit = parseValidationTime(pattern.substring(2));
        return value.compareTo(limit) == 0;
      }

      if (pattern.contains(";")) {
        String[] integers = pattern.split(";");
        Date limitInf = parseValidationTime(integers[0]);
        Date limitSup = parseValidationTime(integers[1]);
        return value.after(limitInf) && value.before(limitSup);
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }

    return false;
  }

  /** @return */
  public static DateTimeFormat getDateFormater() {
    return dateFormater;
  }

  public static DateTimeFormat getDateTimeFormater() {
    return dateTimeFormater;
  }
}
Exemple #12
0
 public ImogFilterPanel() {
   initWidget(uiBinder.createAndBindUi(this));
   filterButton.setText(BaseNLS.constants().button_search());
   cancelFilterButton.setText(BaseNLS.constants().button_cancel());
   createFilterWidgets();
 }
  @Override
  public String fullTextSearch(String text) {

    boolean fullTextSearch = false;
    StringBuffer buffer = new StringBuffer(BaseNLS.constants().label_filtered() + " ");

    if (text == null || (text != null && text.equals(""))) {
      setSearchCriterions(null);
    } else {

      String locale = NLS.constants().locale();

      SortieLotRequest request = (SortieLotRequest) getContext();
      newRequest = false;

      ImogJunctionProxy junction = request.create(ImogConjunctionProxy.class);
      List<ImogCriterionProxy> criterias = new ArrayList<ImogCriterionProxy>();

      ImogJunctionProxy disJunction = request.create(ImogDisjunctionProxy.class);
      List<ImogCriterionProxy> criterionList = new ArrayList<ImogCriterionProxy>();

      // Search field Numero
      BasicCriteriaProxy lot_numeroCrit = request.create(BasicCriteriaProxy.class);
      lot_numeroCrit.setField("lot.numero");
      lot_numeroCrit.setOperation(CriteriaConstants.STRING_OPERATOR_CONTAINS);
      lot_numeroCrit.setValue(text);
      buffer.append(
          "(" + NLS.constants().lot_field_numero() + ": " + text + ") " + SYMBOL_OR + " ");
      criterionList.add(lot_numeroCrit);
      // Search field Identifiant
      BasicCriteriaProxy lot_intrant_identifiantCrit = request.create(BasicCriteriaProxy.class);
      lot_intrant_identifiantCrit.setField("lot.intrant.identifiant");
      lot_intrant_identifiantCrit.setOperation(CriteriaConstants.STRING_OPERATOR_CONTAINS);
      lot_intrant_identifiantCrit.setValue(text);
      buffer.append(
          "(" + NLS.constants().intrant_field_identifiant() + ": " + text + ") " + SYMBOL_OR + " ");
      criterionList.add(lot_intrant_identifiantCrit);
      // Search field Designation
      BasicCriteriaProxy lot_medicament_designationCrit = request.create(BasicCriteriaProxy.class);
      lot_medicament_designationCrit.setField("lot.medicament.designation");
      lot_medicament_designationCrit.setOperation(CriteriaConstants.STRING_OPERATOR_CONTAINS);
      lot_medicament_designationCrit.setValue(text);
      buffer.append(
          "("
              + NLS.constants().medicament_field_designation()
              + ": "
              + text
              + ") "
              + SYMBOL_OR
              + " ");
      criterionList.add(lot_medicament_designationCrit);
      // Search field Quantite
      try {
        Integer.valueOf(text);
        BasicCriteriaProxy lot_quantiteCrit = request.create(BasicCriteriaProxy.class);
        lot_quantiteCrit.setField("lot.quantite");
        lot_quantiteCrit.setOperation(CriteriaConstants.INT_OPERATOR_EQUAL);
        lot_quantiteCrit.setValue(text);
        buffer.append(
            "(" + NLS.constants().lot_field_quantite() + ": " + text + ") " + SYMBOL_OR + " ");
        criterionList.add(lot_quantiteCrit);
      } catch (Exception ex) {
        /*criteria not added*/
      }

      // Search field Quantite
      try {
        Integer.valueOf(text);
        BasicCriteriaProxy quantiteCrit = request.create(BasicCriteriaProxy.class);
        quantiteCrit.setField("quantite");
        quantiteCrit.setOperation(CriteriaConstants.INT_OPERATOR_EQUAL);
        quantiteCrit.setValue(text);
        buffer.append(
            "("
                + NLS.constants().sortieLot_field_quantite()
                + ": "
                + text
                + ") "
                + SYMBOL_OR
                + " ");
        criterionList.add(quantiteCrit);
      } catch (Exception ex) {
        /*criteria not added*/
      }

      disJunction.setCriterions(criterionList);
      criterias.add(disJunction);
      fullTextSearch = true;

      if (ProfileUtil.isAdmin()) {
        BasicCriteriaProxy isDeletedCrit = request.create(BasicCriteriaProxy.class);
        isDeletedCrit.setField("deleted");
        isDeletedCrit.setOperation(CriteriaConstants.OPERATOR_ISNULL);
        isDeletedCrit.setValue(text);
        criterias.add(isDeletedCrit);
      }
      junction.setCriterions(criterias);

      // add FilterCriteria if exists
      if (isFiltered && filterCriteria != null)
        setSearchCriterions(mergeFilterCriteriaAndFullTextSearchCriterion(request, junction));
      else setSearchCriterions(junction);
    }
    if (fullTextSearch) {
      String message = buffer.toString();
      int lastSymbolIndex = message.lastIndexOf(SYMBOL_OR);
      return message.substring(0, lastSymbolIndex);
    } else return null;
  }
Exemple #14
0
 public static String getDate(Date date) {
   return DateTimeFormat.getFormat(BaseNLS.constants().format_date()).format(date);
 }
Exemple #15
0
 public static String getTime(Date time) {
   return DateTimeFormat.getFormat(BaseNLS.constants().format_time()).format(time);
 }
 public void raiseNotUniqueError(String field) {
   delegate.recordError(BaseNLS.messages().error_not_unique(), null, field);
 }
Exemple #17
0
 /** Parse User entered date */
 public static Date parseDate(String date) {
   return DateTimeFormat.getFormat(BaseNLS.constants().format_date()).parse(date);
 }
  /** @param eventBus */
  private void setListActions() {

    listButton = new PopupButton(BaseNLS.constants().button_list());

    if (AccessManager.canDirectAccessPatient() && AccessManager.canReadPatient()) {

      Command command =
          new Command() {
            public void execute() {
              LocalSession.get().setSearchCriterions(null, null);
              History.newItem(TokenHelper.TK_LIST + "/patient/", true);
            }
          };
      SimpleMenuItem item =
          new SimpleMenuItem(
              requestFactory.getEventBus(), NLS.constants().patient_name_plur(), command);
      listButton.addPopupPanelContent(item);
    }

    if (AccessManager.canDirectAccessCasTuberculose() && AccessManager.canReadCasTuberculose()) {

      Command command =
          new Command() {
            public void execute() {
              LocalSession.get().setSearchCriterions(null, null);
              History.newItem(TokenHelper.TK_LIST + "/castuberculose/", true);
            }
          };
      SimpleMenuItem item =
          new SimpleMenuItem(
              requestFactory.getEventBus(), NLS.constants().casTuberculose_name_plur(), command);
      listButton.addPopupPanelContent(item);
    }

    if (AccessManager.canDirectAccessTransfertReference()
        && AccessManager.canReadTransfertReference()) {

      Command command =
          new Command() {
            public void execute() {
              LocalSession.get().setSearchCriterions(null, null);
              History.newItem(TokenHelper.TK_LIST + "/transfertreference/", true);
            }
          };
      SimpleMenuItem item =
          new SimpleMenuItem(
              requestFactory.getEventBus(),
              NLS.constants().transfertReference_name_plur(),
              command);
      listButton.addPopupPanelContent(item);
    }

    if (AccessManager.canDirectAccessRegime() && AccessManager.canReadRegime()) {

      Command command =
          new Command() {
            public void execute() {
              LocalSession.get().setSearchCriterions(null, null);
              History.newItem(TokenHelper.TK_LIST + "/regime/", true);
            }
          };
      SimpleMenuItem item =
          new SimpleMenuItem(
              requestFactory.getEventBus(), NLS.constants().regime_name_plur(), command);
      listButton.addPopupPanelContent(item);
    }

    if (AccessManager.canDirectAccessExamenATB() && AccessManager.canReadExamenATB()) {

      Command command =
          new Command() {
            public void execute() {
              LocalSession.get().setSearchCriterions(null, null);
              History.newItem(TokenHelper.TK_LIST + "/examenatb/", true);
            }
          };
      SimpleMenuItem item =
          new SimpleMenuItem(
              requestFactory.getEventBus(), NLS.constants().examenATB_name_plur(), command);
      listButton.addPopupPanelContent(item);
    }

    if (AccessManager.canDirectAccessExamenBiologique()
        && AccessManager.canReadExamenBiologique()) {

      Command command =
          new Command() {
            public void execute() {
              LocalSession.get().setSearchCriterions(null, null);
              History.newItem(TokenHelper.TK_LIST + "/examenbiologique/", true);
            }
          };
      SimpleMenuItem item =
          new SimpleMenuItem(
              requestFactory.getEventBus(), NLS.constants().examenBiologique_name_plur(), command);
      listButton.addPopupPanelContent(item);
    }

    if (AccessManager.canDirectAccessExamenMicroscopie()
        && AccessManager.canReadExamenMicroscopie()) {

      Command command =
          new Command() {
            public void execute() {
              LocalSession.get().setSearchCriterions(null, null);
              History.newItem(TokenHelper.TK_LIST + "/examenmicroscopie/", true);
            }
          };
      SimpleMenuItem item =
          new SimpleMenuItem(
              requestFactory.getEventBus(), NLS.constants().examenMicroscopie_name_plur(), command);
      listButton.addPopupPanelContent(item);
    }

    if (AccessManager.canDirectAccessExamenSerologie() && AccessManager.canReadExamenSerologie()) {

      Command command =
          new Command() {
            public void execute() {
              LocalSession.get().setSearchCriterions(null, null);
              History.newItem(TokenHelper.TK_LIST + "/examenserologie/", true);
            }
          };
      SimpleMenuItem item =
          new SimpleMenuItem(
              requestFactory.getEventBus(), NLS.constants().examenSerologie_name_plur(), command);
      listButton.addPopupPanelContent(item);
    }

    if (AccessManager.canDirectAccessLot() && AccessManager.canReadLot()) {

      Command command =
          new Command() {
            public void execute() {
              LocalSession.get().setSearchCriterions(null, null);
              History.newItem(TokenHelper.TK_LIST + "/lot/", true);
            }
          };
      SimpleMenuItem item =
          new SimpleMenuItem(
              requestFactory.getEventBus(), NLS.constants().lot_name_plur(), command);
      listButton.addPopupPanelContent(item);
    }

    if (AccessManager.canDirectAccessCommande() && AccessManager.canReadCommande()) {

      Command command =
          new Command() {
            public void execute() {
              LocalSession.get().setSearchCriterions(null, null);
              History.newItem(TokenHelper.TK_LIST + "/commande/", true);
            }
          };
      SimpleMenuItem item =
          new SimpleMenuItem(
              requestFactory.getEventBus(), NLS.constants().commande_name_plur(), command);
      listButton.addPopupPanelContent(item);
    }

    if (AccessManager.canDirectAccessReception() && AccessManager.canReadReception()) {

      Command command =
          new Command() {
            public void execute() {
              LocalSession.get().setSearchCriterions(null, null);
              History.newItem(TokenHelper.TK_LIST + "/reception/", true);
            }
          };
      SimpleMenuItem item =
          new SimpleMenuItem(
              requestFactory.getEventBus(), NLS.constants().reception_name_plur(), command);
      listButton.addPopupPanelContent(item);
    }

    if (AccessManager.canDirectAccessRavitaillement() && AccessManager.canReadRavitaillement()) {

      Command command =
          new Command() {
            public void execute() {
              LocalSession.get().setSearchCriterions(null, null);
              History.newItem(TokenHelper.TK_LIST + "/ravitaillement/", true);
            }
          };
      SimpleMenuItem item =
          new SimpleMenuItem(
              requestFactory.getEventBus(), NLS.constants().ravitaillement_name_plur(), command);
      listButton.addPopupPanelContent(item);
    }

    if (AccessManager.canDirectAccessInventaire() && AccessManager.canReadInventaire()) {

      Command command =
          new Command() {
            public void execute() {
              LocalSession.get().setSearchCriterions(null, null);
              History.newItem(TokenHelper.TK_LIST + "/inventaire/", true);
            }
          };
      SimpleMenuItem item =
          new SimpleMenuItem(
              requestFactory.getEventBus(), NLS.constants().inventaire_name_plur(), command);
      listButton.addPopupPanelContent(item);
    }

    if (AccessManager.canDirectAccessHorsUsage() && AccessManager.canReadHorsUsage()) {

      Command command =
          new Command() {
            public void execute() {
              LocalSession.get().setSearchCriterions(null, null);
              History.newItem(TokenHelper.TK_LIST + "/horsusage/", true);
            }
          };
      SimpleMenuItem item =
          new SimpleMenuItem(
              requestFactory.getEventBus(), NLS.constants().horsUsage_name_plur(), command);
      listButton.addPopupPanelContent(item);
    }

    if (AccessManager.canDirectAccessEntreeLot() && AccessManager.canReadEntreeLot()) {

      Command command =
          new Command() {
            public void execute() {
              LocalSession.get().setSearchCriterions(null, null);
              History.newItem(TokenHelper.TK_LIST + "/entreelot/", true);
            }
          };
      SimpleMenuItem item =
          new SimpleMenuItem(
              requestFactory.getEventBus(), NLS.constants().entreeLot_name_plur(), command);
      listButton.addPopupPanelContent(item);
    }

    if (AccessManager.canDirectAccessSortieLot() && AccessManager.canReadSortieLot()) {

      Command command =
          new Command() {
            public void execute() {
              LocalSession.get().setSearchCriterions(null, null);
              History.newItem(TokenHelper.TK_LIST + "/sortielot/", true);
            }
          };
      SimpleMenuItem item =
          new SimpleMenuItem(
              requestFactory.getEventBus(), NLS.constants().sortieLot_name_plur(), command);
      listButton.addPopupPanelContent(item);
    }

    if (AccessManager.canDirectAccessSmsPredefini() && AccessManager.canReadSmsPredefini()) {

      Command command =
          new Command() {
            public void execute() {
              LocalSession.get().setSearchCriterions(null, null);
              History.newItem(TokenHelper.TK_LIST + "/smspredefini/", true);
            }
          };
      SimpleMenuItem item =
          new SimpleMenuItem(
              requestFactory.getEventBus(), NLS.constants().smsPredefini_name_plur(), command);
      listButton.addPopupPanelContent(item);
    }

    if (AccessManager.canDirectAccessOutBox() && AccessManager.canReadOutBox()) {

      Command command =
          new Command() {
            public void execute() {
              LocalSession.get().setSearchCriterions(null, null);
              History.newItem(TokenHelper.TK_LIST + "/outbox/", true);
            }
          };
      SimpleMenuItem item =
          new SimpleMenuItem(
              requestFactory.getEventBus(), NLS.constants().outBox_name_plur(), command);
      listButton.addPopupPanelContent(item);
    }

    if (AccessManager.canDirectAccessFormation() && AccessManager.canReadFormation()) {

      Command command =
          new Command() {
            public void execute() {
              LocalSession.get().setSearchCriterions(null, null);
              History.newItem(TokenHelper.TK_LIST + "/formation/", true);
            }
          };
      SimpleMenuItem item =
          new SimpleMenuItem(
              requestFactory.getEventBus(), NLS.constants().formation_name_plur(), command);
      listButton.addPopupPanelContent(item);
    }

    if (AccessManager.canDirectAccessTutoriel() && AccessManager.canReadTutoriel()) {

      Command command =
          new Command() {
            public void execute() {
              LocalSession.get().setSearchCriterions(null, null);
              History.newItem(TokenHelper.TK_LIST + "/tutoriel/", true);
            }
          };
      SimpleMenuItem item =
          new SimpleMenuItem(
              requestFactory.getEventBus(), NLS.constants().tutoriel_name_plur(), command);
      listButton.addPopupPanelContent(item);
    }

    if (AccessManager.canDirectAccessRegion() && AccessManager.canReadRegion()) {

      Command command =
          new Command() {
            public void execute() {
              LocalSession.get().setSearchCriterions(null, null);
              History.newItem(TokenHelper.TK_LIST + "/region/", true);
            }
          };
      SimpleMenuItem item =
          new SimpleMenuItem(
              requestFactory.getEventBus(), NLS.constants().region_name_plur(), command);
      listButton.addPopupPanelContent(item);
    }

    if (AccessManager.canDirectAccessDistrictSante() && AccessManager.canReadDistrictSante()) {

      Command command =
          new Command() {
            public void execute() {
              LocalSession.get().setSearchCriterions(null, null);
              History.newItem(TokenHelper.TK_LIST + "/districtsante/", true);
            }
          };
      SimpleMenuItem item =
          new SimpleMenuItem(
              requestFactory.getEventBus(), NLS.constants().districtSante_name_plur(), command);
      listButton.addPopupPanelContent(item);
    }

    if (AccessManager.canDirectAccessCentreDiagTrait() && AccessManager.canReadCentreDiagTrait()) {

      Command command =
          new Command() {
            public void execute() {
              LocalSession.get().setSearchCriterions(null, null);
              History.newItem(TokenHelper.TK_LIST + "/centrediagtrait/", true);
            }
          };
      SimpleMenuItem item =
          new SimpleMenuItem(
              requestFactory.getEventBus(), NLS.constants().centreDiagTrait_name_plur(), command);
      listButton.addPopupPanelContent(item);
    }

    if (AccessManager.canDirectAccessLaboratoireReference()
        && AccessManager.canReadLaboratoireReference()) {

      Command command =
          new Command() {
            public void execute() {
              LocalSession.get().setSearchCriterions(null, null);
              History.newItem(TokenHelper.TK_LIST + "/laboratoirereference/", true);
            }
          };
      SimpleMenuItem item =
          new SimpleMenuItem(
              requestFactory.getEventBus(),
              NLS.constants().laboratoireReference_name_plur(),
              command);
      listButton.addPopupPanelContent(item);
    }

    if (AccessManager.canDirectAccessLieuDit() && AccessManager.canReadLieuDit()) {

      Command command =
          new Command() {
            public void execute() {
              LocalSession.get().setSearchCriterions(null, null);
              History.newItem(TokenHelper.TK_LIST + "/lieudit/", true);
            }
          };
      SimpleMenuItem item =
          new SimpleMenuItem(
              requestFactory.getEventBus(), NLS.constants().lieuDit_name_plur(), command);
      listButton.addPopupPanelContent(item);
    }

    if (AccessManager.canDirectAccessMedicament() && AccessManager.canReadMedicament()) {

      Command command =
          new Command() {
            public void execute() {
              LocalSession.get().setSearchCriterions(null, null);
              History.newItem(TokenHelper.TK_LIST + "/medicament/", true);
            }
          };
      SimpleMenuItem item =
          new SimpleMenuItem(
              requestFactory.getEventBus(), NLS.constants().medicament_name_plur(), command);
      listButton.addPopupPanelContent(item);
    }

    if (AccessManager.canDirectAccessIntrant() && AccessManager.canReadIntrant()) {

      Command command =
          new Command() {
            public void execute() {
              LocalSession.get().setSearchCriterions(null, null);
              History.newItem(TokenHelper.TK_LIST + "/intrant/", true);
            }
          };
      SimpleMenuItem item =
          new SimpleMenuItem(
              requestFactory.getEventBus(), NLS.constants().intrant_name_plur(), command);
      listButton.addPopupPanelContent(item);
    }

    if (AccessManager.canDirectAccessPersonnel() && AccessManager.canReadPersonnel()) {

      Command command =
          new Command() {
            public void execute() {
              LocalSession.get().setSearchCriterions(null, null);
              History.newItem(TokenHelper.TK_LIST + "/personnel/", true);
            }
          };
      SimpleMenuItem item =
          new SimpleMenuItem(
              requestFactory.getEventBus(), NLS.constants().personnel_name_plur(), command);
      listButton.addPopupPanelContent(item);
    }

    if (AccessManager.canDirectAccessDepartPersonnel() && AccessManager.canReadDepartPersonnel()) {

      Command command =
          new Command() {
            public void execute() {
              LocalSession.get().setSearchCriterions(null, null);
              History.newItem(TokenHelper.TK_LIST + "/departpersonnel/", true);
            }
          };
      SimpleMenuItem item =
          new SimpleMenuItem(
              requestFactory.getEventBus(), NLS.constants().departPersonnel_name_plur(), command);
      listButton.addPopupPanelContent(item);
    }

    if (AccessManager.canDirectAccessArriveePersonnel()
        && AccessManager.canReadArriveePersonnel()) {

      Command command =
          new Command() {
            public void execute() {
              LocalSession.get().setSearchCriterions(null, null);
              History.newItem(TokenHelper.TK_LIST + "/arriveepersonnel/", true);
            }
          };
      SimpleMenuItem item =
          new SimpleMenuItem(
              requestFactory.getEventBus(), NLS.constants().arriveePersonnel_name_plur(), command);
      listButton.addPopupPanelContent(item);
    }

    if (AccessManager.canDirectAccessUtilisateur() && AccessManager.canReadUtilisateur()) {

      Command command =
          new Command() {
            public void execute() {
              LocalSession.get().setSearchCriterions(null, null);
              History.newItem(TokenHelper.TK_LIST + "/utilisateur/", true);
            }
          };
      SimpleMenuItem item =
          new SimpleMenuItem(
              requestFactory.getEventBus(), NLS.constants().utilisateur_name_plur(), command);
      listButton.addPopupPanelContent(item);
    }

    if (AccessManager.canDirectAccessQualification() && AccessManager.canReadQualification()) {

      Command command =
          new Command() {
            public void execute() {
              LocalSession.get().setSearchCriterions(null, null);
              History.newItem(TokenHelper.TK_LIST + "/qualification/", true);
            }
          };
      SimpleMenuItem item =
          new SimpleMenuItem(
              requestFactory.getEventBus(), NLS.constants().qualification_name_plur(), command);
      listButton.addPopupPanelContent(item);
    }

    wrapperPanel.addHeaderWidget(listButton);
  }
Exemple #19
0
 /** Parse User entered time */
 public static Date parseTime(String time) {
   return DateTimeFormat.getFormat(BaseNLS.constants().format_time()).parse(time);
 }
  @Override
  public List<FilterCriteria> getFilterCriteria() {

    String locale = NLS.constants().locale();

    List<FilterCriteria> criteria = new ArrayList<FilterCriteria>();

    FilterCriteria castb_patient_identifiantCrit = new FilterCriteria();
    castb_patient_identifiantCrit.setField("casTb.patient.identifiant");
    castb_patient_identifiantCrit.setFieldDisplayName(NLS.constants().patient_field_identifiant());
    castb_patient_identifiantCrit.setOperation(CriteriaConstants.STRING_OPERATOR_CONTAINS);
    castb_patient_identifiantCrit.setValue(castb_patient_identifiantBox.getValue());
    castb_patient_identifiantCrit.setValueDisplayName(castb_patient_identifiantBox.getValue());
    criteria.add(castb_patient_identifiantCrit);
    FilterCriteria castb_patient_nomCrit = new FilterCriteria();
    castb_patient_nomCrit.setField("casTb.patient.nom");
    castb_patient_nomCrit.setFieldDisplayName(NLS.constants().patient_field_nom());
    castb_patient_nomCrit.setOperation(CriteriaConstants.STRING_OPERATOR_CONTAINS);
    castb_patient_nomCrit.setValue(castb_patient_nomBox.getValue());
    castb_patient_nomCrit.setValueDisplayName(castb_patient_nomBox.getValue());
    criteria.add(castb_patient_nomCrit);

    if (dateExamenBeforeBox.getValue() != null) {
      FilterCriteria dateExamenBeforeCrit = new FilterCriteria();
      dateExamenBeforeCrit.setField("dateExamen");
      dateExamenBeforeCrit.setFieldDisplayName(
          NLS.constants().examenATB_field_dateExamen()
              + BaseNLS.constants().search_operator_inferior());
      dateExamenBeforeCrit.setOperation(CriteriaConstants.DATE_OPERATOR_BEFORE);
      dateExamenBeforeCrit.setValue(DateUtil.getDate(dateExamenBeforeBox.getValue()));
      dateExamenBeforeCrit.setValueDisplayName(DateUtil.getDate(dateExamenBeforeBox.getValue()));
      criteria.add(dateExamenBeforeCrit);
    }

    if (dateExamenAfterBox.getValue() != null) {
      FilterCriteria dateExamenAfterCrit = new FilterCriteria();
      dateExamenAfterCrit.setField("dateExamen");
      dateExamenAfterCrit.setFieldDisplayName(
          NLS.constants().examenATB_field_dateExamen()
              + BaseNLS.constants().search_operator_superior());
      dateExamenAfterCrit.setOperation(CriteriaConstants.DATE_OPERATOR_AFTER);
      dateExamenAfterCrit.setValue(DateUtil.getDate(dateExamenAfterBox.getValue()));
      dateExamenAfterCrit.setValueDisplayName(DateUtil.getDate(dateExamenAfterBox.getValue()));
      criteria.add(dateExamenAfterCrit);
    }

    FilterCriteria raisonDepistageCrit = new FilterCriteria();
    raisonDepistageCrit.setField("raisonDepistage");
    raisonDepistageCrit.setFieldDisplayName(NLS.constants().examenATB_field_raisonDepistage());
    raisonDepistageCrit.setOperation(CriteriaConstants.STRING_OPERATOR_EQUAL);
    raisonDepistageCrit.setValue(
        raisonDepistageBox.getValue(raisonDepistageBox.getSelectedIndex()));
    raisonDepistageCrit.setValueDisplayName(
        EpicamRenderer.get()
            .getEnumDisplayValue(
                ExamenATBProxy.class,
                "raisonDepistage",
                raisonDepistageBox.getValue(raisonDepistageBox.getSelectedIndex())));
    criteria.add(raisonDepistageCrit);

    FilterCriteria resultatCrit = new FilterCriteria();
    resultatCrit.setField("resultat");
    resultatCrit.setFieldDisplayName(NLS.constants().examenATB_field_resultat());
    resultatCrit.setOperation(CriteriaConstants.STRING_OPERATOR_CONTAINS);
    resultatCrit.setValue(resultatBox.getValue());
    resultatCrit.setValueDisplayName(resultatBox.getValue());
    criteria.add(resultatCrit);

    FilterCriteria deletedEntityCrit = new FilterCriteria();
    deletedEntityCrit.setField("deleted");
    deletedEntityCrit.setFieldDisplayName(BaseNLS.constants().entity_field_deleted());
    if (deletedEntityBox.getValue()) {
      deletedEntityCrit.setOperation(CriteriaConstants.OPERATOR_ISNOTNULL);
      deletedEntityCrit.setValue("true");
      deletedEntityCrit.setValueDisplayName(BaseNLS.constants().boolean_true());
    } else {
      deletedEntityCrit.setOperation(CriteriaConstants.OPERATOR_ISNULL);
      deletedEntityCrit.setValue("false");
      deletedEntityCrit.setValueDisplayName(BaseNLS.constants().boolean_false());
    }
    criteria.add(deletedEntityCrit);

    return criteria;
  }