Check if information model entity referenced by archetype
has right name or type
170637
void checkRmModelConformance() {
        final AmVisitor<AmObject, AmConstraintContext> visitor = AmVisitors.preorder(new ConformanceVisitor());
        ArchetypeWalker.walkConstraints(visitor, archetype, new AmConstraintContext());
    }
1345887
def _match_type(self, i):
        """"""
        self.col_match = self.RE_TYPE.match(self._source[i])
        if self.col_match is not None:
            self.section = "types"
            self.el_type = CustomType
            self.el_name = self.col_match.group("name")
           
            return True
        else:
            return False
1132788
public static boolean isCollection(EntityDataModel entityDataModel, String typeName) {
        EntitySet entitySet = entityDataModel.getEntityContainer().getEntitySet(typeName);
        if (entitySet != null) {
            return true;
        }
        try {
            if (Collection.class.isAssignableFrom(Class.forName(typeName))
                    || COLLECTION_PATTERN.matcher(typeName).matches()) {
                return true;
            }
        } catch (ClassNotFoundException e) {
            LOG.debug("Not possible to find class for type name: {}", typeName);
        }

        return false;
    }
979850
def is_model_name_lookup(self, base):
        
        return (
            isinstance(base, ast.Name) and
            base.id == self.model_name_lookup
        )
836473
function checkForReservedTableName(args) {
  if (!args) {
    return;
  }
  if (args.databaseTypeName) {
    checkTableName(args.name, args.databaseTypeName, args.shouldThrow);
  } else {
    for (let i = 0, types = Object.keys(DatabaseTypes); i < types.length; i++) {
      if (typeof DatabaseTypes[types[i]] !== 'function') {
        checkTableName(args.name, DatabaseTypes[types[i]], args.shouldThrow);
      }
    }
  }
}
457617
def _get_entity_by_name(self, entity_name):
        """"""
        if entity_name in self._registry:
            return self._registry[entity_name]
        else:
            return self._find_entity_in_records_by_class_name(entity_name)
1193941
function is(store, uri, type) {
  var ret = false

  var types = store.findTypeURIs($rdf.sym(uri))

  if (types && types[type]) {
    ret = true
  }

  return ret
}
603612
private <T extends IEntity> boolean isSpecialEntity(T entity) {
        return (entity instanceof Estimate)
                || (entity instanceof Invoice)
                || (entity instanceof SalesReceipt);
    }
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);
  }
747631
def _check_for_changes(entity_type, ret, existing, modified):
    '''
    
    '''

    ret['result'] = True

    #were there any changes? generation always changes, remove it.

    if isinstance(existing, dict) and isinstance(modified, dict):
        if 'generation' in modified['content'].keys():
            del modified['content']['generation']

        if 'generation' in existing['content'].keys():
            del existing['content']['generation']

        if modified['content'] == existing['content']:
            ret['comment'] = '{entity_type} is currently enforced to the desired state.  No changes made.'.format(entity_type=entity_type)
        else:
            ret['comment'] = '{entity_type} was enforced to the desired state.  Note: Only parameters specified ' \
                             'were enforced. See changes for details.'.format(entity_type=entity_type)
            ret['changes']['old'] = existing['content']
            ret['changes']['new'] = modified['content']

    else:
        if modified == existing:
            ret['comment'] = '{entity_type} is currently enforced to the desired state.  No changes made.'.format(entity_type=entity_type)
        else:
            ret['comment'] = '{entity_type} was enforced to the desired state.  Note: Only parameters specified ' \
                             'were enforced. See changes for details.'.format(entity_type=entity_type)
            ret['changes']['old'] = existing
            ret['changes']['new'] = modified

    return ret
80450
def _is_physical_entity(pe):
    """"""
    val = isinstance(pe, _bp('PhysicalEntity')) or \
            isinstance(pe, _bpimpl('PhysicalEntity'))
    return val
321878
def FindTypeInfo(self, name):
    """"""
    result = self.type_infos.get(name)
    if result is None:
      # Not found, assume string.
      result = type_info.String(name=name, default="")

    return result
678889
private boolean hasPrimaryKey(T entity) {
        Object pk = getPrimaryKey(entity);
        if (pk == null) {
            return false;
        } else {
            if (pk instanceof Number && ((Number) pk).longValue() == 0) {
                return false;
            }
        }
        return true;
    }
200827
def has_model(self, model):
        
        # TODO:
        # - accept DigitalObject for model?
        # - convert model pid to info:fedora/ form if not passed in that way?
        try:
            rels = self.rels_ext.content
        except RequestFailed:
            # if rels-ext can't be retrieved, confirm this object does not have a RELS-EXT
            # (in which case, it does not subscribe to the specified content model)
            if "RELS-EXT" not in self.ds_list.keys():
                return False
            else:
                raise

        st = (self.uriref, modelns.hasModel, URIRef(model))
        return st in rels
396027
def _check_initialized(self):
    
    baddies = self._find_uninitialized()
    if baddies:
      raise datastore_errors.BadValueError(
          'Entity has uninitialized properties: %s' % ', '.join(baddies))
1063491
private boolean checkEDBObjectModelType(EDBObject object, Class<?> model) {
        String modelClass = object.getString(EDBConstants.MODEL_TYPE);
        if (modelClass == null) {
            LOGGER.warn(String.format("The EDBObject with the oid %s has no model type information."
                    + "The resulting model may be a different model type than expected.", object.getOID()));
        }
        if (modelClass != null && !modelClass.equals(model.getName())) {
            return false;
        }
        return true;
    }
1239341
def is_creation_model(instance, attribute, value):
    """"""

    creation_name = value.get('name')
    if not isinstance(creation_name, str):
        instance_name = instance.__class__.__name__
        err_str = ("'name' must be given as a string in the '{attr}' "
                   "parameter of a '{cls}'. Given "
                   "'{value}'").format(attr=attribute.name,
                                       cls=instance_name,
                                       value=creation_name)
        raise ModelDataError(err_str)