Example #1
0
 @Override
 public List<License> findAllLicenses() {
   List<License> result = new ArrayList<License>();
   for (LicenseGroup lg : this.findAll()) {
     for (License l : lg.getLicenses()) {
       l.setGroup(lg);
       result.add(l);
     }
   }
   return result;
 }
Example #2
0
  @Override
  public License findLicenseById(String licenseId) {

    Criteria c = Criteria.where("licenses").elemMatch(Criteria.where("_id").is(licenseId));
    BasicQuery basicQuery = new BasicQuery(c.getCriteriaObject(), c.getCriteriaObject());

    LicenseGroup lg = this.findOne(basicQuery);
    if (lg != null) {
      License g = lg.getLicenses().get(0);
      g.setGroup(lg);
      return g;
    }
    return null;
  }