Skip to content

Commit

Permalink
LPD-48103 Regen REST module
Browse files Browse the repository at this point in the history
  • Loading branch information
alessiorendina committed Feb 28, 2025
1 parent 68fb790 commit 5897d28
Show file tree
Hide file tree
Showing 11 changed files with 266 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,47 @@ public void setValue(
@JsonIgnore
private Supplier<Map<String, String>> _valueSupplier;

@Schema(example = "true")
public Boolean getVisible() {
if (_visibleSupplier != null) {
visible = _visibleSupplier.get();

_visibleSupplier = null;
}

return visible;
}

public void setVisible(Boolean visible) {
this.visible = visible;

_visibleSupplier = null;
}

@JsonIgnore
public void setVisible(
UnsafeSupplier<Boolean, Exception> visibleUnsafeSupplier) {

_visibleSupplier = () -> {
try {
return visibleUnsafeSupplier.get();
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new RuntimeException(exception);
}
};
}

@GraphQLField
@JsonProperty(access = JsonProperty.Access.READ_WRITE)
protected Boolean visible;

@JsonIgnore
private Supplier<Boolean> _visibleSupplier;

@Override
public boolean equals(Object object) {
if (this == object) {
Expand Down Expand Up @@ -809,6 +850,18 @@ public String toString() {
sb.append(_toJSON(value));
}

Boolean visible = getVisible();

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

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

sb.append(visible);
}

sb.append("}");

return sb.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,47 @@ public void setTitle(
@JsonIgnore
private Supplier<Map<String, String>> _titleSupplier;

@Schema(example = "true")
public Boolean getVisible() {
if (_visibleSupplier != null) {
visible = _visibleSupplier.get();

_visibleSupplier = null;
}

return visible;
}

public void setVisible(Boolean visible) {
this.visible = visible;

_visibleSupplier = null;
}

@JsonIgnore
public void setVisible(
UnsafeSupplier<Boolean, Exception> visibleUnsafeSupplier) {

_visibleSupplier = () -> {
try {
return visibleUnsafeSupplier.get();
}
catch (RuntimeException runtimeException) {
throw runtimeException;
}
catch (Exception exception) {
throw new RuntimeException(exception);
}
};
}

@GraphQLField
@JsonProperty(access = JsonProperty.Access.READ_WRITE)
protected Boolean visible;

@JsonIgnore
private Supplier<Boolean> _visibleSupplier;

@Override
public boolean equals(Object object) {
if (this == object) {
Expand Down Expand Up @@ -635,6 +676,18 @@ public String toString() {
sb.append(_toJSON(title));
}

Boolean visible = getVisible();

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

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

sb.append(visible);
}

sb.append("}");

return sb.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,27 @@ public void setValue(

protected Map<String, String> value;

public Boolean getVisible() {
return visible;
}

public void setVisible(Boolean visible) {
this.visible = visible;
}

public void setVisible(
UnsafeSupplier<Boolean, Exception> visibleUnsafeSupplier) {

try {
visible = visibleUnsafeSupplier.get();
}
catch (Exception e) {
throw new RuntimeException(e);
}
}

protected Boolean visible;

@Override
public ProductSpecification clone() throws CloneNotSupportedException {
return (ProductSpecification)super.clone();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,27 @@ public void setTitle(

protected Map<String, String> title;

public Boolean getVisible() {
return visible;
}

public void setVisible(Boolean visible) {
this.visible = visible;
}

public void setVisible(
UnsafeSupplier<Boolean, Exception> visibleUnsafeSupplier) {

try {
visible = visibleUnsafeSupplier.get();
}
catch (Exception e) {
throw new RuntimeException(e);
}
}

protected Boolean visible;

@Override
public Specification clone() throws CloneNotSupportedException {
return (Specification)super.clone();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,16 @@ public static String toJSON(ProductSpecification productSpecification) {
sb.append(_toJSON(productSpecification.getValue()));
}

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

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

sb.append(productSpecification.getVisible());
}

sb.append("}");

return sb.toString();
Expand Down Expand Up @@ -345,6 +355,14 @@ public static Map<String, String> toMap(
map.put("value", String.valueOf(productSpecification.getValue()));
}

if (productSpecification.getVisible() == null) {
map.put("visible", null);
}
else {
map.put(
"visible", String.valueOf(productSpecification.getVisible()));
}

return map;
}

Expand Down Expand Up @@ -410,6 +428,9 @@ else if (Objects.equals(
else if (Objects.equals(jsonParserFieldName, "value")) {
return true;
}
else if (Objects.equals(jsonParserFieldName, "visible")) {
return false;
}

return false;
}
Expand Down Expand Up @@ -504,6 +525,12 @@ else if (Objects.equals(jsonParserFieldName, "value")) {
(Map<String, String>)jsonParserFieldValue);
}
}
else if (Objects.equals(jsonParserFieldName, "visible")) {
if (jsonParserFieldValue != null) {
productSpecification.setVisible(
(Boolean)jsonParserFieldValue);
}
}
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,16 @@ public static String toJSON(Specification specification) {
sb.append(_toJSON(specification.getTitle()));
}

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

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

sb.append(specification.getVisible());
}

sb.append("}");

return sb.toString();
Expand Down Expand Up @@ -264,6 +274,13 @@ public static Map<String, String> toMap(Specification specification) {
map.put("title", String.valueOf(specification.getTitle()));
}

if (specification.getVisible() == null) {
map.put("visible", null);
}
else {
map.put("visible", String.valueOf(specification.getVisible()));
}

return map;
}

Expand Down Expand Up @@ -318,6 +335,9 @@ else if (Objects.equals(jsonParserFieldName, "priority")) {
else if (Objects.equals(jsonParserFieldName, "title")) {
return true;
}
else if (Objects.equals(jsonParserFieldName, "visible")) {
return false;
}

return false;
}
Expand Down Expand Up @@ -392,6 +412,11 @@ else if (Objects.equals(jsonParserFieldName, "title")) {
(Map<String, String>)jsonParserFieldValue);
}
}
else if (Objects.equals(jsonParserFieldName, "visible")) {
if (jsonParserFieldValue != null) {
specification.setVisible((Boolean)jsonParserFieldValue);
}
}
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2079,7 +2079,7 @@ public ProductShippingConfiguration productIdShippingConfiguration(
/**
* 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 {productSpecificationByExternalReferenceCode(externalReferenceCode: ___){externalReferenceCode, id, key, label, optionCategoryExternalReferenceCode, optionCategoryId, priority, productId, specificationExternalReferenceCode, specificationId, specificationKey, specificationPriority, value}}"}' -u 'test@liferay.com:test'
* curl -H 'Content-Type: text/plain; charset=utf-8' -X 'POST' 'http://localhost:8080/o/graphql' -d $'{"query": "query {productSpecificationByExternalReferenceCode(externalReferenceCode: ___){externalReferenceCode, id, key, label, optionCategoryExternalReferenceCode, optionCategoryId, priority, productId, specificationExternalReferenceCode, specificationId, specificationKey, specificationPriority, value, visible}}"}' -u 'test@liferay.com:test'
*/
@GraphQLField
public ProductSpecification productSpecificationByExternalReferenceCode(
Expand All @@ -2098,7 +2098,7 @@ public ProductSpecification productSpecificationByExternalReferenceCode(
/**
* 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 {productSpecification(id: ___){externalReferenceCode, id, key, label, optionCategoryExternalReferenceCode, optionCategoryId, priority, productId, specificationExternalReferenceCode, specificationId, specificationKey, specificationPriority, value}}"}' -u 'test@liferay.com:test'
* curl -H 'Content-Type: text/plain; charset=utf-8' -X 'POST' 'http://localhost:8080/o/graphql' -d $'{"query": "query {productSpecification(id: ___){externalReferenceCode, id, key, label, optionCategoryExternalReferenceCode, optionCategoryId, priority, productId, specificationExternalReferenceCode, specificationId, specificationKey, specificationPriority, value, visible}}"}' -u 'test@liferay.com:test'
*/
@GraphQLField
public ProductSpecification productSpecification(@GraphQLName("id") Long id)
Expand Down Expand Up @@ -2684,7 +2684,7 @@ public SpecificationPage specifications(
/**
* 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 {specificationByExternalReferenceCode(externalReferenceCode: ___){description, externalReferenceCode, facetable, id, key, listTypeDefinitionId, listTypeDefinitionIds, optionCategory, priority, title}}"}' -u 'test@liferay.com:test'
* curl -H 'Content-Type: text/plain; charset=utf-8' -X 'POST' 'http://localhost:8080/o/graphql' -d $'{"query": "query {specificationByExternalReferenceCode(externalReferenceCode: ___){description, externalReferenceCode, facetable, id, key, listTypeDefinitionId, listTypeDefinitionIds, optionCategory, priority, title, visible}}"}' -u 'test@liferay.com:test'
*/
@GraphQLField
public Specification specificationByExternalReferenceCode(
Expand All @@ -2702,7 +2702,7 @@ public Specification specificationByExternalReferenceCode(
/**
* 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 {specification(id: ___){description, externalReferenceCode, facetable, id, key, listTypeDefinitionId, listTypeDefinitionIds, optionCategory, priority, title}}"}' -u 'test@liferay.com:test'
* curl -H 'Content-Type: text/plain; charset=utf-8' -X 'POST' 'http://localhost:8080/o/graphql' -d $'{"query": "query {specification(id: ___){description, externalReferenceCode, facetable, id, key, listTypeDefinitionId, listTypeDefinitionIds, optionCategory, priority, title, visible}}"}' -u 'test@liferay.com:test'
*/
@GraphQLField
public Specification specification(@GraphQLName("id") Long id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public ProductSpecification getProductSpecificationByExternalReferenceCode(
/**
* Invoke this method with the command line:
*
* curl -X 'PATCH' 'http://localhost:8080/o/headless-commerce-admin-catalog/v1.0/productSpecifications/by-externalReferenceCode/{externalReferenceCode}' -d $'{"externalReferenceCode": ___, "id": ___, "key": ___, "label": ___, "optionCategoryExternalReferenceCode": ___, "optionCategoryId": ___, "priority": ___, "productId": ___, "specificationExternalReferenceCode": ___, "specificationId": ___, "specificationKey": ___, "specificationPriority": ___, "value": ___}' --header 'Content-Type: application/json' -u 'test@liferay.com:test'
* curl -X 'PATCH' 'http://localhost:8080/o/headless-commerce-admin-catalog/v1.0/productSpecifications/by-externalReferenceCode/{externalReferenceCode}' -d $'{"externalReferenceCode": ___, "id": ___, "key": ___, "label": ___, "optionCategoryExternalReferenceCode": ___, "optionCategoryId": ___, "priority": ___, "productId": ___, "specificationExternalReferenceCode": ___, "specificationId": ___, "specificationKey": ___, "specificationPriority": ___, "value": ___, "visible": ___}' --header 'Content-Type: application/json' -u 'test@liferay.com:test'
*/
@io.swagger.v3.oas.annotations.Parameters(
value = {
Expand Down Expand Up @@ -296,7 +296,7 @@ public ProductSpecification getProductSpecification(
/**
* Invoke this method with the command line:
*
* curl -X 'PATCH' 'http://localhost:8080/o/headless-commerce-admin-catalog/v1.0/productSpecifications/{id}' -d $'{"externalReferenceCode": ___, "id": ___, "key": ___, "label": ___, "optionCategoryExternalReferenceCode": ___, "optionCategoryId": ___, "priority": ___, "productId": ___, "specificationExternalReferenceCode": ___, "specificationId": ___, "specificationKey": ___, "specificationPriority": ___, "value": ___}' --header 'Content-Type: application/json' -u 'test@liferay.com:test'
* curl -X 'PATCH' 'http://localhost:8080/o/headless-commerce-admin-catalog/v1.0/productSpecifications/{id}' -d $'{"externalReferenceCode": ___, "id": ___, "key": ___, "label": ___, "optionCategoryExternalReferenceCode": ___, "optionCategoryId": ___, "priority": ___, "productId": ___, "specificationExternalReferenceCode": ___, "specificationId": ___, "specificationKey": ___, "specificationPriority": ___, "value": ___, "visible": ___}' --header 'Content-Type: application/json' -u 'test@liferay.com:test'
*/
@io.swagger.v3.oas.annotations.Parameters(
value = {
Expand Down Expand Up @@ -377,7 +377,7 @@ public ProductSpecification patchProductSpecification(
/**
* Invoke this method with the command line:
*
* curl -X 'POST' 'http://localhost:8080/o/headless-commerce-admin-catalog/v1.0/products/by-externalReferenceCode/{externalReferenceCode}/product-specifications' -d $'{"externalReferenceCode": ___, "id": ___, "key": ___, "label": ___, "optionCategoryExternalReferenceCode": ___, "optionCategoryId": ___, "priority": ___, "productId": ___, "specificationExternalReferenceCode": ___, "specificationId": ___, "specificationKey": ___, "specificationPriority": ___, "value": ___}' --header 'Content-Type: application/json' -u 'test@liferay.com:test'
* curl -X 'POST' 'http://localhost:8080/o/headless-commerce-admin-catalog/v1.0/products/by-externalReferenceCode/{externalReferenceCode}/product-specifications' -d $'{"externalReferenceCode": ___, "id": ___, "key": ___, "label": ___, "optionCategoryExternalReferenceCode": ___, "optionCategoryId": ___, "priority": ___, "productId": ___, "specificationExternalReferenceCode": ___, "specificationId": ___, "specificationKey": ___, "specificationPriority": ___, "value": ___, "visible": ___}' --header 'Content-Type: application/json' -u 'test@liferay.com:test'
*/
@io.swagger.v3.oas.annotations.Parameters(
value = {
Expand Down Expand Up @@ -458,7 +458,7 @@ public Page<ProductSpecification> getProductIdProductSpecificationsPage(
/**
* Invoke this method with the command line:
*
* curl -X 'POST' 'http://localhost:8080/o/headless-commerce-admin-catalog/v1.0/products/{id}/productSpecifications' -d $'{"externalReferenceCode": ___, "id": ___, "key": ___, "label": ___, "optionCategoryExternalReferenceCode": ___, "optionCategoryId": ___, "priority": ___, "productId": ___, "specificationExternalReferenceCode": ___, "specificationId": ___, "specificationKey": ___, "specificationPriority": ___, "value": ___}' --header 'Content-Type: application/json' -u 'test@liferay.com:test'
* curl -X 'POST' 'http://localhost:8080/o/headless-commerce-admin-catalog/v1.0/products/{id}/productSpecifications' -d $'{"externalReferenceCode": ___, "id": ___, "key": ___, "label": ___, "optionCategoryExternalReferenceCode": ___, "optionCategoryId": ___, "priority": ___, "productId": ___, "specificationExternalReferenceCode": ___, "specificationId": ___, "specificationKey": ___, "specificationPriority": ___, "value": ___, "visible": ___}' --header 'Content-Type: application/json' -u 'test@liferay.com:test'
*/
@io.swagger.v3.oas.annotations.Parameters(
value = {
Expand Down
Loading

0 comments on commit 5897d28

Please sign in to comment.