Ejemplo n.º 1
0
  public void handleRow(Object object) {
    OrganisationUnit unit = (OrganisationUnit) object;

    NameMappingUtil.addOrganisationUnitMapping(unit.getId(), unit.getName());

    unit.setUuid(UUIdUtils.getUUId());

    if (unit.getOrganisationUnitCode() != null
        && unit.getOrganisationUnitCode().trim().length() == 0) {
      unit.setOrganisationUnitCode(null);
    }

    read(unit, OrganisationUnit.class, GroupMemberType.NONE, params);
  }
  protected String getUniquenessStatement(Object object) {
    OrganisationUnit unit = (OrganisationUnit) object;

    Map<String, String> fieldMap = new HashMap<String, String>();

    fieldMap.put("name", unit.getName());
    fieldMap.put("shortname", unit.getShortName());
    fieldMap.put("code", unit.getOrganisationUnitCode());

    return statementBuilder.getValueStatement(tableName, "organisationunitid", fieldMap, false);
  }
  protected void addValues(Object object) {
    OrganisationUnit unit = (OrganisationUnit) object;

    statementBuilder.setInt(unit.getId());
    statementBuilder.setString(unit.getUuid());
    statementBuilder.setString(unit.getName());
    statementBuilder.setString(
        unit.getParent() != null ? String.valueOf(unit.getParent().getId()) : null);
    statementBuilder.setString(unit.getShortName());
    statementBuilder.setString(unit.getOrganisationUnitCode());
    statementBuilder.setDate(unit.getOpeningDate());
    statementBuilder.setDate(unit.getClosedDate());
    statementBuilder.setBoolean(unit.isActive());
    statementBuilder.setString(unit.getComment());
    statementBuilder.setString(unit.getGeoCode());
    statementBuilder.setString(unit.getLatitude());
    statementBuilder.setString(unit.getLongitude());
  }