Validate that non-system entities are not assigned to a system package

@param entityType entity type
179882
void validatePackage(EntityType entityType) {
    Package pack = entityType.getPackage();
    if (pack != null
        && isSystemPackage(pack)
        && !systemEntityTypeRegistry.hasSystemEntityType(entityType.getId())) {
      throw new MolgenisValidationException(
          new ConstraintViolation(
              format(
                  "Adding entity [%s] to system package [%s] is not allowed",
                  entityType.getId(), pack.getId())));
    }
  }
893627
private void validate() {

        if (host.isEmpty()) {
            throw new IllegalArgumentException("host cannot be null");
        }
        if (catalog == null) {
            throw new IllegalArgumentException("database cannot be null");
        }
        if (table == null) {
            throw new IllegalArgumentException("collection cannot be null");
        }

        concantHostPort();
    }
623281
def _validate_entity(entity):
    '''
    
    '''

    #Validate entity:
    if entity['type'] == 'cluster':
        schema = ESXClusterEntitySchema.serialize()
    elif entity['type'] == 'vcenter':
        schema = VCenterEntitySchema.serialize()
    else:
        raise ArgumentValueError('Unsupported entity type \'{0}\''
                                 ''.format(entity['type']))
    try:
        jsonschema.validate(entity, schema)
    except jsonschema.exceptions.ValidationError as exc:
        raise InvalidEntityError(exc)
412165
public boolean unresolveType(final Class<? extends Entity> type) {
	return resolved.remove(Objects.requireNonNull(type)) != null;
    }
496949
private void onInheritedProperty(TableInfo tableInfo, EntityType entityType)
    {
        String discrColumn = ((AbstractManagedType) entityType).getDiscriminatorColumn();

        if (discrColumn != null)
        {
            ColumnInfo columnInfo = new ColumnInfo();
            columnInfo.setColumnName(discrColumn);
            columnInfo.setType(String.class);
            columnInfo.setIndexable(true);

            IndexInfo idxInfo = new IndexInfo(discrColumn);
            tableInfo.addColumnInfo(columnInfo);
            tableInfo.addToIndexedColumnList(idxInfo);
        }
    }
1252458
private void validateEntities(JsonNode data) throws InvalidInputException {
    for (JsonNode node : data.findParents(INDEX_START)) {

      for (String key : new String[] {INDEX_START, INDEX_END, ID, TYPE}) {
        if (node.path(key).isMissingNode()) {
          throw new InvalidInputException("Required field \"" + key + "\" missing from the entity payload");
        }
      }

      int startIndex = node.get(INDEX_START).intValue();
      int endIndex = node.get(INDEX_END).intValue();

      if (endIndex <= startIndex) {
        throw new InvalidInputException(String.format("Invalid entity payload: %s (start index: %s, end index: %s)",
            node.get(ID).textValue(), startIndex, endIndex));
      }

    }
  }
159322
static void validateLabelAttribute(EntityType entityType) {
    if (entityType.getLabelAttribute() != null && !entityType.getLabelAttribute().isVisible()) {
      throw new MolgenisValidationException(
          new ConstraintViolation(
              format(
                  "Label attribute [%s] of EntityType [%s] must be visible.",
                  entityType.getLabelAttribute().getName(), entityType.getId())));
    }

    if (!entityType.isAbstract()
        && !entityType.getIdAttribute().isVisible()
        && (entityType.getLabelAttribute() == null)) {
      throw new MolgenisValidationException(
          new ConstraintViolation(
              format(
                  "EntityType [%s] must define a label attribute because the identifier is hidden",
                  entityType.getId())));
    }
  }
854822
@Override
    public boolean canEdit(ProjectEntity entity, SecurityService securityService) {
        switch (entity.getProjectEntityType()) {
            case BUILD:
                return securityService.isProjectFunctionGranted(entity, BuildCreate.class);
            case PROMOTION_RUN:
                return securityService.isProjectFunctionGranted(entity, PromotionRunCreate.class);
            case VALIDATION_RUN:
                return securityService.isProjectFunctionGranted(entity, ValidationRunCreate.class);
            default:
                throw new PropertyUnsupportedEntityTypeException(getClass().getName(), entity.getProjectEntityType());
        }
    }
17520
List<EntityType> putEntitiesInDefaultPackage(
      IntermediateParseResults intermediateResults, String defaultPackageId) {
    Package p = getPackage(intermediateResults, defaultPackageId);
    if (p == null) {
      throw new UnknownPackageException(defaultPackageId);
    }

    List<EntityType> entities = newArrayList();
    for (EntityType entityType : intermediateResults.getEntityTypes()) {
      if (entityType.getPackage() == null) {
        entityType.setId(defaultPackageId + PACKAGE_SEPARATOR + entityType.getId());
        entityType.setPackage(p);
      }
      entities.add(entityType);
    }
    return entities;
  }
797790
protected void validate(final CmsEntity entity) {

        if (!m_validating) {
            m_validating = true;
            m_contentService.validateEntity(entity, new AsyncCallback<CmsValidationResult>() {

                public void onFailure(Throwable caught) {

                    // can be ignored
                }

                public void onSuccess(CmsValidationResult result) {

                    displayValidation(entity.getId(), result);
                }
            });
        }
    }
950631
private boolean checkImplementer(TypeElement providerImplementer, TypeElement providerType) {

    String verify = processingEnv.getOptions().get("verify");
    if (verify == null || !Boolean.valueOf(verify)) {
      return true;
    }

    // TODO: We're currently only enforcing the subtype relationship
    // constraint. It would be nice to enforce them all.

    Types types = processingEnv.getTypeUtils();

    return types.isSubtype(providerImplementer.asType(), providerType.asType());
  }
82523
public void ensureCollection(StructuredType entityType) throws ODataException {
        List<String> missingCollectionPropertyName = new ArrayList<>();

        entityType.getStructuralProperties().stream()
                .filter(property -> (property.isCollection())
                        && !(property instanceof NavigationProperty) && !property.isNullable()).forEach(property -> {
            LOG.debug("Validating non-nullable collection property : {}", property.getName());
            if (!fields.containsKey(property.getName())) {
                missingCollectionPropertyName.add(property.getName());
            }
        });
        if (missingCollectionPropertyName.size() != 0) {
            StringJoiner joiner = new StringJoiner(",");
            missingCollectionPropertyName.forEach(joiner::add);
            throw new ODataUnmarshallingException("The request does not specify the non-nullable collections: '"
                    + joiner.toString() + ".");
        }

    }
762154
static void validateExtends(EntityType entityType) {
    EntityType entityTypeExtends = entityType.getExtends();
    if (entityTypeExtends != null && !entityTypeExtends.isAbstract()) {
      throw new MolgenisValidationException(
          new ConstraintViolation(
              format(
                  "EntityType [%s] is not abstract; EntityType [%s] can't extend it",
                  entityTypeExtends.getId(), entityType.getId())));
    }
  }
739171
static boolean isPersistedInPostgreSql(EntityType entityType) {
    String backend = entityType.getBackend();
    if (backend == null) {
      // TODO remove this check after getBackend always returns the backend
      if (null != getApplicationContext()) {
        DataService dataService = getApplicationContext().getBean(DataService.class);
        backend = dataService.getMeta().getDefaultBackend().getName();
      } else {
        // A workaround for the integration tests. getApplicationContext() should not be null
        return true;
      }
    }
    return backend.equals(PostgreSqlRepositoryCollection.POSTGRESQL);
  }
746074
void removeNonExistingSystemEntityTypes() {
    // get all system entities
    List<EntityType> removedSystemEntityMetas =
        dataService
            .findAll(ENTITY_TYPE_META_DATA, EntityType.class)
            .filter(EntityTypeUtils::isSystemEntity)
            .filter(this::isNotExists)
            .collect(toList());

    dataService.getMeta().deleteEntityType(removedSystemEntityMetas);
    removedSystemEntityMetas.forEach(
        entityType ->
            mutableAclClassService.deleteAclClass(EntityIdentityUtils.toType(entityType)));
  }
1122755
private void setExecutionTypeIfNotSet(ExecutionType executionType) {
        if (this.executionType == null) {
            logger.finer("Setting initial execution type value");
            this.executionType = executionType;
        } else {
            logger.finer("Not setting execution type value since it's already set");
        }
    }
1027718
@Override
    public void validate() {

        if (entityClass == null) {
            throw new IllegalArgumentException("testentity class cannot be null");
        }

        if (!entityClass.isAnnotationPresent(DeepEntity.class)) {
            throw new AnnotationTypeMismatchException(null, entityClass.getCanonicalName());
        }

        super.validate();

        /* let's validate fieldNames in @DeepField annotations */
        Field[] deepFields = AnnotationUtils.filterDeepFields(entityClass);

        Map<String, Cell> colDefs = super.columnDefinitions();

        /* colDefs is null if table does not exist. I.E. this configuration will be used as an output configuration
         object, and the output table is dynamically created */
        if (colDefs == null) {
            return;
        }

        for (Field field : deepFields) {
            String annotationFieldName = AnnotationUtils.deepFieldName(field);

            if (!colDefs.containsKey(annotationFieldName)) {
                throw new DeepNoSuchFieldException("Unknown column name \'" + annotationFieldName + "\' specified for" +
                        " field " + entityClass.getCanonicalName() + "#" + field.getName() + ". Please, " +
                        "make sure the field name you specify in @DeepField annotation matches _exactly_ the column " +
                        "name " +
                        "in the database");
            }
        }
    }