コード例 #1
0
  /** like "database..table". */
  protected String getTableNameWithDBAndSchema(
      final String dbName, final String schema, String tableName) {
    if (tableName == null || EMPTY.equals(tableName.trim())) {
      tableName = QueryUtil.DEFAULT_TABLE_NAME;
    }

    final StringBuffer tableNameWithDBAndSchema = new StringBuffer();

    //
    if (dbName != null && !EMPTY.equals(dbName)) {
      /*
       * should not add quote always.
       */
      setForceAddQuote(false);
      tableNameWithDBAndSchema.append(checkContextAndAddQuote(dbName));
      revertAddQuoteSetting();
      tableNameWithDBAndSchema.append(getSQLFieldConnector());

      // schema is special empty "."
      tableNameWithDBAndSchema.append(getSQLFieldConnector());
    }
    //
    // setForceAddQuote(true); //FIXME, if add quote always, should be opened
    tableNameWithDBAndSchema.append(checkContextAndAddQuote(tableName));
    // revertAddQuoteSetting();

    return tableNameWithDBAndSchema.toString();
  }
コード例 #2
0
  @Override
  public void validate() {

    if (stillBirthRegistration.getDateOfEvent() != null
        && stillBirthRegistration.getDateOfEvent().after(DateUtils.today()))
      addActionError(getMessage("dateOfEvent.today.validate"));

    if (stillBirthRegistration.getRegistrationDate() != null
        && stillBirthRegistration.getDateOfEvent() != null
        && stillBirthRegistration
            .getDateOfEvent()
            .after(stillBirthRegistration.getRegistrationDate()))
      addActionError(getMessage("dateOfEvent.registration.validate"));

    if (placeTypeTemp != null
        && !EMPTY.equals(placeTypeTemp)
        && BndConstants.HOSPTIAL.equalsIgnoreCase(placeTypeTemp)
        && stillBirthRegistration.getEstablishment() == null)
      addActionError(getMessage("hospitalname.required"));
    // For Offline mode validating registration number....
    if (OFFLINE.equals(mode)
        && stillBirthRegistration.getRegistrationNo() != null
        && !EMPTY.equals(stillBirthRegistration.getRegistrationNo().trim()))
      if (stillBirthRegistration.getRegistrationUnit() != null
          && birthRegistrationService.checkUniqueRegistrationNumber(
              stillBirthRegistration.getRegistrationUnit().getId(),
              stillBirthRegistration.getId(),
              stillBirthRegistration.getRegistrationNo(),
              BndConstants.REGISTRATIONDATE.equalsIgnoreCase(numberGenKey)
                  ? stillBirthRegistration.getRegistrationDate()
                  : stillBirthRegistration.getDateOfEvent(),
              BndConstants.STILLBIRTHNUM)) addActionError(getMessage("registration.number.exists"));
      else if (BndUtils.isNum(stillBirthRegistration.getRegistrationNo().trim())) {
        final int eventYear =
            BndConstants.REGISTRATIONDATE.equalsIgnoreCase(numberGenKey)
                ? BndDateUtils.getCurrentYear(stillBirthRegistration.getRegistrationDate())
                : BndDateUtils.getCurrentYear(stillBirthRegistration.getDateOfEvent());
        final RegKeys regNumRange =
            regKeyService.getRegKeyByRegUnitAndDate(
                stillBirthRegistration.getRegistrationUnit(),
                eventYear,
                numberGenerationService.buildObjectType(
                    stillBirthRegistration, eventYear, BndConstants.STILLBIRTHNUM));
        if (regNumRange != null) {
          final Integer regNumber = Integer.valueOf(stillBirthRegistration.getRegistrationNo());
          if (regNumber >= regNumRange.getMinValue())
            addActionError(
                getMessage("regNumber.minvalue.validate")
                    .concat(" ")
                    .concat(regNumRange.getMinValue().toString()));
        }
      }
  }
コード例 #3
0
ファイル: Area.java プロジェクト: route-a-lot/route-a-lot
 @Override
 protected void load(MappedByteBuffer mmap) throws IOException {
   String name = Util.readUTFString(mmap);
   this.name = EMPTY.equals(name) ? null : name;
   int len = mmap.getInt();
   this.nodes = new Node[len];
   MapInfo mapInfo = State.getInstance().getMapInfo();
   for (int i = 0; i < len; i++) {
     this.nodes[i] = mapInfo.getNode(mmap.getInt());
   }
   this.wayInfo = WayInfo.loadFromInput(mmap);
 }
コード例 #4
0
ファイル: Area.java プロジェクト: route-a-lot/route-a-lot
 @Override
 protected void load(DataInput input) throws IOException {
   String name = input.readUTF();
   this.name = EMPTY.equals(name) ? null : name;
   int len = input.readInt();
   this.nodes = new Node[len];
   MapInfo mapInfo = State.getInstance().getMapInfo();
   for (int i = 0; i < len; i++) {
     this.nodes[i] = mapInfo.getNode(input.readInt());
   }
   this.wayInfo = WayInfo.loadFromInput(input);
 }