Skip to content

Commit

Permalink
LPS-122380 | LPS-105491 Regen
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaprax authored and brianchandotcom committed Oct 26, 2020
1 parent 063f24e commit e069efe
Show file tree
Hide file tree
Showing 15 changed files with 1,366 additions and 10 deletions.
Expand Up @@ -39,6 +39,8 @@

import javax.annotation.Generated;

import javax.validation.Valid;

import javax.xml.bind.annotation.XmlRootElement;

/**
Expand Down Expand Up @@ -111,6 +113,34 @@ public void setContent(
@JsonProperty(access = JsonProperty.Access.READ_WRITE)
protected String content;

@Schema
public Date getDateCreated() {
return dateCreated;
}

public void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}

@JsonIgnore
public void setDateCreated(
UnsafeSupplier<Date, Exception> dateCreatedUnsafeSupplier) {

try {
dateCreated = dateCreatedUnsafeSupplier.get();
}
catch (RuntimeException re) {
throw re;
}
catch (Exception e) {
throw new RuntimeException(e);
}
}

@GraphQLField
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
protected Date dateCreated;

@Schema
public Date getDateModified() {
return dateModified;
Expand Down Expand Up @@ -221,6 +251,36 @@ public void setTitle(
@JsonProperty(access = JsonProperty.Access.READ_WRITE)
protected String title;

@Schema
@Valid
public Map<String, String> getTitle_i18n() {
return title_i18n;
}

public void setTitle_i18n(Map<String, String> title_i18n) {
this.title_i18n = title_i18n;
}

@JsonIgnore
public void setTitle_i18n(
UnsafeSupplier<Map<String, String>, Exception>
title_i18nUnsafeSupplier) {

try {
title_i18n = title_i18nUnsafeSupplier.get();
}
catch (RuntimeException re) {
throw re;
}
catch (Exception e) {
throw new RuntimeException(e);
}
}

@GraphQLField
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
protected Map<String, String> title_i18n;

@Schema
public String getVersion() {
return version;
Expand Down Expand Up @@ -303,6 +363,20 @@ public String toString() {
sb.append("\"");
}

if (dateCreated != null) {
if (sb.length() > 1) {
sb.append(", ");
}

sb.append("\"dateCreated\": ");

sb.append("\"");

sb.append(liferayToJSONDateFormat.format(dateCreated));

sb.append("\"");
}

if (dateModified != null) {
if (sb.length() > 1) {
sb.append(", ");
Expand Down Expand Up @@ -359,6 +433,16 @@ public String toString() {
sb.append("\"");
}

if (title_i18n != null) {
if (sb.length() > 1) {
sb.append(", ");
}

sb.append("\"title_i18n\": ");

sb.append(_toJSON(title_i18n));
}

if (version != null) {
if (sb.length() > 1) {
sb.append(", ");
Expand Down
Expand Up @@ -49,7 +49,7 @@ public static Builder builder() {
}

public Page<WorkflowDefinition> getWorkflowDefinitionsPage(
Pagination pagination)
Boolean active, Pagination pagination)
throws Exception;

public WorkflowDefinition getWorkflowDefinitionByName(String name)
Expand Down
Expand Up @@ -20,6 +20,7 @@
import java.io.Serializable;

import java.util.Date;
import java.util.Map;
import java.util.Objects;

import javax.annotation.Generated;
Expand Down Expand Up @@ -77,6 +78,27 @@ public void setContent(

protected String content;

public Date getDateCreated() {
return dateCreated;
}

public void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}

public void setDateCreated(
UnsafeSupplier<Date, Exception> dateCreatedUnsafeSupplier) {

try {
dateCreated = dateCreatedUnsafeSupplier.get();
}
catch (Exception e) {
throw new RuntimeException(e);
}
}

protected Date dateCreated;

public Date getDateModified() {
return dateModified;
}
Expand Down Expand Up @@ -159,6 +181,28 @@ public void setTitle(

protected String title;

public Map<String, String> getTitle_i18n() {
return title_i18n;
}

public void setTitle_i18n(Map<String, String> title_i18n) {
this.title_i18n = title_i18n;
}

public void setTitle_i18n(
UnsafeSupplier<Map<String, String>, Exception>
title_i18nUnsafeSupplier) {

try {
title_i18n = title_i18nUnsafeSupplier.get();
}
catch (Exception e) {
throw new RuntimeException(e);
}
}

protected Map<String, String> title_i18n;

public String getVersion() {
return version;
}
Expand Down
Expand Up @@ -41,11 +41,11 @@ public static Builder builder() {
}

public Page<WorkflowDefinition> getWorkflowDefinitionsPage(
Pagination pagination)
Boolean active, Pagination pagination)
throws Exception;

public HttpInvoker.HttpResponse getWorkflowDefinitionsPageHttpResponse(
Pagination pagination)
Boolean active, Pagination pagination)
throws Exception;

public WorkflowDefinition getWorkflowDefinitionByName(String name)
Expand Down Expand Up @@ -145,11 +145,11 @@ public static class WorkflowDefinitionResourceImpl
implements WorkflowDefinitionResource {

public Page<WorkflowDefinition> getWorkflowDefinitionsPage(
Pagination pagination)
Boolean active, Pagination pagination)
throws Exception {

HttpInvoker.HttpResponse httpResponse =
getWorkflowDefinitionsPageHttpResponse(pagination);
getWorkflowDefinitionsPageHttpResponse(active, pagination);

String content = httpResponse.getContent();

Expand All @@ -172,7 +172,7 @@ public Page<WorkflowDefinition> getWorkflowDefinitionsPage(
}

public HttpInvoker.HttpResponse getWorkflowDefinitionsPageHttpResponse(
Pagination pagination)
Boolean active, Pagination pagination)
throws Exception {

HttpInvoker httpInvoker = HttpInvoker.newHttpInvoker();
Expand All @@ -196,6 +196,10 @@ public HttpInvoker.HttpResponse getWorkflowDefinitionsPageHttpResponse(

httpInvoker.httpMethod(HttpInvoker.HttpMethod.GET);

if (active != null) {
httpInvoker.parameter("active", String.valueOf(active));
}

if (pagination != null) {
httpInvoker.parameter(
"page", String.valueOf(pagination.getPage()));
Expand Down
Expand Up @@ -85,6 +85,22 @@ public static String toJSON(WorkflowDefinition workflowDefinition) {
sb.append("\"");
}

if (workflowDefinition.getDateCreated() != null) {
if (sb.length() > 1) {
sb.append(", ");
}

sb.append("\"dateCreated\": ");

sb.append("\"");

sb.append(
liferayToJSONDateFormat.format(
workflowDefinition.getDateCreated()));

sb.append("\"");
}

if (workflowDefinition.getDateModified() != null) {
if (sb.length() > 1) {
sb.append(", ");
Expand Down Expand Up @@ -143,6 +159,16 @@ public static String toJSON(WorkflowDefinition workflowDefinition) {
sb.append("\"");
}

if (workflowDefinition.getTitle_i18n() != null) {
if (sb.length() > 1) {
sb.append(", ");
}

sb.append("\"title_i18n\": ");

sb.append(_toJSON(workflowDefinition.getTitle_i18n()));
}

if (workflowDefinition.getVersion() != null) {
if (sb.length() > 1) {
sb.append(", ");
Expand Down Expand Up @@ -195,6 +221,16 @@ public static Map<String, String> toMap(
map.put("content", String.valueOf(workflowDefinition.getContent()));
}

if (workflowDefinition.getDateCreated() == null) {
map.put("dateCreated", null);
}
else {
map.put(
"dateCreated",
liferayToJSONDateFormat.format(
workflowDefinition.getDateCreated()));
}

if (workflowDefinition.getDateModified() == null) {
map.put("dateModified", null);
}
Expand Down Expand Up @@ -228,6 +264,15 @@ public static Map<String, String> toMap(
map.put("title", String.valueOf(workflowDefinition.getTitle()));
}

if (workflowDefinition.getTitle_i18n() == null) {
map.put("title_i18n", null);
}
else {
map.put(
"title_i18n",
String.valueOf(workflowDefinition.getTitle_i18n()));
}

if (workflowDefinition.getVersion() == null) {
map.put("version", null);
}
Expand Down Expand Up @@ -266,6 +311,12 @@ else if (Objects.equals(jsonParserFieldName, "content")) {
workflowDefinition.setContent((String)jsonParserFieldValue);
}
}
else if (Objects.equals(jsonParserFieldName, "dateCreated")) {
if (jsonParserFieldValue != null) {
workflowDefinition.setDateCreated(
toDate((String)jsonParserFieldValue));
}
}
else if (Objects.equals(jsonParserFieldName, "dateModified")) {
if (jsonParserFieldValue != null) {
workflowDefinition.setDateModified(
Expand All @@ -288,6 +339,13 @@ else if (Objects.equals(jsonParserFieldName, "title")) {
workflowDefinition.setTitle((String)jsonParserFieldValue);
}
}
else if (Objects.equals(jsonParserFieldName, "title_i18n")) {
if (jsonParserFieldValue != null) {
workflowDefinition.setTitle_i18n(
(Map)WorkflowDefinitionSerDes.toMap(
(String)jsonParserFieldValue));
}
}
else if (Objects.equals(jsonParserFieldName, "version")) {
if (jsonParserFieldValue != null) {
workflowDefinition.setVersion((String)jsonParserFieldValue);
Expand Down
Expand Up @@ -170,10 +170,11 @@ public TransitionPage workflowTaskNextTransitions(
/**
* Invoke this method with the command line:
*
* curl -H 'Content-Type: text/plain; charset=utf-8' -X 'POST' 'http://localhost:8080/o/graphql' -d $'{"query": "query {workflowDefinitions(page: ___, pageSize: ___){items {__}, page, pageSize, totalCount}}"}' -u 'test@liferay.com:test'
* curl -H 'Content-Type: text/plain; charset=utf-8' -X 'POST' 'http://localhost:8080/o/graphql' -d $'{"query": "query {workflowDefinitions(active: ___, page: ___, pageSize: ___){items {__}, page, pageSize, totalCount}}"}' -u 'test@liferay.com:test'
*/
@GraphQLField
public WorkflowDefinitionPage workflowDefinitions(
@GraphQLName("active") Boolean active,
@GraphQLName("pageSize") int pageSize,
@GraphQLName("page") int page)
throws Exception {
Expand All @@ -183,13 +184,13 @@ public WorkflowDefinitionPage workflowDefinitions(
this::_populateResourceContext,
workflowDefinitionResource -> new WorkflowDefinitionPage(
workflowDefinitionResource.getWorkflowDefinitionsPage(
Pagination.of(page, pageSize))));
active, Pagination.of(page, pageSize))));
}

/**
* Invoke this method with the command line:
*
* curl -H 'Content-Type: text/plain; charset=utf-8' -X 'POST' 'http://localhost:8080/o/graphql' -d $'{"query": "query {workflowDefinitionByName(name: ___){active, content, dateModified, description, name, title, version}}"}' -u 'test@liferay.com:test'
* curl -H 'Content-Type: text/plain; charset=utf-8' -X 'POST' 'http://localhost:8080/o/graphql' -d $'{"query": "query {workflowDefinitionByName(name: ___){active, content, dateCreated, dateModified, description, name, title, title_i18n, version}}"}' -u 'test@liferay.com:test'
*/
@GraphQLField
public WorkflowDefinition workflowDefinitionByName(
Expand Down
Expand Up @@ -75,6 +75,7 @@ public abstract class BaseWorkflowDefinitionResourceImpl
@GET
@Parameters(
value = {
@Parameter(in = ParameterIn.QUERY, name = "active"),
@Parameter(in = ParameterIn.QUERY, name = "page"),
@Parameter(in = ParameterIn.QUERY, name = "pageSize")
}
Expand All @@ -83,6 +84,7 @@ public abstract class BaseWorkflowDefinitionResourceImpl
@Produces({"application/json", "application/xml"})
@Tags(value = {@Tag(name = "WorkflowDefinition")})
public Page<WorkflowDefinition> getWorkflowDefinitionsPage(
@Parameter(hidden = true) @QueryParam("active") Boolean active,
@Context Pagination pagination)
throws Exception {

Expand Down

0 comments on commit e069efe

Please sign in to comment.