コード例 #1
0
    @Override
    public List<List<String>> getSummary(String page, Object object) {
      List<List<String>> list = null;
      if (page.equals("viewOrganization.jsp")) {
        if (!(object instanceof Unit)) {
          return null;
        }

        Unit unit = (Unit) object;
        Person currentUser = UserView.getCurrentUser().getExpenditurePerson();
        if (!(unit.isResponsible(currentUser)
            || unit.getObserversSet().contains(currentUser)
            || UserView.getCurrentUser().hasRoleType(RoleType.MANAGER))) {
          return null;
        }

        list = new ArrayList<List<String>>();
        list.add(new ArrayList<String>());
        list.add(new ArrayList<String>());

        ReportViewerComponent projectSummary;
        Project project = getProjectFromID(unit.getExternalId());
        if (project != null) {
          String projectCode = project.getProjectCode();
          System.out.println(projectCode);

          projectSummary =
              new ReportViewerComponent(
                  "SELECT V.\"Orçamento\", V.\"Máximo Financiável\" AS \"Máx. Financiável\", V.\"Receita\", V.\"Transf. Parceiros\", V.\"Despesa\", V.\"Adiantamentos por Justificar\", V.\"Cabimentos por Executar\", V.\"Saldo Tesouraria\", V.\"Saldo Orçamental\" FROM V_RESPROJPROF V WHERE V.\"NºProj\"='"
                      + projectCode
                      + "'",
                  new NoBehaviourCustomTableFormatter());

          Table t = projectSummary.getTable();

          if (t.getItemIds().size() > 0) {
            for (Object a : t.getItemIds()) {
              Item item = t.getItem(a);

              for (Object column : item.getItemPropertyIds()) {
                String itemString =
                    ReportType.formatCurrency(item.getItemProperty(column).toString());
                list.get(0).add(t.getColumnHeader(column));
                list.get(1).add(itemString);
              }
            }
          }
        }
      }
      return list;
    }
コード例 #2
0
ファイル: LinkEvalUi.java プロジェクト: AKSW/linkeval
 private void cachingForTriples(Table table, String endpoint) {
   Model model = ModelFactory.createDefaultModel();
   List<String> resources = null;
   FileWriter fstream = null;
   try {
     fstream = new FileWriter("/home/mofeed/TrialStart/zicozico.nt");
   } catch (IOException e1) {
     // TODO Auto-generated catch block
     e1.printStackTrace();
   }
   BufferedWriter out = new BufferedWriter(fstream);
   try {
     for (Object id : table.getItemIds()) {
       Item item = table.getItem(id);
       Property sourceURI = item.getItemProperty("sourceURI"); // vaadin property not jena
       Resource resource = model.createResource();
       try {
         String sparqlQuery = "select distinct * where { <" + sourceURI.getValue() + "> ?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;
         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();
           com.hp.hpl.jena.rdf.model.Property pt = ResourceFactory.createProperty(property);
           // resource.addProperty(pt, value);
           model.add(resource, pt, value);
         }
         qexec.close();
         model.write(out, null, "TURTLE");
       } catch (Exception e) {
         Notification.show(e.toString());
       }
       // model.add(s, p, o);
       // Property destinationURI = item.getItemProperty("destinationURI");
       // out.write(sourceURI.getValue()+"\n");
     }
     /*out.flush();
     fstream.flush();*/
     out.close();
   } catch (Exception e) { // Catch exception if any
     System.err.println("Error: " + e.getMessage());
   }
 }
コード例 #3
0
 private void setTablePageLengths() {
   myTranscoderTable.setPageLength(Math.min(myTranscoderTable.getItemIds().size(), 10));
 }