@Test public void approveLicense(){ final DbLicense license = new DbLicense(); license.setName("licenseName"); final DbLicense license2 = new DbLicense(); license.setName("licenseName2"); final DbArtifact artifactWithoutLicense = new DbArtifact(); LicenseIdFilter filter = new LicenseIdFilter(license.getName()); assertTrue(filter.filter(license)); assertFalse(filter.filter(license2)); }
@Override public boolean filter(final Object datamodelObj) { if(datamodelObj instanceof DbLicense){ return licenseId.equals( ((DbLicense)datamodelObj).getName()); } if(datamodelObj instanceof DbArtifact){ return ((DbArtifact)datamodelObj).getLicenses().contains(licenseId); } return false; }
LicenseIdFilter implements Filter { @Override public boolean filter(final Object datamodelObj) { if(datamodelObj instanceof DbLicense){ return licenseId.equals( ((DbLicense)datamodelObj).getName()); } if(datamodelObj instanceof DbArtifact){ return ((DbArtifact)datamodelObj).getLicenses().contains(licenseId); } return false; } }
LicenseIdFilter implements Filter { @Override public boolean filter(final Object datamodelObj) { if(datamodelObj instanceof DbLicense){ return licenseId.equals( ((DbLicense)datamodelObj).getName()); } if(datamodelObj instanceof DbArtifact){ return ((DbArtifact)datamodelObj).getLicenses().contains(licenseId); } return false; } LicenseIdFilter(final String licenseId); }
LicenseIdFilter implements Filter { @Override public boolean filter(final Object datamodelObj) { if(datamodelObj instanceof DbLicense){ return licenseId.equals( ((DbLicense)datamodelObj).getName()); } if(datamodelObj instanceof DbArtifact){ return ((DbArtifact)datamodelObj).getLicenses().contains(licenseId); } return false; } LicenseIdFilter(final String licenseId); @Override boolean filter(final Object datamodelObj); @Override Map<String, Object> moduleFilterFields(); @Override Map<String, Object> artifactFilterFields(); }
LicenseIdFilter implements Filter { @Override public boolean filter(final Object datamodelObj) { if(datamodelObj instanceof DbLicense){ return licenseId.equals( ((DbLicense)datamodelObj).getName()); } if(datamodelObj instanceof DbArtifact){ return ((DbArtifact)datamodelObj).getLicenses().contains(licenseId); } return false; } LicenseIdFilter(final String licenseId); @Override boolean filter(final Object datamodelObj); @Override Map<String, Object> moduleFilterFields(); @Override Map<String, Object> artifactFilterFields();  }