Takes a BullhornEntity and converts it to a String in json format.

@param entity
a BullhornEntity
@return the jsonString
358656
public <T extends BullhornEntity> String convertEntityToJsonString(T entity) {
        String jsonString = "";
        try {
            jsonString = objectMapperStandard.writeValueAsString(entity);
        } catch (JsonProcessingException e) {
            log.error("Error deserializing entity of type" + entity.getClass() + " to jsonString.", e);
        }
        return jsonString;
    }
35428
@Override
    public String toJSONString() {
        JSONStringer js = new JSONStringer();
        try {

            js.object();

            // status code (1 byte)
            js.keySymbolValuePair(JSON_STATUS_KEY, getStatusCode());

            // column schema
            js.key(JSON_SCHEMA_KEY).array();
            for (int i = 0; i < getColumnCount(); i++) {
                js.object();
                js.keySymbolValuePair(JSON_NAME_KEY, getColumnName(i));
                js.keySymbolValuePair(JSON_TYPE_KEY, getColumnType(i).getValue());
                js.endObject();
            }
            js.endArray();

            // row data
            js.key(JSON_DATA_KEY).array();
            VoltTableRow row = cloneRow();
            row.resetRowPosition();
            while (row.advanceRow()) {
                js.array();
                for (int i = 0; i < getColumnCount(); i++) {
                    row.putJSONRep(i, js);
                }
                js.endArray();
            }
            js.endArray();

            js.endObject();
        }
        catch (JSONException e) {
            e.printStackTrace();
            throw new RuntimeException("Failed to serialized a table to JSON.", e);
        }
        return js.toString();
    }
496599
public final String createEntityDeclaration()
        throws UnsupportedEncodingException {
        StringBuffer buffer = new StringBuffer();
        buffer.append("<!DOCTYPE padawan [\n");

        for (int i = 0; i < entity.length; i++) {
            buffer.append(
                "<!ENTITY " + entity[i][1] + " '" + entity[i][0] + "' >\n"
            );
        }

        buffer.append("]>\n");

        return buffer.toString();
    }
243038
public static String generateEntityQualifiedName(SQLiteDaoDefinition dao, SQLiteEntity entity) {
		String entityName;
		if (entity == null) {
			M2MEntity m2mEntity = M2MEntity.extractEntityManagedByDAO(dao.getElement());
			entityName = m2mEntity.getQualifiedName();
		} else {
			entityName = entity.getName().toString();
		}
		return entityName;
	}
233745
private String toJSONString() {
        JSONStringer js = new JSONStringer();
        try {
            js.object();
            for (Map.Entry<Integer, Integer> entry : m_tokensMap.get().entrySet()) {
                js.key(entry.getKey().toString()).value(entry.getValue());
            }
            js.endObject();
        } catch (JSONException e) {
            throw new RuntimeException("Failed to serialize Hashinator Configuration to JSON.", e);
        }
        return js.toString();
    }
1080278
public static String jsonToString(JsonNode node) {
        try {
            return node == null ? null : MAPPER.writeValueAsString(node);
        } catch (JsonProcessingException e) {
            throw new SdkClientException("Could not serialize JSON", e);
        }
    }
963036
protected List<String> createEntity(JSONArray entities) throws AtlasServiceException {
        LOG.debug("Creating entities: {}", entities);
        JSONObject response = callAPIWithBody(API.CREATE_ENTITY, entities.toString());
        List<String> results = extractEntityResult(response).getCreatedEntities();
        LOG.debug("Create entities returned results: {}", results);
        return results;
    }
1352099
public static String getStringFromJSONPath(JSONObject record, String path) {
        final Object object = getObjectFromJSONPath(record, path);
        return object == null ? null : object.toString();
    }
870611
@Override
    public Long get(Entity entity) {
        Objects.requireNonNull(entity, "entity cannot be null");
        // return id()
        return entity.id();
    }
810283
static Object getEntityFromJson(Class<?> entityClass, EntityMetadata m, JsonObject jsonObj, List<String> relations,
            final KunderaMetadata kunderaMetadata)
    {// Entity object
        Object entity = null;

        // Map to hold property-name=>foreign-entity relations
        try
        {
            entity = KunderaCoreUtils.createNewInstance(entityClass);

            // Populate primary key column
            JsonElement rowKey = jsonObj.get(((AbstractAttribute) m.getIdAttribute()).getJPAColumnName());
            if (rowKey == null)
            {
                return null;
            }
            Class<?> idClass = null;
            MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
                    m.getPersistenceUnit());
            Map<String, Object> relationValue = null;
            idClass = m.getIdAttribute().getJavaType();
            if (metaModel.isEmbeddable(m.getIdAttribute().getBindableJavaType()))
            {
                Class javaType = m.getIdAttribute().getBindableJavaType();
                PropertyAccessorHelper.setId(
                        entity,
                        m,
                        getObjectFromJson(rowKey.getAsJsonObject(), javaType, metaModel.embeddable(javaType)
                                .getAttributes()));
            }
            else
            {
                PropertyAccessorHelper.setId(entity, m,
                        PropertyAccessorHelper.fromSourceToTargetClass(idClass, String.class, rowKey.getAsString()));
            }

            EntityType entityType = metaModel.entity(entityClass);

            String discriminatorColumn = ((AbstractManagedType) entityType).getDiscriminatorColumn();

            Set<Attribute> columns = entityType.getAttributes();

            for (Attribute column : columns)
            {
                JsonElement value = jsonObj.get(((AbstractAttribute) column).getJPAColumnName());
                if (!column.equals(m.getIdAttribute())
                        && !((AbstractAttribute) column).getJPAColumnName().equals(discriminatorColumn)
                        && value != null && !value.equals(JsonNull.INSTANCE))
                {
                    String fieldName = ((AbstractAttribute) column).getJPAColumnName();

                    Class javaType = ((AbstractAttribute) column).getBindableJavaType();
                    if (metaModel.isEmbeddable(javaType))
                    {
                        onViaEmbeddable(entityType, column, m, entity, metaModel.embeddable(javaType), jsonObj);
                    }
                    else if (!column.isAssociation())
                    {
                        setFieldValue(entity, column, value);
                    }
                    else if (relations != null)
                    {
                        if (relationValue == null)
                        {
                            relationValue = new HashMap<String, Object>();
                        }

                        if (relations.contains(fieldName)
                                && !fieldName.equals(((AbstractAttribute) m.getIdAttribute()).getJPAColumnName()))
                        {
                            JsonElement colValue = jsonObj.get(((AbstractAttribute) column).getJPAColumnName());
                            if (colValue != null)
                            {
                                String colFieldName = m.getFieldName(fieldName);
                                Attribute attribute = entityType.getAttribute(colFieldName);
                                EntityMetadata relationMetadata = KunderaMetadataManager.getEntityMetadata(
                                        kunderaMetadata, attribute.getJavaType());
                                Object colVal = PropertyAccessorHelper.fromSourceToTargetClass(relationMetadata
                                        .getIdAttribute().getJavaType(), String.class, colValue.getAsString());
                                relationValue.put(fieldName, colVal);
                            }
                        }
                    }
                }
            }
            if (relationValue != null && !relationValue.isEmpty())
            {
                EnhanceEntity e = new EnhanceEntity(entity, PropertyAccessorHelper.getId(entity, m), relationValue);
                return e;
            }
            else
            {
                return entity;
            }
        }
        catch (Exception e)
        {
            log.error("Error while extracting entity object from json, caused by {}.", e);
            throw new KunderaException(e);
        }
    }
533285
public static String getString(JSONValue value) {
        if (value == null)
            return null;
        if (!(value instanceof JSONString))
            throw new JSONException(NOT_A_STRING);
        return ((JSONString)value).toString();
    }
1158074
public static String getName(ObjectMeta entity) {
    if (entity != null) {
      return Utils.coalesce(entity.getName(),
        getAdditionalPropertyText(entity.getAdditionalProperties(), "id"),
        entity.getUid());
    } else {
      return null;
    }
  }
779258
@VisibleForTesting
	static String doExtractResponse(int statusCode, HttpEntity entity) {
		String message = null;

		if (entity != null) {
			try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
				entity.writeTo(baos);
				message = baos.toString("UTF-8");
			}
			catch (IOException ex) {
				throw new SystemException(ex);
			}
		}

		//if the response is in the 400 range, use IllegalArgumentException, which currently translates to a 400 error
		if (statusCode>= HttpStatus.SC_BAD_REQUEST && statusCode < HttpStatus.SC_INTERNAL_SERVER_ERROR) {
			throw new IllegalArgumentException("Status code: " + statusCode + " .  Error occurred. " +  message);
		}
		//everything else that's not in the 200 range, use SystemException, which translates to a 500 error.
		if ((statusCode < HttpStatus.SC_OK) || (statusCode >= HttpStatus.SC_MULTIPLE_CHOICES)) {
			throw new SystemException("Status code: " + statusCode + " .  Error occurred. " +  message);
		} else {
			return message;
		}
	}
152810
protected function entityToString($entity)
    {
        return method_exists($entity, '__toString') ? (string) $entity : get_class($entity) . '@' . spl_object_hash($entity);
    }
1086679
public Object getId(final Object entity) {
        Object unwrapped = entity;
        if (unwrapped == null) {
            return null;
        }
        unwrapped = ProxyHelper.unwrap(unwrapped);
        try {
            final MappedClass mappedClass = getMappedClass(unwrapped.getClass());
            if (mappedClass != null) {
                final Field idField = mappedClass.getIdField();
                if (idField != null) {
                    return idField.get(unwrapped);
                }
            }
        } catch (Exception e) {
            LOG.error(e.getMessage(), e);
        }
        return null;
    }
583714
public @Nullable String jsFunction_stringEntity() throws IOException {
		HttpCoreHelper httpHelper = new HttpCoreHelper();
		if (httpHelper.hasEntity(req)) {
			HttpEntity entity = ((HttpEntityEnclosingRequest)req).getEntity();
			return IO.readAndCloseUtf8(entity.getContent());
		} else {
			return null;
		}
	}
986853
public String toJSON() {

        StringBuffer result = new StringBuffer();
        result.append("{\n");
        for (Entry<String, List<String>> simpleEntry : m_simpleAttributes.entrySet()) {
            result.append("\"").append(simpleEntry.getKey()).append("\"").append(": [\n");
            boolean firstValue = true;
            for (String value : simpleEntry.getValue()) {
                if (firstValue) {
                    firstValue = false;
                } else {
                    result.append(",\n");
                }
                result.append("\"").append(value).append("\"");
            }
            result.append("],\n");
        }
        for (Entry<String, List<CmsEntity>> entityEntry : m_entityAttributes.entrySet()) {
            result.append("\"").append(entityEntry.getKey()).append("\"").append(": [\n");
            boolean firstValue = true;
            for (CmsEntity value : entityEntry.getValue()) {
                if (firstValue) {
                    firstValue = false;
                } else {
                    result.append(",\n");
                }
                result.append(value.toJSON());
            }
            result.append("],\n");
        }
        result.append("\"id\": \"").append(m_id).append("\"");
        result.append("}");
        return result.toString();
    }