///////////////////////////////////////////////////////////////////////////// Operations for entities. /////////////////////////////////////////////////////////////////////////////
960066
async function createEntity(projectId, entityTypeId, entityValue, synonyms) {
  // [START dialogflow_create_entity]
  // Imports the Dialogflow library
  const dialogflow = require('dialogflow');

  // Instantiates clients
  const entityTypesClient = new dialogflow.EntityTypesClient();

  // The path to the agent the created entity belongs to.
  const agentPath = entityTypesClient.entityTypePath(projectId, entityTypeId);

  const entity = {
    value: entityValue,
    synonyms: synonyms,
  };

  const createEntitiesRequest = {
    parent: agentPath,
    entities: [entity],
  };

  const [response] = await entityTypesClient.batchCreateEntities(
    createEntitiesRequest
  );
  console.log('Created entity type:');
  console.log(response);
  // [END dialogflow_create_entity]
}
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;
	}
817727
async function createSessionEntityType(
  projectId,
  sessionId,
  entityValues,
  entityTypeDisplayName,
  entityOverrideMode
) {
  // Imports the Dialogflow library
  const dialogflow = require('dialogflow');

  // Instantiates clients
  const sessionEntityTypesClient = new dialogflow.SessionEntityTypesClient();

  const sessionPath = sessionEntityTypesClient.sessionPath(
    projectId,
    sessionId
  );
  const sessionEntityTypePath = sessionEntityTypesClient.sessionEntityTypePath(
    projectId,
    sessionId,
    entityTypeDisplayName
  );

  // Here we use the entity value as the only synonym.
  const entities = [];
  entityValues.forEach(entityValue => {
    entities.push({
      value: entityValue,
      synonyms: [entityValue],
    });
  });

  const sessionEntityTypeRequest = {
    parent: sessionPath,
    sessionEntityType: {
      name: sessionEntityTypePath,
      entityOverrideMode: entityOverrideMode,
      entities: entities,
    },
  };

  const [response] = await sessionEntityTypesClient.createSessionEntityType(
    sessionEntityTypeRequest
  );
  console.log('SessionEntityType created:');
  console.log(response);
}
234263
function EntityMethods(models) {
      this.models = models;
      this.getByNameOrId = __bind(this.getByNameOrId, this);
      this.getByName = __bind(this.getByName, this);
      this.get = __bind(this.get, this);
      if (!this.models) {
        throw new Error("models parameter is required");
      }
    }
242215
@Override
    public EntityManager createEntityManager(Map arg0)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            Tr.debug(tc, "createEntityManager : " + this);
        throw new UnsupportedOperationException("This operation is not supported on a pooling EntityManagerFactory.");
    }
416007
private void parsePEReference() throws SAXException, IOException {
        String name;

        name = "%" + readNmtoken(true);
        require(';');
        switch (getEntityType(name)) {
            case ENTITY_UNDECLARED:
                // VC: Entity Declared
                handler.verror("reference to undeclared parameter entity "
                        + name);

                // we should disable handling of all subsequent declarations
                // unless this is a standalone document (info discarded)
                break;
            case ENTITY_INTERNAL:
                if (inLiteral) {
                    pushString(name, getEntityValue(name));
                } else {
                    pushString(name, ' ' + getEntityValue(name) + ' ');
                }
                break;
            case ENTITY_TEXT:
                if (!inLiteral) {
                    pushString(null, " ");
                }
                pushURL(true, name, getEntityIds(name), null, null, null, true);
                if (!inLiteral) {
                    pushString(null, " ");
                }
                break;
        }
    }
907245
@SuppressWarnings("unchecked")
    @Override
    public <T> T create(EntityCreateOperation<T> creator)
            throws ServiceException {
        creator.setProxyData(createProxyData());
        Object rawResponse = getResource(creator).post(
                creator.getResponseClass(), creator.getRequestContents());
        Object processedResponse = creator.processResponse(rawResponse);
        return (T) processedResponse;
    }
887295
private void handleSubEntity(EntityBuilder builder, Object obj, Field currentField, List<ReflectedInfo> fieldInfo)
            throws Siren4JException {

        Siren4JSubEntity subAnno = getSubEntityAnnotation(currentField, fieldInfo);
        if (subAnno != null) {
            if (isCollection(obj, currentField)) {
                Collection<?> coll = (Collection<?>) ReflectionUtils.getFieldValue(currentField, obj);
                if (coll != null) {
                    for (Object o : coll) {
                        builder.addSubEntity(toEntity(o, currentField, obj, fieldInfo));
                    }
                }
            } else {
                Object subObj = ReflectionUtils.getFieldValue(currentField, obj);
                if (subObj != null) {
                    builder.addSubEntity(toEntity(subObj, currentField, obj, fieldInfo));
                }
            }
        }

    }
1030949
@Override
  protected void updateEntity(DbEntityOperation operation) {

    final DbEntity dbEntity = operation.getEntity();

    String updateStatement = dbSqlSessionFactory.getUpdateStatement(dbEntity);
    ensureNotNull("no update statement for " + dbEntity.getClass() + " in the ibatis mapping files", "updateStatement", updateStatement);

    LOG.executeDatabaseOperation("UPDATE", dbEntity);

    if (Context.getProcessEngineConfiguration().isJdbcBatchProcessing()) {
      // execute update
      executeUpdate(updateStatement, dbEntity);
    } else {
      // execute update
      int numOfRowsUpdated = executeUpdate(updateStatement, dbEntity);

      if (dbEntity instanceof HasDbRevision) {
        if (numOfRowsUpdated != 1) {
          // failed with optimistic locking
          operation.setFailed(true);
          return;
        } else {
          // increment revision of our copy
          HasDbRevision versionedObject = (HasDbRevision) dbEntity;
          versionedObject.setRevision(versionedObject.getRevisionNext());
        }
      }
    }

    // perform post update action
    entityUpdated(dbEntity);
  }
77866
function processAuthResultForEntity(err, entity) {

        if(stopAll) return

        if(err && err.code !== ACL_ERROR_CODE) {
          stopAll = true
          callback(err, undefined)
        } else {

          if(entity) {
            filteredEntities.push(entity)
          }
          callbackCount ++
          if(callbackCount === entities.length) {
            callback(undefined, filteredEntities)
          }
        }
      }
804110
@Override
    protected List<Object> populateEntities(EntityMetadata entityMetadata, Client client)
    {
        /**
         * Multiple clause: like two columns with and cluase For multiple
         * andTranslate jpa clause into temp store based on clause if it is for
         * multiple data set. and fetch from there and then finally delete that
         * temp storage. Query translator will translate queries into key value
         */

        /**
         * Limitations: 1) Multiple AND/OR clause not possible 2) Only equal
         * clause possible with AND/OR clause.
         * 
         */

        Set<Object> results = new LinkedHashSet<Object>();

        ClientMetadata clientMetadata = ((ClientBase) client).getClientMetadata();

        if (!MetadataUtils.useSecondryIndex(clientMetadata)
                && !(clientMetadata.getIndexImplementor() != null && clientMetadata.getIndexImplementor().equals(
                        RedisIndexer.class.getName())))
        {
            results.addAll(populateUsingLucene(entityMetadata, client, null,
                    getColumns(getKunderaQuery().getResult(), entityMetadata)));
        }
        else
        {
            RedisQueryInterpreter interpreter = onTranslation(getKunderaQuery().getFilterClauseQueue(), entityMetadata);
            results.addAll((List<Object>) ((RedisClient) client).onExecuteQuery(interpreter,
                    entityMetadata.getEntityClazz()));
        }

        List<Object> output = new ArrayList<Object>();
        output.addAll(results);

        return output;
    }
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);
	}
1176942
public static void buildConstructors(Elements elementUtils, ModelClass<?> entity) {
		List<? extends Element> list = elementUtils.getAllMembers(entity.getElement());
		ExecutableElement constructor;
		List<List<Pair<String, TypeName>>> constructors = new ArrayList<>();

		// int i = 0;
		// AnnotationProcessorUtilis.printMessage((i++) + "**** " + entity.getName() + " BEGIN ****\n");

		for (Element item : list) {
			if (item.getKind() == ElementKind.CONSTRUCTOR && item.getModifiers().contains(Modifier.PUBLIC)) {
				constructor = (ExecutableElement) item;

				// AnnotationProcessorUtilis.printMessage((i++) + "Contructor(\n");

				ArrayList<Pair<String, TypeName>> params = new ArrayList<>();
				for (VariableElement p : constructor.getParameters()) {
					// AnnotationProcessorUtilis.printMessage(
					// (i++) + p.getSimpleName().toString() + " [" + TypeName.get(p.asType()) + "]\n");
					//
					params.add(new Pair<String, TypeName>(p.getSimpleName().toString(), TypeName.get(p.asType())));
				}

				// AnnotationProcessorUtilis.printMessage((i++) + ")\n\n");

				constructors.add(params);
			}

		}

		// check if it has an empty constructor;
		for (List<Pair<String, TypeName>> currentConstructor : constructors) {
			if (currentConstructor.size() == 0) {
				entity.emptyContructor = true;
			} else if (currentConstructor.size() == entity.getImmutableCollection().size()) {
				// check if it is a immutable constructor
				Map<String, ModelProperty> items = new HashMap<>();

				for (ModelProperty property : entity.getImmutableCollection()) {
					items.put(property.name, property);
				}

				// size is the same
				boolean immutableConstructor = true;
				for (Pair<String, TypeName> arg : currentConstructor) {
					ModelProperty temp = items.get(arg.value0);

					if (temp == null || !temp.isType(arg.value1)) {
						// property is not present
						immutableConstructor = false;
						break;
					}
				}
				if (immutableConstructor) {
					entity.immutableConstructors = currentConstructor;
				}
			}
		}

		// check for immutable constructor
		if (entity.immutableConstructors != null) {
			for (Pair<String, TypeName> currentConstructor : entity.immutableConstructors) {
				ModelProperty associatedProperty = entity.findImmutablePropertyByName(currentConstructor.value0);
				TypeName associatedType = currentConstructor.value1;

				AssertKripton.assertTrueOfInvalidConstructorProperty(
						associatedProperty == null || TypeUtility
								.isTypeEquals(associatedProperty.getPropertyType().getTypeName(), associatedType),
						entity, currentConstructor.value0);

			}
		}

		boolean allFieldWritable = true;
		// we have to check writeability only for valid properties (enabled)
		for (ModelProperty property : entity.collection) {
			allFieldWritable = allFieldWritable
					&& (property.isPublicField() || property.isFieldWithSetter());

		}
		entity.allPropertyWritable = allFieldWritable;

		// AnnotationProcessorUtilis.printMessage((i++) + "entity.emptyContructor=" + entity.emptyContructor + "\n");
		// AnnotationProcessorUtilis
		// .printMessage((i++) + "entity.immutableConstructors=" + entity.immutableConstructors + "\n");
		// AnnotationProcessorUtilis.printMessage((i++) + "entity.immutablePojo is " + entity.isImmutablePojo() + "\n");
		// AnnotationProcessorUtilis.printMessage((i++) + "entity.mutablePojo is " + entity.isMutablePojo() + "\n");

		// for (ModelProperty p: entity.getCollection()) {
		// AnnotationProcessorUtilis.printMessage(String.format((i++) + "property %s [%s] public=%s getter=%s is=%s setter=%s ", p.getName(), p.getPropertyType().typeName,
		// p.isFieldWithGetter(), p.isFieldWithGetter(), p.isFieldWithIs(), p.isFieldWithSetter()));
		// }

		AssertKripton.assertTrueOfInvalidConstructor(
				entity.emptyContructor == true || entity.immutableConstructors != null, entity);

		// if we have only emptyContructor, all property must be writable
		if (entity.emptyContructor == true && entity.immutableConstructors == null) {
			AssertKripton.assertTrueOfInvalidWritable(entity.allPropertyWritable, entity);
		}

		// AnnotationProcessorUtilis.printMessage((i++) + "**** " + entity.getName() + " END ****\n");
	}
459642
async function createEntityType(projectId, displayName, kind) {
  // [START dialogflow_create_entity_type]
  // Imports the Dialogflow library
  const dialogflow = require('dialogflow');

  // Instantiates clients
  const entityTypesClient = new dialogflow.EntityTypesClient();

  // The path to the agent the created entity type belongs to.
  const agentPath = entityTypesClient.projectAgentPath(projectId);

  const createEntityTypeRequest = {
    parent: agentPath,
    entityType: {
      displayName: displayName,
      kind: kind,
    },
  };

  const responses = await entityTypesClient.createEntityType(
    createEntityTypeRequest
  );
  console.log(`Created ${responses[0].name} entity type`);
  // [END dialogflow_create_entity_type]
}
178923
function createEntity(html, id) {
    let $ = parser.load(html)

    let trs = $('.tabproperty table tr').slice(2)

    let states = utils.tableParser(trs, {
        date: {
            idx: 1,
            mandatory: true,
            parser: e => moment.tz(e, "MM/DD/YYYY hh:mm a", zone).format()
        },
        country: {
            idx: 3,
            mandatory: true
        },
        area: {
            idx: 5,
            mandatory: true
        },
        state: {
            idx: 7,
            mandatory: true
        }
    }).map(line => {
        return {
            date: line.date,
            state: line.state,
            area: line.country + ' - ' + line.area
        }
    }).reverse()

    return new EntityInfo({
        id: id,
        states: states
    })
}
911518
@Override
	public void defineEntityReplacementText(String entity, String value) {
		if (processDocDecl) {
			throw new IllegalStateException("Entity replacement text may not be defined with DOCTYPE processing enabled.");
		}
		if (reader == null) {
			throw new IllegalStateException("Entity replacement text must be defined after setInput()");
		}
		if (documentEntities == null) {
			documentEntities = new HashMap<String, char[]>();
		}
		documentEntities.put(entity, value.toCharArray());
	}
334065
private ResourceXMLParser.Entity createEntity(final INodeEntry node) {
        final ResourceXMLParser.Entity ent = new ResourceXMLParser.Entity();
        ent.setName(node.getNodename());
        ent.setResourceType(NODE_ENTITY_TAG);
        

        if(null!=node.getAttributes()){
            for (final String setName : node.getAttributes().keySet()) {
                String value = node.getAttributes().get(setName);
                ent.setProperty(setName, value);
            }
        }
        if(null!=node.getTags()){
            ent.setProperty("tags", joinStrings(node.getTags(), ", "));
        }



        return ent;
    }