@Test void testValidateOwnLabelAttributeAbstractEntity() { when(entityType.getOwnLabelAttribute()).thenReturn(null); EntityTypeValidator.validateOwnLabelAttribute(entityType, newHashMap()); }
static void validateOwnLabelAttribute( EntityType entityType, Map<String, Attribute> ownAllAttrMap) { Attribute ownLabelAttr = entityType.getOwnLabelAttribute(); if (ownLabelAttr != null) { Attribute ownAttr = ownAllAttrMap.get(ownLabelAttr.getIdentifier()); if (ownAttr == null) { throw new MolgenisValidationException( new ConstraintViolation( format( "Label attribute [%s] is not one of the attributes of entity [%s]", ownLabelAttr.getName(), entityType.getId()))); } if (ownAttr.isNillable()) { throw new MolgenisValidationException( new ConstraintViolation( format( "Label attribute [%s] of entity type [%s] cannot be nillable", ownLabelAttr.getName(), entityType.getId()))); } } }
EntityTypeValidator { static void validateOwnLabelAttribute( EntityType entityType, Map<String, Attribute> ownAllAttrMap) { Attribute ownLabelAttr = entityType.getOwnLabelAttribute(); if (ownLabelAttr != null) { Attribute ownAttr = ownAllAttrMap.get(ownLabelAttr.getIdentifier()); if (ownAttr == null) { throw new MolgenisValidationException( new ConstraintViolation( format( "Label attribute [%s] is not one of the attributes of entity [%s]", ownLabelAttr.getName(), entityType.getId()))); } if (ownAttr.isNillable()) { throw new MolgenisValidationException( new ConstraintViolation( format( "Label attribute [%s] of entity type [%s] cannot be nillable", ownLabelAttr.getName(), entityType.getId()))); } } } }
EntityTypeValidator { static void validateOwnLabelAttribute( EntityType entityType, Map<String, Attribute> ownAllAttrMap) { Attribute ownLabelAttr = entityType.getOwnLabelAttribute(); if (ownLabelAttr != null) { Attribute ownAttr = ownAllAttrMap.get(ownLabelAttr.getIdentifier()); if (ownAttr == null) { throw new MolgenisValidationException( new ConstraintViolation( format( "Label attribute [%s] is not one of the attributes of entity [%s]", ownLabelAttr.getName(), entityType.getId()))); } if (ownAttr.isNillable()) { throw new MolgenisValidationException( new ConstraintViolation( format( "Label attribute [%s] of entity type [%s] cannot be nillable", ownLabelAttr.getName(), entityType.getId()))); } } } EntityTypeValidator(DataService dataService, SystemEntityTypeRegistry systemEntityTypeRegistry); }
EntityTypeValidator { static void validateOwnLabelAttribute( EntityType entityType, Map<String, Attribute> ownAllAttrMap) { Attribute ownLabelAttr = entityType.getOwnLabelAttribute(); if (ownLabelAttr != null) { Attribute ownAttr = ownAllAttrMap.get(ownLabelAttr.getIdentifier()); if (ownAttr == null) { throw new MolgenisValidationException( new ConstraintViolation( format( "Label attribute [%s] is not one of the attributes of entity [%s]", ownLabelAttr.getName(), entityType.getId()))); } if (ownAttr.isNillable()) { throw new MolgenisValidationException( new ConstraintViolation( format( "Label attribute [%s] of entity type [%s] cannot be nillable", ownLabelAttr.getName(), entityType.getId()))); } } } EntityTypeValidator(DataService dataService, SystemEntityTypeRegistry systemEntityTypeRegistry); void validate(EntityType entityType); }
EntityTypeValidator { static void validateOwnLabelAttribute( EntityType entityType, Map<String, Attribute> ownAllAttrMap) { Attribute ownLabelAttr = entityType.getOwnLabelAttribute(); if (ownLabelAttr != null) { Attribute ownAttr = ownAllAttrMap.get(ownLabelAttr.getIdentifier()); if (ownAttr == null) { throw new MolgenisValidationException( new ConstraintViolation( format( "Label attribute [%s] is not one of the attributes of entity [%s]", ownLabelAttr.getName(), entityType.getId()))); } if (ownAttr.isNillable()) { throw new MolgenisValidationException( new ConstraintViolation( format( "Label attribute [%s] of entity type [%s] cannot be nillable", ownLabelAttr.getName(), entityType.getId()))); } } } EntityTypeValidator(DataService dataService, SystemEntityTypeRegistry systemEntityTypeRegistry); void validate(EntityType entityType);  }