private Table fillTable(String[] headerTable, List reportData) {
    Table table = new Table();
    // header
    for (int i = 0; i < headerTable.length; i++) {
      table.addContainerProperty(headerTable[i], String.class, null);
    }
    // body
    ListIterator iterator = reportData.listIterator();
    for (int i = 0; iterator.hasNext(); i++) {
      table.addItem((Object[]) iterator.next(), i);
    }

    table.setPageLength(table.size());
    table.setSelectable(false);
    table.setNullSelectionAllowed(false);
    table.setImmediate(true);

    return table;
  }
 @Override
 protected void validateDetails() throws ValidationException {
   logger.info(
       "Company ID : " + companyid + " | User Name : " + username + " > " + "Validating Data ");
   Boolean errorFlag = false;
   if (cbBranch.getValue() == null) {
     cbBranch.setComponentError(new UserError(GERPErrorCodes.NULL_BRACH_NAME));
     errorFlag = true;
   } else {
     cbBranch.setComponentError(null);
     errorFlag = false;
   }
   if (lsVendorName.getValue() == null || lsVendorName.getValue().toString() == "[]") {
     lsVendorName.setComponentError(new UserError(GERPErrorCodes.NULL_VENDOR_NAME));
     errorFlag = true;
   } else {
     lsVendorName.setComponentError(null);
     errorFlag = false;
   }
   if (tblSmsEnqDtl.size() == 0) {
     cbUom.setComponentError(new UserError(GERPErrorCodes.NULL_MATERIAL_UOM));
     tfEnqQty.setComponentError(new UserError(GERPErrorCodes.NULL_ENQUIRY_QTY));
     lsProduct.setComponentError(new UserError(GERPErrorCodes.NULL_PRODUCT_NAME));
     errorFlag = true;
   }
   if ((dfEnqDate.getValue() != null) || (dfDueDate.getValue() != null)) {
     if (dfEnqDate.getValue().after(dfDueDate.getValue())) {
       dfDueDate.setComponentError(new UserError(GERPErrorCodes.MMS_DATE_OUTOFRANGE));
       logger.warn(
           "Company ID : "
               + companyid
               + " | User Name : "
               + username
               + " > "
               + "Throwing ValidationException. User data is > "
               + dfEnqDate.getValue());
       errorFlag = true;
     }
   }
   if (errorFlag) {
     throw new ERPException.ValidationException();
   }
 }
Exemple #3
0
  private void getURIProperties(String subject, String endpoint, Table table) {

    try { // "select * where { <"+subject+"> ?p  ?o .   FILTER(langMatches(lang(?o), \"EN\"))}";
      // idea about limiting results
      String sparqlQuery = "select distinct * where { <" + subject + "> ?p  ?o .}";
      Query query = QueryFactory.create(sparqlQuery);
      QueryExecution qexec = QueryExecutionFactory.sparqlService(endpoint, query);
      com.hp.hpl.jena.query.ResultSet results = qexec.execSelect();
      com.hp.hpl.jena.query.QuerySolution binding = null;
      table.removeAllItems();
      while (results.hasNext()) {
        binding = results.next();
        String property = binding.getResource("?p").toString();
        String value;
        if (binding.get("?o").isResource()) value = binding.getResource("?o").toString();
        else value = binding.getLiteral("?o").toString();
        table.addItem(new Object[] {property, value}, new Integer(table.size() + 1));
      }
      qexec.close();
    } catch (Exception e) {
      Notification.show(e.toString());
    }
  }
  protected void addTasks() {
    Label header = new Label(i18nManager.getMessage(Messages.PROCESS_INSTANCE_HEADER_TASKS));
    header.addStyleName(ExplorerLayout.STYLE_H3);
    header.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK);
    header.addStyleName(ExplorerLayout.STYLE_NO_LINE);
    panelLayout.addComponent(header);

    panelLayout.addComponent(new Label("&nbsp;", Label.CONTENT_XHTML));

    Table taskTable = new Table();
    taskTable.addStyleName(ExplorerLayout.STYLE_PROCESS_INSTANCE_TASK_LIST);
    taskTable.setWidth(100, UNITS_PERCENTAGE);

    // Fetch all tasks
    List<HistoricTaskInstance> tasks =
        historyService
            .createHistoricTaskInstanceQuery()
            .processInstanceId(processInstance.getId())
            .orderByHistoricTaskInstanceEndTime()
            .desc()
            .orderByHistoricTaskInstanceStartTime()
            .desc()
            .list();

    if (tasks.size() > 0) {

      // Finished icon
      taskTable.addContainerProperty(
          "finished", Component.class, null, "", null, Table.ALIGN_CENTER);
      taskTable.setColumnWidth("finished", 22);

      taskTable.addContainerProperty(
          "name",
          String.class,
          null,
          i18nManager.getMessage(Messages.TASK_NAME),
          null,
          Table.ALIGN_LEFT);
      taskTable.addContainerProperty(
          "priority",
          Integer.class,
          null,
          i18nManager.getMessage(Messages.TASK_PRIORITY),
          null,
          Table.ALIGN_LEFT);
      taskTable.addContainerProperty(
          "assignee",
          Component.class,
          null,
          i18nManager.getMessage(Messages.TASK_ASSIGNEE),
          null,
          Table.ALIGN_LEFT);
      taskTable.addContainerProperty(
          "dueDate",
          Component.class,
          null,
          i18nManager.getMessage(Messages.TASK_DUEDATE),
          null,
          Table.ALIGN_LEFT);
      taskTable.addContainerProperty(
          "startDate",
          Component.class,
          null,
          i18nManager.getMessage(Messages.TASK_CREATE_TIME),
          null,
          Table.ALIGN_LEFT);
      taskTable.addContainerProperty(
          "endDate",
          Component.class,
          null,
          i18nManager.getMessage(Messages.TASK_COMPLETE_TIME),
          null,
          Table.ALIGN_LEFT);

      panelLayout.addComponent(taskTable);
      panelLayout.setExpandRatio(taskTable, 1.0f);

      for (HistoricTaskInstance task : tasks) {
        addTaskItem(task, taskTable);
      }

      taskTable.setPageLength(taskTable.size());
    } else {
      // No tasks
      Label noTaskLabel = new Label(i18nManager.getMessage(Messages.PROCESS_INSTANCE_NO_TASKS));
      panelLayout.addComponent(noTaskLabel);
    }
  }