:type entity: IqProtocolEntity
7234
def processIqRegistry(self, entity):
        
        if entity.getTag() == "iq":
            iq_id = entity.getId()
            if iq_id in self.iqRegistry:
                originalIq, successClbk, errorClbk = self.iqRegistry[iq_id]
                del self.iqRegistry[iq_id]

                if entity.getType() == IqProtocolEntity.TYPE_RESULT and successClbk:
                    successClbk(entity, originalIq)
                elif entity.getType() == IqProtocolEntity.TYPE_ERROR and errorClbk:
                    errorClbk(entity, originalIq)
                return True

        return False
1036662
protected Entity getEntity(String path, Object content, Map<String,String> headers) {
        return Entity.Other;
    }
683749
@Override
    public EntityEnum getEntityType(IGroupMember entity) {
        if (entity == null) {
            throw new IllegalArgumentException("Parameter must not be null");
        }

        if (IEntityGroup.class.isAssignableFrom(entity.getClass())) {
            return EntityEnum.getEntityEnum(entity.getLeafType(), true);
        } else {
            return EntityEnum.getEntityEnum(entity.getLeafType(), false);
        }
    }
1360141
@Override
    public <X> EntityType<X> entity(Class<X> paramClass)
    {
        EntityType entityType = entityTypes.get(paramClass);
        if (entityType == null)
        {
            throw new IllegalArgumentException("Not an entity, {class:" + paramClass + "}");
        }
        return entityType;
    }
787216
def entity(ctx, debug, uncolorize, **kwargs):
    
    global PROVIDER_CONFIG

    if debug:
        log.basicConfig(level=log.DEBUG)
        log.getLogger("requests.packages.urllib3.connectionpool").setLevel(log.DEBUG)
    for (k, v) in kwargs.iteritems():
        if v:
            QUBELL[k] = v
    PROVIDER_CONFIG = {
        'configuration.provider': PROVIDER['provider_type'],
        'configuration.legacy-regions': PROVIDER['provider_region'],
        'configuration.endpoint-url': '',
        'configuration.legacy-security-group': '',
        'configuration.identity': PROVIDER['provider_identity'],
        'configuration.credential': PROVIDER['provider_credential']
    }

    class UserContext(object):
        def __init__(self):
            self.platform = None
            self.unauthenticated_platform = None
            self.colorize = not (uncolorize)

        def get_platform(self):
            if not self.platform:
                assert QUBELL["tenant"], "No platform URL provided. Set QUBELL_TENANT or use --tenant option."
                if not QUBELL["token"]:
                    assert QUBELL["user"], "No username. Set QUBELL_USER or use --user option."
                    assert QUBELL["password"], "No password provided. Set QUBELL_PASSWORD or use --password option."

                self.platform = QubellPlatform.connect(
                    tenant=QUBELL["tenant"],
                    user=QUBELL["user"],
                    password=QUBELL["password"],
                    token=QUBELL["token"])
            return self.platform

        def get_unauthenticated_platform(self):
            if not self.unauthenticated_platform:
                assert QUBELL["tenant"], "No platform URL provided. Set QUBELL_TENANT or use --tenant option."

                self.unauthenticated_platform = QubellPlatform.connect(tenant=QUBELL["tenant"])

            return self.unauthenticated_platform

    ctx = click.get_current_context()
    ctx.obj = UserContext()
666177
@PostMapping(
      value = "/{entityTypeId}/{id}",
      params = "_method=GET",
      produces = APPLICATION_JSON_VALUE)
  @ResponseBody
  public Map<String, Object> retrieveEntity(
      @PathVariable("entityTypeId") String entityTypeId,
      @PathVariable("id") String untypedId,
      @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);
    Object id = getTypedValue(untypedId, meta.getIdAttribute());
    Entity entity = dataService.findOneById(entityTypeId, id);

    if (entity == null) {
      throw new UnknownEntityException(meta, untypedId);
    }

    return getEntityAsMap(entity, meta, attributesSet, attributeExpandSet);
  }
63511
public Referenceable getEntity(final String entityType, final String attribute, final String value)
            throws AtlasServiceException {
        JSONObject jsonResponse = callAPIWithRetries(API.GET_ENTITY, null, new ResourceCreator() {
            @Override
            public WebResource createResource() {
                WebResource resource = getResource(API.GET_ENTITY);
                resource = resource.queryParam(TYPE, entityType);
                resource = resource.queryParam(ATTRIBUTE_NAME, attribute);
                resource = resource.queryParam(ATTRIBUTE_VALUE, value);
                return resource;
            }
        });
        try {
            String entityInstanceDefinition = jsonResponse.getString(AtlasClient.DEFINITION);
            return InstanceSerialization.fromJsonReferenceable(entityInstanceDefinition, true);
        } catch (JSONException e) {
            throw new AtlasServiceException(API.GET_ENTITY, e);
        }
    }
1114424
private Entity createEntityFromLdapEntry(Object parentDO, String propName, LdapEntry ldapEntry, List<String> propNames) throws WIMException {
        final String METHODNAME = "createEntityFromLdapEntry";

        String outEntityType = ldapEntry.getType();
        Entity outEntity = null;
        // For changed entities, when change type is delete, it is possible that
        // the type of entity (which maps to the LDAP entry's objectclass is not
        // available.
        if (outEntityType != null) {
            if (outEntityType.equalsIgnoreCase(SchemaConstants.DO_PERSON))
                outEntity = new Person();
            else if (outEntityType.equalsIgnoreCase(SchemaConstants.DO_PERSON_ACCOUNT))
                outEntity = new PersonAccount();
            else if (outEntityType.equalsIgnoreCase(SchemaConstants.DO_GROUP))
                outEntity = new Group();
            else
                outEntity = new Entity();
        } else {
            outEntity = new Entity();
        }

        if (parentDO instanceof Root) {
            if (SchemaConstants.DO_ENTITIES.equalsIgnoreCase(propName))
                ((Root) parentDO).getEntities().add(outEntity);
        } else if (parentDO instanceof Entity) {
            if (SchemaConstants.DO_GROUP.equalsIgnoreCase(propName)) {
                /*
                 * May get back plain entities if objectclass for group entity and
                 * group filters don't match up identically.
                 */
                if (outEntity instanceof Group) {
                    ((Entity) parentDO).getGroups().add((Group) outEntity);
                } else {
                    if (tc.isDebugEnabled()) {
                        Tr.debug(tc, METHODNAME + " Expected group entity. Group will excluded from group membership. Entity is " + outEntity, ldapEntry);
                    }
                }
            } else if (SchemaConstants.DO_MEMBERS.equalsIgnoreCase(propName)) {
                ((Group) parentDO).getMembers().add(outEntity);
            } else if (SchemaConstants.DO_CHILDREN.equalsIgnoreCase(propName)) {
                ((Entity) parentDO).getChildren().add(outEntity);
            }
        }

        IdentifierType outId = new IdentifierType();
        outEntity.setIdentifier(outId);
        outId.setUniqueName(ldapEntry.getUniqueName());
        outId.setExternalId(ldapEntry.getExtId());
        outId.setExternalName(ldapEntry.getDN());
        outId.setRepositoryId(reposId);

        String changeType = ldapEntry.getChangeType();
        if (changeType != null) {
            outEntity.setChangeType(changeType);
            if (SchemaConstants.CHANGETYPE_DELETE.equals(changeType) == false) {
                populateEntity(outEntity, propNames, ldapEntry.getAttributes());
            }
        } else {
            populateEntity(outEntity, propNames, ldapEntry.getAttributes());
        }
        return outEntity;
    }
1188672
@SuppressWarnings("unchecked")
    private <T extends IEntity> T retrieveEntity(IntuitMessage intuitMessage) {
        T returnEntity = null;
        IntuitResponse intuitResponse = (IntuitResponse) intuitMessage.getResponseElements().getResponse();
        if (intuitResponse != null) {
            JAXBElement<? extends IntuitEntity> intuitObject = intuitResponse.getIntuitObject();
            if (intuitObject != null) {
                returnEntity = ((T) intuitObject.getValue());
            }
        }
        return returnEntity;
    }
1242368
@Override
  public Entity toEntity() {
    Entity entity = toProtoEntity();
    entity.setProperty(JOB_INSTANCE_PROPERTY, jobInstanceKey);
    entity.setProperty(FINALIZE_BARRIER_PROPERTY, finalizeBarrierKey);
    entity.setProperty(RUN_BARRIER_PROPERTY, runBarrierKey);
    entity.setProperty(OUTPUT_SLOT_PROPERTY, outputSlotKey);
    entity.setProperty(STATE_PROPERTY, state.toString());
    if (null != exceptionHandlingAncestorKey) {
      entity.setProperty(EXCEPTION_HANDLING_ANCESTOR_KEY_PROPERTY, exceptionHandlingAncestorKey);
    }
    if (exceptionHandlerSpecified) {
      entity.setProperty(EXCEPTION_HANDLER_SPECIFIED_PROPERTY, Boolean.TRUE);
    }
    if (null != exceptionHandlerJobKey) {
      entity.setProperty(EXCEPTION_HANDLER_JOB_KEY_PROPERTY, exceptionHandlerJobKey);
    }
    if (null != exceptionKey) {
      entity.setProperty(EXCEPTION_KEY_PROPERTY, exceptionKey);
    }
    if (null != exceptionHandlerJobGraphGuid) {
      entity.setUnindexedProperty(
          EXCEPTION_HANDLER_JOB_GRAPH_GUID_PROPERTY, new Text(exceptionHandlerJobGraphGuid));
    }
    entity.setUnindexedProperty(CALL_EXCEPTION_HANDLER_PROPERTY, callExceptionHandler);
    entity.setUnindexedProperty(IGNORE_EXCEPTION_PROPERTY, ignoreException);
    if (childGraphGuid != null) {
      entity.setUnindexedProperty(CHILD_GRAPH_GUID_PROPERTY, new Text(childGraphGuid));
    }
    entity.setProperty(START_TIME_PROPERTY, startTime);
    entity.setUnindexedProperty(END_TIME_PROPERTY, endTime);
    entity.setProperty(CHILD_KEYS_PROPERTY, childKeys);
    entity.setUnindexedProperty(ATTEMPT_NUM_PROPERTY, attemptNumber);
    entity.setUnindexedProperty(MAX_ATTEMPTS_PROPERTY, maxAttempts);
    entity.setUnindexedProperty(BACKOFF_SECONDS_PROPERTY, backoffSeconds);
    entity.setUnindexedProperty(BACKOFF_FACTOR_PROPERTY, backoffFactor);
    entity.setUnindexedProperty(ON_BACKEND_PROPERTY, queueSettings.getOnBackend());
    entity.setUnindexedProperty(ON_MODULE_PROPERTY, queueSettings.getOnModule());
    entity.setUnindexedProperty(MODULE_VERSION_PROPERTY, queueSettings.getModuleVersion());
    entity.setUnindexedProperty(ON_QUEUE_PROPERTY, queueSettings.getOnQueue());
    entity.setUnindexedProperty(STATUS_CONSOLE_URL, statusConsoleUrl);
    if (rootJobDisplayName != null) {
      entity.setProperty(ROOT_JOB_DISPLAY_NAME, rootJobDisplayName);
    }
    return entity;
  }
1270260
private void generateEntity(M2MEntity entity) {
		entity.propertyPrimaryKey = TypeName.LONG;
		entity.propertyKey1 = findPrimaryKeyFieldType(entity.entity1Name.toString());
		entity.propertyKey2 = findPrimaryKeyFieldType(entity.entity2Name.toString());
		if (!entity.needToCreate) {
			return;
		}

		String tableName = entity.tableName;
		String entityClassName = entity.name;

		AnnotationProcessorUtilis.infoOnGeneratedClasses(BindDaoMany2Many.class, entity.getPackageName(),
				entityClassName);

		Converter<String, String> converterFK = CaseFormat.LOWER_CAMEL.converterTo(CaseFormat.UPPER_CAMEL);
		Converter<String, String> converterFieldName = CaseFormat.UPPER_CAMEL.converterTo(CaseFormat.LOWER_CAMEL);
		Converter<String, String> converterField2ColumnName = CaseFormat.LOWER_CAMEL
				.converterTo(CaseFormat.LOWER_UNDERSCORE);
		String fkPrefix = converterFK.convert(entity.idName);

		String fk1Name = converterField2ColumnName.convert(entity.entity1Name.simpleName() + fkPrefix);
		String fk2Name = converterField2ColumnName.convert(entity.entity2Name.simpleName() + fkPrefix);

		String field1Name = converterFieldName.convert(entity.entity1Name.simpleName() + fkPrefix);
		String field2Name = converterFieldName.convert(entity.entity2Name.simpleName() + fkPrefix);

		List<SQLProperty> properties = new ArrayList<SQLProperty>();

		// we define property type later
		{
			SQLProperty property = new SQLProperty(entity.idName, entity.getClassName(), entity.propertyPrimaryKey);
			property.columnType = ColumnType.PRIMARY_KEY;
			property.columnName = entity.idName;
			property.setNullable(false);
			property.setPrimaryKey(true);
			property.foreignParentClassName = null;
			properties.add(property);
		}

		{
			SQLProperty property = new SQLProperty(field1Name, entity.getClassName(), entity.propertyKey1);
			property.columnType = ColumnType.INDEXED;
			property.columnName = fk1Name;
			property.setNullable(false);
			property.setPrimaryKey(false);
			property.onDeleteAction = ForeignKeyAction.CASCADE;
			property.foreignParentClassName = entity.entity1Name.toString();
			properties.add(property);
		}

		{
			SQLProperty property = new SQLProperty(field2Name, entity.getClassName(), entity.propertyKey2);
			property.columnType = ColumnType.INDEXED;
			property.columnName = fk2Name;
			property.setNullable(false);
			property.setPrimaryKey(false);
			property.onDeleteAction = ForeignKeyAction.CASCADE;
			property.foreignParentClassName = entity.entity2Name.toString();
			properties.add(property);
		}

		// @formatter:off
		classBuilder = TypeSpec.classBuilder(entityClassName).addModifiers(Modifier.PUBLIC)
				.addAnnotation(AnnotationSpec.builder(BindSqlType.class).addMember("name", "$S", tableName).build());
		// @formatter:on

		if (entity.immutable) {
			// create constructor
			Builder constructorBuilder = MethodSpec.constructorBuilder().addModifiers(Modifier.PUBLIC);
			for (SQLProperty p : properties) {
				constructorBuilder
						.addParameter(ParameterSpec.builder(p.getPropertyType().getTypeName(), p.getName()).build());
				constructorBuilder.addStatement("this.$L=$L", p.getName(), p.getName());
			}
			classBuilder.addMethod(constructorBuilder.build());
		}

		Modifier fieldModifier = entity.immutable ? Modifier.PRIVATE : Modifier.PUBLIC;

		// javadoc for class
		classBuilder.addJavadoc("<p>");
		classBuilder.addJavadoc("\nGenerated entity implementation for <code>$L</code>\n", entity.name);
		classBuilder.addJavadoc("</p>\n");
		JavadocUtility.generateJavadocGeneratedBy(classBuilder);
		// classBuilder.addJavadoc(" @see $T\n",		

		{
			// @formatter:off
			FieldSpec fieldSpec = FieldSpec.builder(entity.propertyPrimaryKey, entity.idName, fieldModifier)
					.addJavadoc("Primary key\n")
					.addAnnotation(AnnotationSpec.builder(BindSqlColumn.class)
							.addMember("columnType", "$T.$L", ColumnType.class, ColumnType.PRIMARY_KEY).build())
					.build();
			// @formatter:on
			classBuilder.addField(fieldSpec);
		}

		{
			// @formatter:off
			FieldSpec fieldSpec = FieldSpec
					.builder(entity.propertyKey1, field1Name, fieldModifier)
					.addJavadoc("Foreign key to $T model class\n", entity.entity1Name)
					.addAnnotation(AnnotationSpec.builder(BindSqlColumn.class)
							.addMember(AnnotationAttributeType.PARENT_ENTITY.getValue(), "$T.class", entity.entity1Name)
							.addMember(AnnotationAttributeType.ON_DELETE.getValue(), "$T.$L", ForeignKeyAction.class,
									ForeignKeyAction.CASCADE)
							.build())
					.build();
			// @formatter:on
			classBuilder.addField(fieldSpec);
		}

		{
			// @formatter:off
			FieldSpec fieldSpec = FieldSpec
					.builder(entity.propertyKey2, field2Name, fieldModifier)
					.addJavadoc("Foreign key to $T model class\n", entity.entity2Name)
					.addAnnotation(AnnotationSpec.builder(BindSqlColumn.class)
							.addMember(AnnotationAttributeType.PARENT_ENTITY.getValue(), "$T.class", entity.entity2Name)
							.addMember(AnnotationAttributeType.ON_DELETE.getValue(), "$T.$L", ForeignKeyAction.class,
									ForeignKeyAction.CASCADE)
							.build())
					.build();
			// @formatter:on
			classBuilder.addField(fieldSpec);
		}

		if (entity.immutable) {
			// getters
			for (SQLProperty p : properties) {
				Builder methodBuilder = MethodSpec
						.methodBuilder("get" + CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, p.getName()))
						.returns(p.getPropertyType().getTypeName()).addStatement("return this.$L", p.getName())
						.addModifiers(Modifier.PUBLIC);

				classBuilder.addMethod(methodBuilder.build());
			}
		}

		TypeSpec typeSpec = classBuilder.build();

		try {
			JavaWriterHelper.writeJava2File(filer, entity.getPackageName(), typeSpec);
		} catch (IOException e) {
			throw new KriptonRuntimeException(e);
		}

		GeneratedTypeElement entityElement = new GeneratedTypeElement(entity.getPackageName(), classBuilder.build(),
				tableName, fk1Name + ", " + fk2Name);

		entityElement.properties = properties;

		entityResult.add(entityElement);
	}
978913
@Override
    public IEntity getEntity(String key, Class type) throws GroupsException {
        return getEntity(key, type, null);
    }
638397
@Override
    protected EntityDecl findEntity(String id, Object arg)
    {
        // Expand a Parameter Entity?
        if (arg == ENTITY_EXP_PE) { // for attribute default
            EntityDecl ed = (mPredefdPEs == null) ? null : mPredefdPEs.get(id);
            if (ed != null) { // Entity from int. subset...
                mUsesPredefdEntities = true;
                /* No need to further keep track of internal references,
                 * since this subset can not be cached, so let's just free
                 * up Map if it has been created
                 */
                mRefdPEs = null;
            } else if (mParamEntities != null) {
                ed = mParamEntities.get(id);
                if (ed != null) {
                    if (!mUsesPredefdEntities) {
                        // Let's also mark down the fact we referenced the entity:
                        Set<String> used = mRefdPEs;
                        if (used == null) {
                            mRefdPEs = used = new HashSet<String>();
                        }
                        used.add(id);
                    }
                }
            }
            return ed;
        }

        // Nope, General Entity (within attribute default value)?
        if (arg == ENTITY_EXP_GE) {
            /* This is only complicated for external subsets, since
             * they may 'inherit' entity definitions from preceding
             * internal subset...
             */
            EntityDecl ed = (mPredefdGEs == null) ? null : mPredefdGEs.get(id);
            if (ed != null) {
                mUsesPredefdEntities = true;
                /* No need to further keep track of references,
                 * as this means this subset is not cachable...
                 * so let's just free up Map if it has been created
                 */
                mRefdGEs = null;
            } else if (mGeneralEntities != null) {
                ed = mGeneralEntities.get(id);
                if (ed != null) {
                    // Ok, just need to mark reference, if we still care:
                    if (!mUsesPredefdEntities) {
                        // Let's also mark down the fact we referenced the entity:
                        if (mRefdGEs == null) {
                            mRefdGEs = new HashSet<String>();
                        }
                        mRefdGEs.add(id);
                    }
                }
            }
            return ed;
        }

        throw new IllegalStateException(ErrorConsts.ERR_INTERNAL);
    }
384827
public <A> Q from(Path<A> entity, Iterable<? extends A> col) {
        iterables.put(entity, col);
        getMetadata().addJoin(JoinType.DEFAULT, entity);
        return queryMixin.getSelf();
    }
729077
public void parseEmbeddable(final QEntityFactory entityFactory,
	                            final SessionFactoryImplementor sessionFactory,
	                            final String prefix,
	                            final EmbeddableType<?> type)
	{
		this.metamodelEmbeddable = type;
		// Make sure the entity factory sees this embeddable
		entityFactory.getEmbeddable(type.getJavaType(), type);

		for (Attribute<?, ?> attribute : type.getAttributes())
		{
			parseFields(entityFactory, sessionFactory, prefix, attribute);
		}
	}
724790
def handleEntity(self, entity):
        
        if entity is None: entity__o = None
        else: entity__o = entity._o
        libxml2mod.xmlHandleEntity(self._o, entity__o)
202032
def to_entity(entity_type, value, fields):
    
    e = entity_type(value)
    for k, v in fields.items():
        e.fields[k] = Field(k, v)
    return e