Ejemplo n.º 1
0
  private void customizeForm(RrrBean.RRR_ACTION rrrAction) {
    if (rrrAction == RrrBean.RRR_ACTION.NEW) {
      btnSave.setText(
          MessageUtility.getLocalizedMessage(ClientMessage.GENERAL_LABELS_CREATE_AND_CLOSE)
              .getMessage());
      txtNominator.setEditable(true);
      txtDenominator.setEditable(true);
      btnClose.setEnabled(false);
      btnClose.setVisible(false);

    } else if (rrrAction == RrrBean.RRR_ACTION.VIEW) {
      btnSave.setEnabled(false);
      btnSave.setVisible(false);
      btnClose.setEnabled(true);
      btnClose.setVisible(true);
      txtNominator.setEditable(false);
      txtDenominator.setEditable(false);
      btnAddOwner.setEnabled(false);
      btnRemoveOwner.setEnabled(false);
    }
    rrrShareBean.addPropertyChangeListener(
        new PropertyChangeListener() {

          @Override
          public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getPropertyName().equals(RrrShareBean.SELECTED_RIGHTHOLDER_PROPERTY)) {
              customizeOwnersButtons((PartySummaryBean) evt.getNewValue());
            }
          }
        });
  }
Ejemplo n.º 2
0
 public void removeUser() {
   if (userSearchResultList.getSelectedUser() != null) {
     if (userSearchResultList
         .getSelectedUser()
         .getUserName()
         .equals(SecurityBean.getCurrentUser().getUserName())) {
       MessageUtility.displayMessage(ClientMessage.ADMIN_CURRENT_USER_DELETE_ERROR);
       return;
     }
     if (MessageUtility.displayMessage(ClientMessage.ADMIN_CONFIRM_DELETE_USER)
         == MessageUtility.BUTTON_ONE) {
       UserBean.removeUser(userSearchResultList.getSelectedUser().getUserName());
       userSearchResultList.getUsersList().remove(userSearchResultList.getSelectedUser());
     }
   }
 }
Ejemplo n.º 3
0
 private void removeOwner() {
   if (rrrShareBean.getSelectedRightHolder() != null
       && MessageUtility.displayMessage(ClientMessage.CONFIRM_DELETE_RECORD)
           == MessageUtility.BUTTON_ONE) {
     rrrShareBean.removeSelectedRightHolder();
   }
 }
Ejemplo n.º 4
0
 /** Generates and displays <b>BR VAlidaction Report</b>. */
 public static JasperPrint getBrValidaction() {
   HashMap inputParameters = new HashMap();
   inputParameters.put("REPORT_LOCALE", Locale.getDefault());
   inputParameters.put("today", new Date());
   inputParameters.put("USER_NAME", SecurityBean.getCurrentUser().getUserName());
   BrListBean brList = new BrListBean();
   brList.FillBrs();
   int sizeBrList = brList.getBrBeanList().size();
   BrReportBean[] beans = new BrReportBean[sizeBrList];
   for (int i = 0; i < sizeBrList; i++) {
     beans[i] = brList.getBrBeanList().get(i);
   }
   JRDataSource jds = new JRBeanArrayDataSource(beans);
   try {
     return JasperFillManager.fillReport(
         ReportManager.class.getResourceAsStream("/reports/BrValidaction.jasper"),
         inputParameters,
         jds);
   } catch (JRException ex) {
     LogUtility.log(LogUtility.getStackTraceAsString(ex), Level.SEVERE);
     MessageUtility.displayMessage(
         ClientMessage.REPORT_GENERATION_FAILED, new Object[] {ex.getLocalizedMessage()});
     return null;
   }
 }
Ejemplo n.º 5
0
  /**
   * Generates and displays <b>Lodgement notice</b> report for the new application.
   *
   * @param appBean Application bean containing data for the report.
   */
  public static JasperPrint getLodgementNoticeReport(
      ApplicationBean appBean, boolean isProduction) {
    HashMap inputParameters = new HashMap();
    inputParameters.put("REPORT_LOCALE", Locale.getDefault());
    inputParameters.put("today", new Date());
    inputParameters.put("USER_NAME", SecurityBean.getCurrentUser().getFullUserName());
    inputParameters.put("IS_PRODUCTION", isProduction);
    ApplicationBean[] beans = new ApplicationBean[1];
    beans[0] = appBean;
    JRDataSource jds = new JRBeanArrayDataSource(beans);
    inputParameters.put(
        "IMAGE_SCRITTA_GREEN",
        ReportManager.class.getResourceAsStream("/images/sola/govSamoa.gif"));
    inputParameters.put("WHICH_CALLER", "N");

    try {
      return JasperFillManager.fillReport(
          ReportManager.class.getResourceAsStream("/reports/ApplicationPrintingForm.jasper"),
          inputParameters,
          jds);
    } catch (JRException ex) {
      LogUtility.log(LogUtility.getStackTraceAsString(ex), Level.SEVERE);
      MessageUtility.displayMessage(
          ClientMessage.REPORT_GENERATION_FAILED, new Object[] {ex.getLocalizedMessage()});
      return null;
    }
  }
Ejemplo n.º 6
0
  /**
   * Generates and displays <b>BA Unit</b> report.
   *
   * @param appBean Application bean containing data for the report.
   */
  public static JasperPrint getLodgementReport(
      LodgementBean lodgementBean, Date dateFrom, Date dateTo) {
    HashMap inputParameters = new HashMap();
    Date currentdate = new Date(System.currentTimeMillis());
    inputParameters.put("REPORT_LOCALE", Locale.getDefault());

    inputParameters.put("CURRENT_DATE", currentdate);

    inputParameters.put("USER", SecurityBean.getCurrentUser().getFullUserName());
    inputParameters.put("FROMDATE", dateFrom);
    inputParameters.put("TODATE", dateTo);
    LodgementBean[] beans = new LodgementBean[1];
    beans[0] = lodgementBean;
    JRDataSource jds = new JRBeanArrayDataSource(beans);
    try {
      return JasperFillManager.fillReport(
          ReportManager.class.getResourceAsStream("/reports/LodgementReportSamoa.jasper"),
          inputParameters,
          jds);
    } catch (JRException ex) {
      LogUtility.log(LogUtility.getStackTraceAsString(ex), Level.SEVERE);
      MessageUtility.displayMessage(
          ClientMessage.REPORT_GENERATION_FAILED, new Object[] {ex.getLocalizedMessage()});
      return null;
    }
  }
Ejemplo n.º 7
0
  private void btnSaveActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnSaveActionPerformed
    boolean isSaved = false;

    if (saveOnAction) {
      if (referenceDataPanel.save(true)) {
        MessageUtility.displayMessage(
            ClientMessage.ADMIN_REFDATA_SAVED,
            new String[] {referenceDataPanel.getReferenceDataBean().getTranslatedDisplayValue()});
        isSaved = true;
      }
    } else {
      if (referenceDataPanel.validateRefData(true)) {
        isSaved = true;
      }
    }

    if (isSaved) {
      firePropertyChange(REFDATA_SAVED_PROPERTY, false, true);
      if (closeOnSave) {
        close();
      } else {
        customizePanel();
      }
    }
  } // GEN-LAST:event_btnSaveActionPerformed
 /**
  * Constructor of the map action that is used to show the component where the new survey points
  * are shown.
  *
  * @param mapObj The map control that will be interacting with the map action
  * @param pointSurveyListForm The component to show
  */
 public CadastreChangePointSurveyListFormShow(Map mapObj, Component pointSurveyListForm) {
   super(
       mapObj,
       pointSurveyListForm,
       MAPACTION_NAME,
       MessageUtility.getLocalizedMessage(GisMessage.CADASTRE_CHANGE_POINTS_SHOW).getMessage(),
       "resources/point-show.png");
 }
Ejemplo n.º 9
0
  private void customizePanel() {
    if (refDataBean != null) {
      headerPanel.setTitleText(
          MessageFormat.format("{0} - {1}", headerTitle, refDataBean.getTranslatedDisplayValue()));
    } else {
      headerPanel.setTitleText(
          MessageFormat.format(
              "{0} - {1}",
              headerTitle, resourceBundle.getString("ReferenceDataManagementPanel.NewItem.text")));
    }

    if (closeOnSave) {
      btnSave.setText(
          MessageUtility.getLocalizedMessage(ClientMessage.GENERAL_LABELS_SAVE_AND_CLOSE)
              .getMessage());
    } else {
      btnSave.setText(
          MessageUtility.getLocalizedMessage(ClientMessage.GENERAL_LABELS_SAVE).getMessage());
    }
  }
Ejemplo n.º 10
0
  /** Generates and displays <b>BR Report</b>. */
  public static JasperPrint getBrReport() {
    HashMap inputParameters = new HashMap();
    inputParameters.put("REPORT_LOCALE", Locale.getDefault());
    inputParameters.put("today", new Date());
    inputParameters.put("USER_NAME", SecurityBean.getCurrentUser().getFullUserName());
    BrListBean brList = new BrListBean();
    brList.FillBrs();
    int sizeBrList = brList.getBrBeanList().size();

    BrReportBean[] beans = new BrReportBean[sizeBrList];
    for (int i = 0; i < sizeBrList; i++) {
      beans[i] = brList.getBrBeanList().get(i);
      if (beans[i].getFeedback() != null) {
        String feedback = beans[i].getFeedback();
        feedback = feedback.substring(0, feedback.indexOf("::::"));
        beans[i].setFeedback(feedback);
      }

      if (i > 0) {
        String idPrev = beans[i - 1].getId();
        String technicalTypeCodePrev = beans[i - 1].getTechnicalTypeCode();
        String id = beans[i].getId();
        String technicalTypeCode = beans[i].getTechnicalTypeCode();

        if (id.equals(idPrev) && technicalTypeCode.equals(technicalTypeCodePrev)) {

          beans[i].setId("");
          beans[i].setBody("");
          beans[i].setDescription("");
          beans[i].setFeedback("");
          beans[i].setTechnicalTypeCode("");
        }
      }
    }

    JRDataSource jds = new JRBeanArrayDataSource(beans);
    try {
      return JasperFillManager.fillReport(
          ReportManager.class.getResourceAsStream("/reports/BrReport.jasper"),
          inputParameters,
          jds);
    } catch (JRException ex) {
      LogUtility.log(LogUtility.getStackTraceAsString(ex), Level.SEVERE);
      MessageUtility.displayMessage(
          ClientMessage.REPORT_GENERATION_FAILED, new Object[] {ex.getLocalizedMessage()});
      return null;
    }
  }
Ejemplo n.º 11
0
  /**
   * Generates and displays <b>Application status report</b>.
   *
   * @param appBean Application bean containing data for the report.
   */
  public static JasperPrint getApplicationStatusReport(ApplicationBean appBean) {
    HashMap inputParameters = new HashMap();
    inputParameters.put("REPORT_LOCALE", Locale.getDefault());
    inputParameters.put("today", new Date());
    inputParameters.put("USER_NAME", SecurityBean.getCurrentUser().getFullUserName());
    ApplicationBean[] beans = new ApplicationBean[1];
    beans[0] = appBean;
    JRDataSource jds = new JRBeanArrayDataSource(beans);

    try {
      return JasperFillManager.fillReport(
          ReportManager.class.getResourceAsStream("/reports/ApplicationStatusReport.jasper"),
          inputParameters,
          jds);
    } catch (JRException ex) {
      LogUtility.log(LogUtility.getStackTraceAsString(ex), Level.SEVERE);
      MessageUtility.displayMessage(
          ClientMessage.REPORT_GENERATION_FAILED, new Object[] {ex.getLocalizedMessage()});
      return null;
    }
  }
Ejemplo n.º 12
0
  /**
   * Generates and displays <b>SolaPrintReport</b> for the map.
   *
   * @param layoutId String This is the id of the report. It is used to identify the report file.
   * @param dataBean Object containing data for the report. it can be replaced with appropriate bean
   *     if needed
   * @param mapImageLocation String this is the location of the map to be passed as MAP_IMAGE
   *     PARAMETER to the report. It is necessary for visualizing the map
   * @param scalebarImageLocation String this is the location of the scalebar to be passed as
   *     SCALE_IMAGE PARAMETER to the report. It is necessary for visualizing the scalebar
   */
  public static JasperPrint getSolaPrintReport(
      String layoutId, Object dataBean, String mapImageLocation, String scalebarImageLocation)
      throws IOException {

    // Image Location of the north-arrow image
    String navigatorImage = "/images/sola/north-arrow.png";
    HashMap inputParameters = new HashMap();
    inputParameters.put("REPORT_LOCALE", Locale.getDefault());
    inputParameters.put("USER_NAME", SecurityBean.getCurrentUser().getFullUserName());
    inputParameters.put("MAP_IMAGE", mapImageLocation);
    inputParameters.put("SCALE_IMAGE", scalebarImageLocation);
    inputParameters.put("NAVIGATOR_IMAGE", ReportManager.class.getResourceAsStream(navigatorImage));
    inputParameters.put("LAYOUT", layoutId);
    inputParameters.put(
        "INPUT_DATE", DateFormat.getInstance().format(Calendar.getInstance().getTime()));

    // This will be the bean containing data for the report.
    // it is the data source for the report
    // it must be replaced with appropriate bean if needed
    Object[] beans = new Object[1];
    beans[0] = dataBean;
    JRDataSource jds = new JRBeanArrayDataSource(beans);

    // this generates the report.
    // NOTICE THAT THE NAMING CONVENTION IS TO PRECEED "SolaPrintReport.jasper"
    // WITH THE LAYOUT NAME. SO IT MUST BE PRESENT ONE REPORT FOR EACH LAYOUT FORMAT
    try {
      JasperPrint jasperPrint =
          JasperFillManager.fillReport(
              ReportManager.class.getResourceAsStream("/reports/map/" + layoutId + ".jasper"),
              inputParameters,
              jds);
      return jasperPrint;
    } catch (JRException ex) {
      LogUtility.log(LogUtility.getStackTraceAsString(ex), Level.SEVERE);
      MessageUtility.displayMessage(
          ClientMessage.REPORT_GENERATION_FAILED, new Object[] {ex.getLocalizedMessage()});
      return null;
    }
  }
Ejemplo n.º 13
0
 /**
  * Generates and displays <b>Historical Search</b> report.
  *
  * @param appBean Application bean containing data for the report.
  */
 public static JasperPrint getHistoricalSearchReport(BaUnitBean baUnitBean, boolean isProduction) {
   HashMap inputParameters = new HashMap();
   inputParameters.put("REPORT_LOCALE", Locale.getDefault());
   inputParameters.put("USER", SecurityBean.getCurrentUser().getFullUserName());
   inputParameters.put("IS_PRODUCTION", isProduction);
   BaUnitBean[] beans = new BaUnitBean[1];
   beans[0] = baUnitBean;
   JRDataSource jds = new JRBeanArrayDataSource(beans);
   inputParameters.put(
       "SAMOA_EMBLEM", ReportManager.class.getResourceAsStream("/images/sola/samEmblem.png"));
   try {
     return JasperFillManager.fillReport(
         ReportManager.class.getResourceAsStream("/reports/HistoricalSearch.jasper"),
         inputParameters,
         jds);
   } catch (JRException ex) {
     LogUtility.log(LogUtility.getStackTraceAsString(ex), Level.SEVERE);
     MessageUtility.displayMessage(
         ClientMessage.REPORT_GENERATION_FAILED, new Object[] {ex.getLocalizedMessage()});
     return null;
   }
 }
Ejemplo n.º 14
0
  /**
   * Runs new task.
   *
   * @param task Task to run.
   */
  public boolean runTask(SolaTask task) {
    if (task == null || isTaskRunning(task.getId())) {
      return false;
    }

    if (getNumberOfActiveTasks() > 0) {
      MessageUtility.displayMessage(
          ClientMessage.GENERAL_ACTIVE_TASKS_EXIST, new Object[] {getNumberOfActiveTasks()});
      return false;
    }

    task.addPropertyChangeListener(
        new PropertyChangeListener() {

          @Override
          public void propertyChange(PropertyChangeEvent evt) {
            handleTaskEvents(evt);
          }
        });
    tasks.put(task.getId(), task);
    task.execute();
    return true;
  }
Ejemplo n.º 15
0
 /** Searches users with the given criteria. */
 private void searchUsers() {
   userSearchResultList.searchUsers(userSearchParams);
   if (userSearchResultList.getUsersList().size() < 1) {
     MessageUtility.displayMessage(ClientMessage.ADMIN_USERS_NO_FOUND);
   }
 }
/**
 * Tool that is used to draw new cadastre objects during the cadastre change.
 *
 * @author rizzom
 */
public class CadastreChangeNewCadastreObjectTool extends CadastreChangeEditAbstractTool
    implements TargetCadastreObjectTool {

  public static final String NAME = "new-parcel";
  private String toolTip =
      MessageUtility.getLocalizedMessage(GisMessage.CADASTRE_CHANGE_TOOLTIP_NEW_PARCEL)
          .getMessage();
  private String cadastreObjectType;

  /**
   * Constructor
   *
   * @param newCadastreObjectLayer The layer where the new cadastre objects are maintained
   */
  public CadastreChangeNewCadastreObjectTool(
      CadastreChangeNewCadastreObjectLayer newCadastreObjectLayer) {
    this.setToolName(NAME);
    this.setIconImage("resources/new-parcel.png");
    this.setToolTip(toolTip);
    this.setGeometryType(Geometries.POLYGON);
    this.layer = newCadastreObjectLayer;
  }

  @Override
  public void setCadastreObjectType(String cadastreObjectType) {
    this.cadastreObjectType = cadastreObjectType;
  }

  /**
   * If a new click is done while creating a cadastre object, it has to snap to a point. Because the
   * only layer used as snaptarget is the NewSurveyPointLayer the only points are the survey points.
   *
   * @param ev
   */
  @Override
  public void onMouseClicked(MapMouseEvent ev) {
    if (ev.getButton() == java.awt.event.MouseEvent.BUTTON1
        && this.getSnappedTarget() != SNAPPED_TARGET_TYPE.Vertex) {
      Messaging.getInstance().show(GisMessage.CADASTRE_CHANGE_NEW_CO_MUST_SNAP);
      return;
    }
    super.onMouseClicked(ev);
  }

  /**
   * It means a vertex of a cadastre object cannot be changed from this tool. It must be changed by
   * changing the vertices in the NewSurveyPointLayer.
   *
   * @param mousePositionInMap
   * @return
   */
  @Override
  protected SimpleFeature treatChangeVertex(DirectPosition2D mousePositionInMap) {
    return null;
  }

  @Override
  public SimpleFeature addFeature(Geometry geometry) {
    org.sola.clients.beans.cadastre.CadastreObjectBean formBean =
        new org.sola.clients.beans.cadastre.CadastreObjectBean();
    formBean.setNameFirstpart(getLayer().getLastPart());
    formBean.setNameLastpart(getLayer().getNameFirstPart());
    if (geometry != null) {
      formBean.setOfficialAreaSize(new BigDecimal(geometry.getArea()));
      formBean.setCalculatedArea(new BigDecimal(geometry.getArea()));
    }
    ParcelDialog form = new ParcelDialog(formBean, false, null, true);

    final CadastreObjectBean[] beans = new CadastreObjectBean[1];

    // AM - Multi-SRID change
    // Need to explicitly set the SRID of the map on the geometry.
    final Geometry geom = this.layer.setSridOnGeometry(geometry);

    form.addPropertyChangeListener(
        new PropertyChangeListener() {

          @Override
          public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getPropertyName().equals(ParcelDialog.SELECTED_PARCEL)) {
              // Convert between CadastreObject in the GIS project and CadastreObject in the Clients
              // Beans
              org.sola.clients.beans.cadastre.CadastreObjectBean bean =
                  (org.sola.clients.beans.cadastre.CadastreObjectBean) evt.getNewValue();
              CadastreObjectBean bean2 =
                  MappingManager.getMapper().map(bean, CadastreObjectBean.class);
              // Fix problem with list area list duplications
              bean2.getSpatialValueAreaList().clear();
              bean2.getSpatialValueAreaList().addAll(bean.getSpatialValueAreaList());

              bean2.setFeatureGeom(geom);
              getLayer().getBeanList().add(bean2);
              beans[0] = bean2;
            }
          }
        });

    form.setVisible(true);
    if (beans[0] != null) {
      return getLayer().getFeatureByCadastreObjectId(beans[0].getId());
    }
    return null;
  }

  /**
   * Gets the layer where the new cadastre objects are added.
   *
   * @return
   */
  private CadastreChangeNewCadastreObjectLayer getLayer() {
    return (CadastreChangeNewCadastreObjectLayer) this.layer;
  }
}