Create a new {@link GenericResponseBuilder} with an OK status and the given entity body and
media type.

@param entity the response entity
@param type the response entity media type
@return a new builder
553239
public static <T> GenericResponseBuilder<T> ok(T entity, String type) {
    return ok(entity).type(type);
  }
861166
public <K, T extends Persistable<K>>
    K create(
                    final Class<T> type,
                    final T object
                    )
    {
        K  p_id = _executeTx( "create", type, object,
                        new TransactionCallback<K>()
                        {
                            public K doInTransaction( final TransactionStatus status )
                            {
                                return getDao( type ).create( object );
                            }
                        }
        );

        return p_id;
    }
1053877
public ResponseBuilder initialize(final Resource resource) {

        if (MISSING_RESOURCE.equals(resource)) {
            throw new NotFoundException();
        } else if (DELETED_RESOURCE.equals(resource)) {
            throw new ClientErrorException(GONE);
        }

        LOGGER.debug("Acceptable media types: {}", getRequest().getAcceptableMediaTypes());

        this.syntax = getSyntax(getServices().getIOService(),
            getRequest().getAcceptableMediaTypes(), resource.getBinaryMetadata()
                .filter(b -> !DESCRIPTION.equals(getRequest().getExt()))
                .map(b -> b.getMimeType().orElse(APPLICATION_OCTET_STREAM)).orElse(null));

        if (ACL.equals(getRequest().getExt()) && !resource.hasAcl()) {
            throw new NotFoundException();
        }

        setResource(resource);
        return ok();
    }
563430
public <T extends ApiObject> EntityResponse<T> query(Request<T> request)
    {
        return executeRequest(request, objectMapper.getTypeFactory()
                .constructParametrizedType(EntityResponse.class, EntityResponse.class, request.getEntityType()));
    }
524540
public static <T> GenericResponseBuilder<T> ok(T entity) {
    return genericResponseBuilderFactory.create(Response.Status.OK.getStatusCode(), entity);
  }
382366
@Nonnull
	public static <T> LObjIntDblPredicateBuilder<T> objIntDblPredicate(Consumer<LObjIntDblPredicate<T>> consumer) {
		return new LObjIntDblPredicateBuilder(consumer);
	}
1140043
@Nonnull
	public static <T> LOiToCharFunctionBuilder<T> oiToCharFunction(Consumer<LOiToCharFunction<T>> consumer) {
		return new LOiToCharFunctionBuilder(consumer);
	}
1115697
protected <C extends CrudResponse, T extends CreateEntity> C handleInsertEntity(T entity) {
        Map<String, String> uriVariables = restUriVariablesFactory.getUriVariablesForEntityInsert(BullhornEntityInfo
                .getTypesRestEntityName(entity.getClass()));
        String url = restUrlFactory.assembleEntityUrlForInsert();

        CrudResponse response;

        try {
            String jsonString = restJsonConverter.convertEntityToJsonString(entity);
            response = this.performCustomRequest(url, jsonString, CreateResponse.class, uriVariables, HttpMethod.PUT, null);
        } catch (HttpStatusCodeException error) {
            response = restErrorHandler.handleHttpFourAndFiveHundredErrors(new CreateResponse(), error, entity.getId());
        }

        return (C) response;
    }
1006277
private void createResponse() {
        response = new GenericAnalyticsResponse(
            null,
            queryRowObservable.onBackpressureBuffer(),
            null,
            null,
            null,
            null,
            currentRequest,
            null,
            null,
            null
        );
    }
455462
public static <T extends ResourceId> Builder<T> newBuilder(Status status, T replacement) {
    return new Builder<T>().setStatus(status).setReplacement(replacement);
  }
892220
@Override
    public T create(T entity) {
        EntityManager entityManager = getEntityManager();
        entityManager.persist(entity);
        return entity;
    }
1020539
private QuestionnaireResponse createQuestionnaireResponse(EntityType entityType) {
    String entityTypeId = entityType.getId();

    QuestionnaireStatus status = NOT_STARTED;
    Questionnaire questionnaireEntity = questionnaireService.findQuestionnaireEntity(entityTypeId);
    if (questionnaireEntity != null) {
      status = questionnaireEntity.getStatus();
    }

    String lng = this.getLanguageCode();

    return QuestionnaireResponse.create(
        entityTypeId, entityType.getLabel(lng), entityType.getDescription(lng), status);
  }
1132041
public static <T> List<T> buildSQLResult(SQLRestResponse result,Class<T> type){
		if(result == null || result.getRows() == null || result.getRows().size() == 0)
			return null;
		if(result.getRows() != null && result.getRows().size() > 0) {
			List<Object[]> rows = result.getRows();
			List<T> datas = new ArrayList<T>(rows.size());
			ColumnMeta[] metas = result.getColumns();
			if (Map.class.isAssignableFrom(type)) {
				Map<String,Object> data = null;
				for(int i = 0; i < rows.size(); i ++) {
					Object[] row = rows.get(i);
					data = new HashMap<String,Object>(metas.length);
					for (int j = 0; j < metas.length; j++) {
						data.put(metas[j].getName(),row[j]);
					}
					datas.add((T)data);
				}

			} else {
				DateFormat defaultDateFormat = SerialUtil.getDateFormateMeta().toDateFormat();
				T valueObject = null;
				for(int i = 0; i < rows.size(); i ++) {
					Object[] row = rows.get(i);
					valueObject = buildObject(type,  metas,  row,defaultDateFormat);
					datas.add(valueObject);
				}
			}
			return datas;
		}
		else {
			return null;
		}

	}
765245
public static <T extends ResourceId> Builder<T> newBuilder(Status status) {
    return new Builder<T>().setStatus(status);
  }
436250
public static <T> GenericResponseBuilder<T> notModified(String tag) {
    return GenericResponses.<T>notModified().tag(tag);
  }
1163188
public static <T extends Entity> T asType(final Entity entity, final Class<T> type) {
	return getProxyFactory().proxyOfEntity(entity, type);
    }
773121
@Override
	public Response process(Response.ResponseBuilder responseBuilder)
	{
		final String entity = process();

		responseBuilder.entity(entity);

		return responseBuilder.build();
	}