@Test void testValidateOwnLookupAttributesEmpty() { when(entityType.getOwnLookupAttributes()).thenReturn(emptyList()); EntityTypeValidator.validateOwnLookupAttributes(entityType, emptyMap()); }
static void validateOwnLookupAttributes( EntityType entityType, Map<String, Attribute> ownAllAttrMap) { entityType .getOwnLookupAttributes() .forEach( ownLookupAttr -> { Attribute ownAttr = ownAllAttrMap.get(ownLookupAttr.getIdentifier()); if (ownAttr == null) { throw new MolgenisValidationException( new ConstraintViolation( format( "Lookup attribute [%s] is not one of the attributes of entity [%s]", ownLookupAttr.getName(), entityType.getId()))); } if (!ownLookupAttr.isVisible()) { throw new MolgenisValidationException( new ConstraintViolation( format( "Lookup attribute [%s] of entity type [%s] must be visible", ownLookupAttr.getName(), entityType.getId()))); } }); }
EntityTypeValidator { static void validateOwnLookupAttributes( EntityType entityType, Map<String, Attribute> ownAllAttrMap) { entityType .getOwnLookupAttributes() .forEach( ownLookupAttr -> { Attribute ownAttr = ownAllAttrMap.get(ownLookupAttr.getIdentifier()); if (ownAttr == null) { throw new MolgenisValidationException( new ConstraintViolation( format( "Lookup attribute [%s] is not one of the attributes of entity [%s]", ownLookupAttr.getName(), entityType.getId()))); } if (!ownLookupAttr.isVisible()) { throw new MolgenisValidationException( new ConstraintViolation( format( "Lookup attribute [%s] of entity type [%s] must be visible", ownLookupAttr.getName(), entityType.getId()))); } }); } }
EntityTypeValidator { static void validateOwnLookupAttributes( EntityType entityType, Map<String, Attribute> ownAllAttrMap) { entityType .getOwnLookupAttributes() .forEach( ownLookupAttr -> { Attribute ownAttr = ownAllAttrMap.get(ownLookupAttr.getIdentifier()); if (ownAttr == null) { throw new MolgenisValidationException( new ConstraintViolation( format( "Lookup attribute [%s] is not one of the attributes of entity [%s]", ownLookupAttr.getName(), entityType.getId()))); } if (!ownLookupAttr.isVisible()) { throw new MolgenisValidationException( new ConstraintViolation( format( "Lookup attribute [%s] of entity type [%s] must be visible", ownLookupAttr.getName(), entityType.getId()))); } }); } EntityTypeValidator(DataService dataService, SystemEntityTypeRegistry systemEntityTypeRegistry); }
EntityTypeValidator { static void validateOwnLookupAttributes( EntityType entityType, Map<String, Attribute> ownAllAttrMap) { entityType .getOwnLookupAttributes() .forEach( ownLookupAttr -> { Attribute ownAttr = ownAllAttrMap.get(ownLookupAttr.getIdentifier()); if (ownAttr == null) { throw new MolgenisValidationException( new ConstraintViolation( format( "Lookup attribute [%s] is not one of the attributes of entity [%s]", ownLookupAttr.getName(), entityType.getId()))); } if (!ownLookupAttr.isVisible()) { throw new MolgenisValidationException( new ConstraintViolation( format( "Lookup attribute [%s] of entity type [%s] must be visible", ownLookupAttr.getName(), entityType.getId()))); } }); } EntityTypeValidator(DataService dataService, SystemEntityTypeRegistry systemEntityTypeRegistry); void validate(EntityType entityType); }
EntityTypeValidator { static void validateOwnLookupAttributes( EntityType entityType, Map<String, Attribute> ownAllAttrMap) { entityType .getOwnLookupAttributes() .forEach( ownLookupAttr -> { Attribute ownAttr = ownAllAttrMap.get(ownLookupAttr.getIdentifier()); if (ownAttr == null) { throw new MolgenisValidationException( new ConstraintViolation( format( "Lookup attribute [%s] is not one of the attributes of entity [%s]", ownLookupAttr.getName(), entityType.getId()))); } if (!ownLookupAttr.isVisible()) { throw new MolgenisValidationException( new ConstraintViolation( format( "Lookup attribute [%s] of entity type [%s] must be visible", ownLookupAttr.getName(), entityType.getId()))); } }); } EntityTypeValidator(DataService dataService, SystemEntityTypeRegistry systemEntityTypeRegistry); void validate(EntityType entityType);  }