Package nl.topicus.onderwijs.dashboard.datatypes

Examples of nl.topicus.onderwijs.dashboard.datatypes.BuienRadar


          public BuienRadar getObject() {
            DashboardRepository repository = WicketApplication
                .get().getRepository();
            Map<Key, Buien> data = repository.getData(Buien.class);
            Buien buien = data.get(key);
            BuienRadar value = buien.getValue();
            return value;
          }
        });
    add(buienRadar);
  }
View Full Code Here


    try {
      Map<Key, Map<String, ?>> serviceSettings = getSettings()
          .getServiceSettings(BuienRadarService.class);
      for (Map.Entry<Key, Map<String, ?>> curSettingEntry : serviceSettings
          .entrySet()) {
        BuienRadar report = new BuienRadar();

        Map<String, ?> locatieSettings = curSettingEntry.getValue();
        int lat = (Integer) locatieSettings.get("lat");
        int lon = (Integer) locatieSettings.get("lon");
        int x = (Integer) locatieSettings.get("x");
        int y = (Integer) locatieSettings.get("y");

        List<Integer> kleurenBuienradar = getKleurenBuienradar(lat,
            lon, x, y);
        Integer[] rainForecast = new Integer[kleurenBuienradar.size()];
        for (int i = 0; i < rainForecast.length; i++)
          rainForecast[i] = kleurenBuienradar.get(i);
        report.setRainForecast(rainForecast);

        reports.put(curSettingEntry.getKey(), report);
      }
    } catch (Exception e) {
      log.error("Unable to refresh data from buienradar.nl: {} {}", e
View Full Code Here

        return ret;
      }

      private BuienRadar createRandomBuien() {
        Random random = new Random();
        BuienRadar ret = new BuienRadar();

        Integer[] rainForecast = new Integer[12];
        for (int i = 0; i < rainForecast.length; i++) {
          rainForecast[i] = 500 * random.nextInt(2);
        }
        ret.setRainForecast(rainForecast);

        return ret;
      }

      private List<Train> createRandomTrains() {
        Random random = new Random();
        List<Train> ret = new ArrayList<Train>();
        for (int count = 0; count < 10; count++) {
          Train train = new Train();
          train.setType(TrainType.values()[random.nextInt(TrainType
              .values().length)]);
          train.setDestination("random random random centraal");
          int minute = random.nextInt(60);
          train.setDepartureTime(random.nextInt(24) + ":"
              + (minute < 10 ? "0" : "") + minute);
          train.setDelay(random.nextInt(10));
          train.setPlatform(Integer.toString(random.nextInt(10)));
          ret.add(train);
        }
        Collections.sort(ret, new Comparator<Train>() {
          @Override
          public int compare(Train o1, Train o2) {
            return o1.getKey().compareTo(o2.getKey());
          }
        });
        return ret;
      }

      private List<Alert> createRandomAlerts(Key key) {
        if (!(key instanceof Project))
          return null;

        Random random = new Random();
        List<Alert> ret = new ArrayList<Alert>();
        for (int count = 0; count < random.nextInt(3); count++) {
          Alert alert = new Alert();
          alert.setProject(key);
          alert.setOverlayVisible(false);
          alert.setColor(DotColor.values()[random.nextInt(3)]);
          int minute = random.nextInt(60);
          alert.setTime(random.nextInt(24) + ":"
              + (minute < 10 ? "0" : "") + minute);
          alert.setMessage("random exception with long message");
          ret.add(alert);
        }
        Collections.sort(ret, new Comparator<Alert>() {
          @Override
          public int compare(Alert o1, Alert o2) {
            return o1.getKey().compareTo(o2.getKey());
          }
        });
        return ret;
      }

      private List<Commit> createRandomCommits(Key key) {
        Random random = new Random();
        List<Commit> ret = new ArrayList<Commit>();
        for (int count = 0; count < 5; count++) {
          Commit commit = new Commit();
          commit.setProject(key);
          long rev = Math.abs(random.nextLong());
          if (rev < HEX_10_DIGITS)
            rev += HEX_10_DIGITS + 1;
          commit.setRevision(Long.toString(rev, 16).substring(0, 8));
          commit.setDateTime(new Date(System.currentTimeMillis()
              - random.nextInt(3600000)));
          commit.setMessage("random commit with long message");
          commit.setAuthor("random");
          ret.add(commit);
        }
        return ret;
      }

      private List<Issue> createRandomIssues(Key key) {
        Random random = new Random();
        List<Issue> ret = new ArrayList<Issue>();
        for (int count = 0; count < 5; count++) {
          Issue issue = new Issue();
          issue.setProject(key);
          issue.setId(random.nextInt(100000));
          issue.setDateTime(new Date(System.currentTimeMillis()
              - random.nextInt(3600000)));
          issue.setSummary("random issue with long message");
          issue.setStatus(IssueStatus.NEW);
          issue.setSeverity(IssueSeverity.values()[random
              .nextInt(IssueSeverity.values().length)]);
          issue.setPriority(IssuePriority.values()[random
              .nextInt(IssuePriority.values().length)]);
          ret.add(issue);
        }
        return ret;
      }

      private synchronized List<Event> createRandomEvents(Key key) {

        List<Event> ret = eventCache.get(key);
        if (ret != null)
          return ret;

        Random random = new Random();
        ret = new ArrayList<Event>();
        for (int count = 0; count < 2; count++) {
          Event event = new Event();
          event.setKey(key);
          event.setTitle("random");
          Calendar cal = Calendar.getInstance();
          cal.add(Calendar.DAY_OF_YEAR, random.nextInt(30));
          event.setDateTime(cal.getTime());
          event.setMajor(random.nextInt(5) == 0);
          if (event.isMajor())
            event.getTags().add("#major");
          event.setColor(Integer.toHexString(random
              .nextInt(256 * 256 * 256)));
          while (event.getColor().length() < 0)
            event.setColor("0" + event.getColor());
          event.setColor("#" + event.getColor());
          ret.add(event);
        }
        Collections.sort(ret, new Comparator<Event>() {
          @Override
          public int compare(Event o1, Event o2) {
            return o1.getDateTime().compareTo(o2.getDateTime());
          }
        });
        eventCache.put(key, ret);
        return ret;
      }

      private List<TwitterStatus> createRandomTweets(Key key) {
        Random random = new Random();
        List<TwitterStatus> ret = new ArrayList<TwitterStatus>();
        for (int count = 0; count < 10; count++) {
          TwitterStatus status = new TwitterStatus(key);
          status.setDate(new Date(System.currentTimeMillis()
              - random.nextInt(24 * 3600 * 1000)));
          status.setTags(Collections.<String> emptyList());
          status.setUser("random");
          status.setText("random tweet at " + count);
          ret.add(status);
        }
        return ret;
      }
    };
    return (T) Proxy.newProxyInstance(getClass().getClassLoader(),
View Full Code Here

TOP

Related Classes of nl.topicus.onderwijs.dashboard.datatypes.BuienRadar

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.