/*
getRequiredPropertiesForEntityType
Returns a hash of property names of properties that are required.
Creates that hash lazily and adds it to the
entityType's metadata for easier access by this directive
494942
function getRequiredPropertiesForEntityType(type) {
            if (type.custom && type.custom.required) {
                return type.custom.required;
            }

            // Don't yet know the required properties for this type
            // Find out now
            if (!type.custom) {
                type.custom = {};
            }
            var required = {};
            type.custom.required = required;
            var props = type.getProperties();
            var childProps = getComplexChildProperties(props);
            props = props.concat(childProps);            
            props.forEach(function (prop) {
                var vals = prop.validators;
                for (var i = vals.length; i--;) {
                    var val = vals[i];
                    // Todo: add the 'isRequired' property to breeze.Validator.required validator
                    if (val.context.isRequired || val.name === 'required') {
                        required[prop.name] = true;
                        break;
                    }
                }
            });
            return required;
        }
612292
function processProperties(swagger, properties, requiredProperties) {
  var result = {};
  for (var name in properties) {
    var property = properties[name];
    var descriptor = {
      propertyName: name.indexOf('-') === -1 ? name : `"${name}"`,
      propertyComments: toComments(property.description, 1),
      propertyRequired: requiredProperties.indexOf(name) >= 0,
      propertyType: propertyType(property),
    };
    result[name] = descriptor;
  }
  return result;
}
357982
public static Fetch createDefaultEntityFetch(EntityType entityType, String languageCode) {
    boolean hasRefAttr = false;
    Fetch fetch = new Fetch();
    for (Attribute attr : entityType.getAtomicAttributes()) {
      Fetch subFetch = createDefaultAttributeFetch(attr, languageCode);
      if (subFetch != null) {
        hasRefAttr = true;
      }
      fetch.field(attr.getName(), subFetch);
    }
    return hasRefAttr ? fetch : null;
  }
661221
private Object getReferencedEntity(int propertyIndex) {
		Object referencedEntity = null;

		GridType propertyType = persister.getGridPropertyTypes()[propertyIndex];
		Serializable id = (Serializable) propertyType.hydrate(
				resultset, persister.getPropertyColumnNames( propertyIndex ), session, null
		);

		if ( id != null ) {
			EntityPersister hostingEntityPersister = session.getFactory().getMetamodel().entityPersister(
					propertyType.getReturnedClass()
			);

			// OGM-931 Loading the entity through Session#get() to make sure it is fetched from the store if it is
			// detached atm. but also to benefit from 2L caching etc.
			Class<?> entityType = hostingEntityPersister.getMappedClass();
			referencedEntity = ( (Session) session ).get( entityType, id );

			// In case the entity is scheduled for deletion, obtain it from the PC
			if ( referencedEntity == null ) {
				referencedEntity = session.getPersistenceContext().getEntity(
					session.generateEntityKey( id, hostingEntityPersister )
				);
			}
		}

		return referencedEntity;
	}
1166316
function(properties) {
            this._super(properties);
            
            var entities = [];
            var entitiesByName = {};
            var entityPropertyList = properties.entry || [];
            for(var i = 0; i < entityPropertyList.length; i++) {
                var props = entityPropertyList[i];
                var entity = this.instantiateEntity(props);
                entity._load(props);
                entities.push(entity);
                
                if (entitiesByName.hasOwnProperty(entity.name)) {
                    entitiesByName[entity.name].push(entity);
                }
                else {
                    entitiesByName[entity.name] = [entity];
                }
            }
            this._entities       = entities;
            this._entitiesByName = entitiesByName;
            this._paging         = properties.paging    || {};
            this._links          = properties.links     || {};
            this._updated        = properties.updated   || null;
        }
934794
@PostMapping(
      value = "/{entityTypeId}/meta",
      params = "_method=GET",
      produces = APPLICATION_JSON_VALUE)
  public EntityTypeResponse retrieveEntityTypePost(
      @PathVariable("entityTypeId") String entityTypeId,
      @Valid @RequestBody EntityTypeRequest request) {
    Set<String> attributesSet = toAttributeSet(request != null ? request.getAttributes() : null);
    Map<String, Set<String>> attributeExpandSet =
        toExpandMap(request != null ? request.getExpand() : null);

    EntityType meta = dataService.getEntityType(entityTypeId);
    return new EntityTypeResponse(
        meta, attributesSet, attributeExpandSet, permissionService, dataService);
  }
82346
function _gpfDefineBuildTypedEntity (definition) {
    var EntityBuilder = _gpfDefineRead$TypedProperties(definition),
        entityDefinition;
    if (!EntityBuilder) {
        EntityBuilder = _gpfDefineCheck$TypeProperty(definition);
    }
    entityDefinition = new EntityBuilder(definition);
    entityDefinition.check();
    return entityDefinition;
}
1047601
public PropertyType<ConnectionFactoryResourceType<T>> getOrCreateProperty()
   {
      List<Node> nodeList = childNode.get("property");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new PropertyTypeImpl<ConnectionFactoryResourceType<T>>(this, "property", childNode, nodeList.get(0));
      }
      return createProperty();
   }
644103
public ApiResponse createEntity(Map<String, Object> properties) {
        assertValidApplicationId();
        if (isEmpty(properties.get("type"))) {
            throw new IllegalArgumentException("Missing entity type");
        }
        ApiResponse response = apiRequest(HttpMethod.POST, null, properties,
                organizationId, applicationId, properties.get("type").toString());
        return response;
    }
696552
Class<?> getAndSerializeEffectiveTypeIfRequired(Object value, Class<?> declaredType) throws IOException {
        Class<?> realType = value.getClass();
        Class<?> effectiveType = declaredType;
        if (declaredType == Object.class) {
            if (realType != String.class) {
                effectiveType = settings.getConverter().findTypedConverter(realType).getEffectiveType();
                output.writeMapHeader(1);
                String type = SerTypeMapper.encodeType(effectiveType, settings, basePackage, knownTypes);
                output.writeExtensionString(MsgPack.JODA_TYPE_DATA, type);
            } else {
                effectiveType = realType;
            }
        } else if (settings.getConverter().isConvertible(declaredType) == false) {
            effectiveType = settings.getConverter().findTypedConverter(realType).getEffectiveType();
            output.writeMapHeader(1);
            String type = SerTypeMapper.encodeType(effectiveType, settings, basePackage, knownTypes);
            output.writeExtensionString(MsgPack.JODA_TYPE_DATA, type);
        }
        return effectiveType;
    }
358424
public EntityType getRefEntity() {
    if (!hasRefEntity()) {
      throw new UnsupportedOperationException(
          String.format("getRefEntity not supported for attribute type '%s'", getDataType()));
    }
    return getEntity(REF_ENTITY_TYPE, EntityType.class);
  }
944525
@Deprecated
    public int getEntityTypeId(@NotNull final String entityType, final boolean allowCreate) {
        return getEntityTypeId(txnProvider, entityType, allowCreate);
    }
1093094
function _gpfDefineCheck$TypeProperty (definition) {
    var typedEntityBuilder = _gpfDefineTypedBuilders[definition.$type];
    if (undefined === typedEntityBuilder) {
        gpf.Error.invalidEntityType();
    }
    return typedEntityBuilder;
}
374993
private static String initCreateEntityQuery(EntityKeyMetadata entityKeyMetadata) {
		StringBuilder queryBuilder = new StringBuilder( "CREATE " );
		appendEntityNode( ENTITY_ALIAS, entityKeyMetadata, queryBuilder );
		queryBuilder.append( " RETURN " );
		queryBuilder.append( ENTITY_ALIAS );
		return queryBuilder.toString();
	}
1158769
function createEntityObject(e) {
		var obj = {id: e.id, className: e.constructor.name, children: []};
		if (e.children && e.children.length > 0) {
			e.children.forEach(function(c) {
				obj.children.push(createEntityObject(c));
			});
		}
		return obj;
	}
238602
public com.google.api.Property.PropertyType getType() {
    @SuppressWarnings("deprecation")
    com.google.api.Property.PropertyType result = com.google.api.Property.PropertyType.valueOf(type_);
    return result == null ? com.google.api.Property.PropertyType.UNRECOGNIZED : result;
  }
1078388
public static synchronized List getPropertyNames(String entityTypeName) {
        if (propertyNames != null) {
            return propertyNames;
        } else {
            {
                List names = new ArrayList();
                names.add(PROP_CN);
                names.add(PROP_MEMBERS);
                names.add(PROP_DISPLAY_NAME);
                names.add(PROP_DESCRIPTION);
                names.add(PROP_BUSINESS_CATEGORY);
                names.add(PROP_SEE_ALSO);
                if (extendedPropertiesDataType != null && extendedPropertiesDataType.keySet().size() > 0)
                    names.addAll(extendedPropertiesDataType.keySet());
                names.addAll(Party.getPropertyNames("Party"));
                propertyNames = Collections.unmodifiableList(names);
                return propertyNames;
            }
        }
    }