
com.liferay.headless.delivery.internal.resource.v1_0.BaseWikiPageAttachmentResourceImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of com.liferay.headless.delivery.impl
Show all versions of com.liferay.headless.delivery.impl
Liferay Headless Delivery Implementation
The newest version!
/**
* SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
*/
package com.liferay.headless.delivery.internal.resource.v1_0;
import com.liferay.headless.delivery.dto.v1_0.DefaultValue;
import com.liferay.headless.delivery.dto.v1_0.WikiPageAttachment;
import com.liferay.headless.delivery.resource.v1_0.WikiPageAttachmentResource;
import com.liferay.petra.function.UnsafeBiConsumer;
import com.liferay.petra.function.UnsafeConsumer;
import com.liferay.petra.function.UnsafeFunction;
import com.liferay.petra.function.transform.TransformUtil;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.security.permission.resource.ModelResourcePermission;
import com.liferay.portal.kernel.service.GroupLocalService;
import com.liferay.portal.kernel.service.ResourceActionLocalService;
import com.liferay.portal.kernel.service.ResourcePermissionLocalService;
import com.liferay.portal.kernel.service.RoleLocalService;
import com.liferay.portal.kernel.util.LocaleUtil;
import com.liferay.portal.kernel.util.SetUtil;
import com.liferay.portal.kernel.util.StringUtil;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.odata.entity.EntityModel;
import com.liferay.portal.odata.filter.ExpressionConvert;
import com.liferay.portal.odata.filter.FilterParser;
import com.liferay.portal.odata.filter.FilterParserProvider;
import com.liferay.portal.odata.sort.SortField;
import com.liferay.portal.odata.sort.SortParser;
import com.liferay.portal.odata.sort.SortParserProvider;
import com.liferay.portal.vulcan.accept.language.AcceptLanguage;
import com.liferay.portal.vulcan.batch.engine.VulcanBatchEngineTaskItemDelegate;
import com.liferay.portal.vulcan.batch.engine.resource.VulcanBatchEngineExportTaskResource;
import com.liferay.portal.vulcan.batch.engine.resource.VulcanBatchEngineImportTaskResource;
import com.liferay.portal.vulcan.crud.VulcanCRUDItemDelegate;
import com.liferay.portal.vulcan.multipart.MultipartBody;
import com.liferay.portal.vulcan.pagination.Page;
import com.liferay.portal.vulcan.pagination.Pagination;
import com.liferay.portal.vulcan.resource.EntityModelResource;
import com.liferay.portal.vulcan.util.ActionUtil;
import com.liferay.portal.vulcan.util.UriInfoUtil;
import jakarta.annotation.Generated;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.ws.rs.NotSupportedException;
import jakarta.ws.rs.core.MultivaluedHashMap;
import jakarta.ws.rs.core.MultivaluedMap;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.UriInfo;
import java.io.Serializable;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
/**
* @author Javier Gamarra
* @generated
*/
@Generated("")
@jakarta.ws.rs.Path("/v1.0")
public abstract class BaseWikiPageAttachmentResourceImpl
implements EntityModelResource,
VulcanBatchEngineTaskItemDelegate,
VulcanCRUDItemDelegate,
WikiPageAttachmentResource {
/**
* Invoke this method with the command line:
*
* curl -X 'DELETE' 'http://localhost:8080/o/headless-delivery/v1.0/sites/{siteId}/wiki-pages/by-external-reference-code/{wikiPageExternalReferenceCode}/wiki-page-attachments/by-external-reference-code/{externalReferenceCode}' -u '[email protected]:test'
*/
@io.swagger.v3.oas.annotations.Operation(
description = "Delete the wiki page attachment by wiki page's and wiki page attachment's external reference codes."
)
@io.swagger.v3.oas.annotations.Parameters(
value = {
@io.swagger.v3.oas.annotations.Parameter(
in = io.swagger.v3.oas.annotations.enums.ParameterIn.PATH,
name = "siteId"
),
@io.swagger.v3.oas.annotations.Parameter(
in = io.swagger.v3.oas.annotations.enums.ParameterIn.PATH,
name = "wikiPageExternalReferenceCode"
),
@io.swagger.v3.oas.annotations.Parameter(
in = io.swagger.v3.oas.annotations.enums.ParameterIn.PATH,
name = "externalReferenceCode"
)
}
)
@io.swagger.v3.oas.annotations.tags.Tags(
value = {
@io.swagger.v3.oas.annotations.tags.Tag(name = "WikiPageAttachment")
}
)
@jakarta.ws.rs.DELETE
@jakarta.ws.rs.Path(
"/sites/{siteId}/wiki-pages/by-external-reference-code/{wikiPageExternalReferenceCode}/wiki-page-attachments/by-external-reference-code/{externalReferenceCode}"
)
@jakarta.ws.rs.Produces({"application/json", "application/xml"})
@Override
public void
deleteSiteWikiPageByExternalReferenceCodeWikiPageExternalReferenceCodeWikiPageAttachmentByExternalReferenceCode(
@io.swagger.v3.oas.annotations.Parameter(hidden = true)
@jakarta.validation.constraints.NotNull
@jakarta.ws.rs.PathParam("siteId")
Long siteId,
@io.swagger.v3.oas.annotations.Parameter(hidden = true)
@jakarta.validation.constraints.NotNull
@jakarta.ws.rs.PathParam("wikiPageExternalReferenceCode")
String wikiPageExternalReferenceCode,
@io.swagger.v3.oas.annotations.Parameter(hidden = true)
@jakarta.validation.constraints.NotNull
@jakarta.ws.rs.PathParam("externalReferenceCode")
String externalReferenceCode)
throws Exception {
}
/**
* Invoke this method with the command line:
*
* curl -X 'DELETE' 'http://localhost:8080/o/headless-delivery/v1.0/wiki-page-attachments/{wikiPageAttachmentId}' -u '[email protected]:test'
*/
@io.swagger.v3.oas.annotations.Operation(
description = "Deletes the wiki page attachment and returns a 204 if the operation succeeds."
)
@io.swagger.v3.oas.annotations.Parameters(
value = {
@io.swagger.v3.oas.annotations.Parameter(
in = io.swagger.v3.oas.annotations.enums.ParameterIn.PATH,
name = "wikiPageAttachmentId"
)
}
)
@io.swagger.v3.oas.annotations.tags.Tags(
value = {
@io.swagger.v3.oas.annotations.tags.Tag(name = "WikiPageAttachment")
}
)
@jakarta.ws.rs.DELETE
@jakarta.ws.rs.Path("/wiki-page-attachments/{wikiPageAttachmentId}")
@jakarta.ws.rs.Produces({"application/json", "application/xml"})
@Override
public void deleteWikiPageAttachment(
@io.swagger.v3.oas.annotations.Parameter(hidden = true)
@jakarta.validation.constraints.NotNull
@jakarta.ws.rs.PathParam("wikiPageAttachmentId")
Long wikiPageAttachmentId)
throws Exception {
}
/**
* Invoke this method with the command line:
*
* curl -X 'DELETE' 'http://localhost:8080/o/headless-delivery/v1.0/wiki-page-attachments/batch' -u '[email protected]:test'
*/
@io.swagger.v3.oas.annotations.Parameters(
value = {
@io.swagger.v3.oas.annotations.Parameter(
in = io.swagger.v3.oas.annotations.enums.ParameterIn.QUERY,
name = "callbackURL"
)
}
)
@io.swagger.v3.oas.annotations.tags.Tags(
value = {
@io.swagger.v3.oas.annotations.tags.Tag(name = "WikiPageAttachment")
}
)
@jakarta.ws.rs.Consumes("application/json")
@jakarta.ws.rs.DELETE
@jakarta.ws.rs.Path("/wiki-page-attachments/batch")
@jakarta.ws.rs.Produces("application/json")
@Override
public Response deleteWikiPageAttachmentBatch(
@io.swagger.v3.oas.annotations.Parameter(hidden = true)
@jakarta.ws.rs.QueryParam("callbackURL")
String callbackURL,
Object object)
throws Exception {
vulcanBatchEngineImportTaskResource.setContextAcceptLanguage(
contextAcceptLanguage);
vulcanBatchEngineImportTaskResource.setContextCompany(contextCompany);
vulcanBatchEngineImportTaskResource.setContextHttpServletRequest(
contextHttpServletRequest);
vulcanBatchEngineImportTaskResource.setContextUriInfo(contextUriInfo);
vulcanBatchEngineImportTaskResource.setContextUser(contextUser);
Response.ResponseBuilder responseBuilder = Response.accepted();
return responseBuilder.entity(
vulcanBatchEngineImportTaskResource.deleteImportTask(
WikiPageAttachment.class.getName(), callbackURL, object)
).build();
}
/**
* Invoke this method with the command line:
*
* curl -X 'GET' 'http://localhost:8080/o/headless-delivery/v1.0/sites/{siteId}/wiki-pages/by-external-reference-code/{wikiPageExternalReferenceCode}/wiki-page-attachments/by-external-reference-code/{externalReferenceCode}' -u '[email protected]:test'
*/
@io.swagger.v3.oas.annotations.Operation(
description = "Retrieves the wiki page attachment by wiki page's and wiki page attachment's external reference codes."
)
@io.swagger.v3.oas.annotations.Parameters(
value = {
@io.swagger.v3.oas.annotations.Parameter(
in = io.swagger.v3.oas.annotations.enums.ParameterIn.PATH,
name = "siteId"
),
@io.swagger.v3.oas.annotations.Parameter(
in = io.swagger.v3.oas.annotations.enums.ParameterIn.PATH,
name = "wikiPageExternalReferenceCode"
),
@io.swagger.v3.oas.annotations.Parameter(
in = io.swagger.v3.oas.annotations.enums.ParameterIn.PATH,
name = "externalReferenceCode"
),
@io.swagger.v3.oas.annotations.Parameter(
in = io.swagger.v3.oas.annotations.enums.ParameterIn.QUERY,
name = "fields"
),
@io.swagger.v3.oas.annotations.Parameter(
in = io.swagger.v3.oas.annotations.enums.ParameterIn.QUERY,
name = "restrictFields"
)
}
)
@io.swagger.v3.oas.annotations.tags.Tags(
value = {
@io.swagger.v3.oas.annotations.tags.Tag(name = "WikiPageAttachment")
}
)
@jakarta.ws.rs.GET
@jakarta.ws.rs.Path(
"/sites/{siteId}/wiki-pages/by-external-reference-code/{wikiPageExternalReferenceCode}/wiki-page-attachments/by-external-reference-code/{externalReferenceCode}"
)
@jakarta.ws.rs.Produces({"application/json", "application/xml"})
@Override
public WikiPageAttachment
getSiteWikiPageByExternalReferenceCodeWikiPageExternalReferenceCodeWikiPageAttachmentByExternalReferenceCode(
@io.swagger.v3.oas.annotations.Parameter(hidden = true)
@jakarta.validation.constraints.NotNull
@jakarta.ws.rs.PathParam("siteId")
Long siteId,
@io.swagger.v3.oas.annotations.Parameter(hidden = true)
@jakarta.validation.constraints.NotNull
@jakarta.ws.rs.PathParam("wikiPageExternalReferenceCode")
String wikiPageExternalReferenceCode,
@io.swagger.v3.oas.annotations.Parameter(hidden = true)
@jakarta.validation.constraints.NotNull
@jakarta.ws.rs.PathParam("externalReferenceCode")
String externalReferenceCode)
throws Exception {
return new WikiPageAttachment();
}
/**
* Invoke this method with the command line:
*
* curl -X 'GET' 'http://localhost:8080/o/headless-delivery/v1.0/wiki-page-attachments/{wikiPageAttachmentId}' -u '[email protected]:test'
*/
@io.swagger.v3.oas.annotations.Operation(
description = "Retrieves the wiki page attachment."
)
@io.swagger.v3.oas.annotations.Parameters(
value = {
@io.swagger.v3.oas.annotations.Parameter(
in = io.swagger.v3.oas.annotations.enums.ParameterIn.PATH,
name = "wikiPageAttachmentId"
),
@io.swagger.v3.oas.annotations.Parameter(
in = io.swagger.v3.oas.annotations.enums.ParameterIn.QUERY,
name = "fields"
),
@io.swagger.v3.oas.annotations.Parameter(
in = io.swagger.v3.oas.annotations.enums.ParameterIn.QUERY,
name = "nestedFields"
),
@io.swagger.v3.oas.annotations.Parameter(
in = io.swagger.v3.oas.annotations.enums.ParameterIn.QUERY,
name = "restrictFields"
)
}
)
@io.swagger.v3.oas.annotations.tags.Tags(
value = {
@io.swagger.v3.oas.annotations.tags.Tag(name = "WikiPageAttachment")
}
)
@jakarta.ws.rs.GET
@jakarta.ws.rs.Path("/wiki-page-attachments/{wikiPageAttachmentId}")
@jakarta.ws.rs.Produces({"application/json", "application/xml"})
@Override
public WikiPageAttachment getWikiPageAttachment(
@io.swagger.v3.oas.annotations.Parameter(hidden = true)
@jakarta.validation.constraints.NotNull
@jakarta.ws.rs.PathParam("wikiPageAttachmentId")
Long wikiPageAttachmentId)
throws Exception {
return new WikiPageAttachment();
}
/**
* Invoke this method with the command line:
*
* curl -X 'GET' 'http://localhost:8080/o/headless-delivery/v1.0/wiki-pages/{wikiPageId}/wiki-page-attachments' -u '[email protected]:test'
*/
@io.swagger.v3.oas.annotations.Operation(
description = "Retrieves the wiki page's attachments."
)
@io.swagger.v3.oas.annotations.Parameters(
value = {
@io.swagger.v3.oas.annotations.Parameter(
in = io.swagger.v3.oas.annotations.enums.ParameterIn.PATH,
name = "wikiPageId"
),
@io.swagger.v3.oas.annotations.Parameter(
in = io.swagger.v3.oas.annotations.enums.ParameterIn.QUERY,
name = "fields"
),
@io.swagger.v3.oas.annotations.Parameter(
in = io.swagger.v3.oas.annotations.enums.ParameterIn.QUERY,
name = "nestedFields"
),
@io.swagger.v3.oas.annotations.Parameter(
in = io.swagger.v3.oas.annotations.enums.ParameterIn.QUERY,
name = "restrictFields"
)
}
)
@io.swagger.v3.oas.annotations.tags.Tags(
value = {
@io.swagger.v3.oas.annotations.tags.Tag(name = "WikiPageAttachment")
}
)
@jakarta.ws.rs.GET
@jakarta.ws.rs.Path("/wiki-pages/{wikiPageId}/wiki-page-attachments")
@jakarta.ws.rs.Produces({"application/json", "application/xml"})
@Override
public Page getWikiPageWikiPageAttachmentsPage(
@io.swagger.v3.oas.annotations.Parameter(hidden = true)
@jakarta.validation.constraints.NotNull
@jakarta.ws.rs.PathParam("wikiPageId")
Long wikiPageId)
throws Exception {
return Page.of(Collections.emptyList());
}
/**
* Invoke this method with the command line:
*
* curl -X 'POST' 'http://localhost:8080/o/headless-delivery/v1.0/wiki-pages/{wikiPageId}/wiki-page-attachments' -u '[email protected]:test'
*/
@io.swagger.v3.oas.annotations.Operation(
description = "Creates an attachment for the wiki page. The request body must be `multipart/form-data` with two parts, the file's bytes (`file`), and an optional JSON string (`WikiPageAttachment`) with the metadata.",
requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(content = @io.swagger.v3.oas.annotations.media.Content(mediaType = "multipart/form-data", schema = @io.swagger.v3.oas.annotations.media.Schema(implementation = PostWikiPageWikiPageAttachmentRequestBody.class)))
)
@io.swagger.v3.oas.annotations.Parameters(
value = {
@io.swagger.v3.oas.annotations.Parameter(
in = io.swagger.v3.oas.annotations.enums.ParameterIn.PATH,
name = "wikiPageId"
)
}
)
@io.swagger.v3.oas.annotations.tags.Tags(
value = {
@io.swagger.v3.oas.annotations.tags.Tag(name = "WikiPageAttachment")
}
)
@jakarta.ws.rs.Consumes("multipart/form-data")
@jakarta.ws.rs.Path("/wiki-pages/{wikiPageId}/wiki-page-attachments")
@jakarta.ws.rs.POST
@jakarta.ws.rs.Produces({"application/json", "application/xml"})
@Override
public WikiPageAttachment postWikiPageWikiPageAttachment(
@io.swagger.v3.oas.annotations.Parameter(hidden = true)
@jakarta.validation.constraints.NotNull
@jakarta.ws.rs.PathParam("wikiPageId")
Long wikiPageId,
MultipartBody multipartBody)
throws Exception {
return new WikiPageAttachment();
}
/**
* Invoke this method with the command line:
*
* curl -X 'POST' 'http://localhost:8080/o/headless-delivery/v1.0/wiki-pages/{wikiPageId}/wiki-page-attachments/batch' -u '[email protected]:test'
*/
@io.swagger.v3.oas.annotations.Parameters(
value = {
@io.swagger.v3.oas.annotations.Parameter(
in = io.swagger.v3.oas.annotations.enums.ParameterIn.PATH,
name = "wikiPageId"
),
@io.swagger.v3.oas.annotations.Parameter(
in = io.swagger.v3.oas.annotations.enums.ParameterIn.QUERY,
name = "callbackURL"
)
}
)
@io.swagger.v3.oas.annotations.tags.Tags(
value = {
@io.swagger.v3.oas.annotations.tags.Tag(name = "WikiPageAttachment")
}
)
@jakarta.ws.rs.Consumes("application/json")
@jakarta.ws.rs.Path("/wiki-pages/{wikiPageId}/wiki-page-attachments/batch")
@jakarta.ws.rs.POST
@jakarta.ws.rs.Produces("application/json")
@Override
public Response postWikiPageWikiPageAttachmentBatch(
@io.swagger.v3.oas.annotations.Parameter(hidden = true)
@jakarta.validation.constraints.NotNull
@jakarta.ws.rs.PathParam("wikiPageId")
Long wikiPageId,
MultipartBody multipartBody,
@io.swagger.v3.oas.annotations.Parameter(hidden = true)
@jakarta.ws.rs.QueryParam("callbackURL")
String callbackURL,
Object object)
throws Exception {
vulcanBatchEngineImportTaskResource.setContextAcceptLanguage(
contextAcceptLanguage);
vulcanBatchEngineImportTaskResource.setContextCompany(contextCompany);
vulcanBatchEngineImportTaskResource.setContextHttpServletRequest(
contextHttpServletRequest);
vulcanBatchEngineImportTaskResource.setContextUriInfo(contextUriInfo);
vulcanBatchEngineImportTaskResource.setContextUser(contextUser);
Response.ResponseBuilder responseBuilder = Response.accepted();
return responseBuilder.entity(
vulcanBatchEngineImportTaskResource.postImportTask(
WikiPageAttachment.class.getName(), callbackURL, null, object)
).build();
}
/**
* Invoke this method with the command line:
*
* curl -X 'POST' 'http://localhost:8080/o/headless-delivery/v1.0/wiki-pages/{wikiPageId}/wiki-page-attachments/export-batch' -u '[email protected]:test'
*/
@io.swagger.v3.oas.annotations.Parameters(
value = {
@io.swagger.v3.oas.annotations.Parameter(
in = io.swagger.v3.oas.annotations.enums.ParameterIn.PATH,
name = "wikiPageId"
),
@io.swagger.v3.oas.annotations.Parameter(
in = io.swagger.v3.oas.annotations.enums.ParameterIn.QUERY,
name = "callbackURL"
),
@io.swagger.v3.oas.annotations.Parameter(
in = io.swagger.v3.oas.annotations.enums.ParameterIn.QUERY,
name = "contentType"
),
@io.swagger.v3.oas.annotations.Parameter(
in = io.swagger.v3.oas.annotations.enums.ParameterIn.QUERY,
name = "fieldNames"
)
}
)
@io.swagger.v3.oas.annotations.tags.Tags(
value = {
@io.swagger.v3.oas.annotations.tags.Tag(name = "WikiPageAttachment")
}
)
@jakarta.ws.rs.Consumes("application/json")
@jakarta.ws.rs.Path(
"/wiki-pages/{wikiPageId}/wiki-page-attachments/export-batch"
)
@jakarta.ws.rs.POST
@jakarta.ws.rs.Produces("application/json")
@Override
public Response postWikiPageWikiPageAttachmentsPageExportBatch(
@io.swagger.v3.oas.annotations.Parameter(hidden = true)
@jakarta.validation.constraints.NotNull
@jakarta.ws.rs.PathParam("wikiPageId")
Long wikiPageId,
@io.swagger.v3.oas.annotations.Parameter(hidden = true)
@jakarta.ws.rs.QueryParam("callbackURL")
String callbackURL,
@io.swagger.v3.oas.annotations.Parameter(hidden = true)
@jakarta.ws.rs.DefaultValue("JSON")
@jakarta.ws.rs.QueryParam("contentType")
String contentType,
@io.swagger.v3.oas.annotations.Parameter(hidden = true)
@jakarta.ws.rs.QueryParam("fieldNames")
String fieldNames)
throws Exception {
vulcanBatchEngineExportTaskResource.setContextAcceptLanguage(
contextAcceptLanguage);
vulcanBatchEngineExportTaskResource.setContextCompany(contextCompany);
vulcanBatchEngineExportTaskResource.setContextHttpServletRequest(
contextHttpServletRequest);
vulcanBatchEngineExportTaskResource.setContextUriInfo(contextUriInfo);
vulcanBatchEngineExportTaskResource.setContextUser(contextUser);
vulcanBatchEngineExportTaskResource.setGroupLocalService(
groupLocalService);
Response.ResponseBuilder responseBuilder = Response.accepted();
return responseBuilder.entity(
vulcanBatchEngineExportTaskResource.postExportTask(
WikiPageAttachment.class.getName(), callbackURL, contentType,
fieldNames)
).build();
}
@Override
@SuppressWarnings("PMD.UnusedLocalVariable")
public void create(
Collection wikiPageAttachments,
Map parameters)
throws Exception {
UnsafeFunction
wikiPageAttachmentUnsafeFunction = null;
String createStrategy = (String)parameters.getOrDefault(
"createStrategy", "INSERT");
if (StringUtil.equalsIgnoreCase(createStrategy, "INSERT")) {
if (parameters.containsKey("wikiPageId")) {
wikiPageAttachmentUnsafeFunction =
wikiPageAttachment -> postWikiPageWikiPageAttachment(
_parseLong((String)parameters.get("wikiPageId")), null);
}
else {
throw new NotSupportedException(
"One of the following parameters must be specified: [wikiPageId]");
}
}
if (wikiPageAttachmentUnsafeFunction == null) {
throw new NotSupportedException(
"Create strategy \"" + createStrategy +
"\" is not supported for WikiPageAttachment");
}
if (contextBatchUnsafeBiConsumer != null) {
contextBatchUnsafeBiConsumer.accept(
wikiPageAttachments, wikiPageAttachmentUnsafeFunction);
}
else if (contextBatchUnsafeConsumer != null) {
contextBatchUnsafeConsumer.accept(
wikiPageAttachments, wikiPageAttachmentUnsafeFunction::apply);
}
else {
for (WikiPageAttachment wikiPageAttachment : wikiPageAttachments) {
wikiPageAttachmentUnsafeFunction.apply(wikiPageAttachment);
}
}
}
@Override
public void delete(
Collection wikiPageAttachments,
Map parameters)
throws Exception {
UnsafeFunction
wikiPageAttachmentUnsafeFunction = wikiPageAttachment -> {
deleteWikiPageAttachment(wikiPageAttachment.getId());
return wikiPageAttachment;
};
if (contextBatchUnsafeBiConsumer != null) {
contextBatchUnsafeBiConsumer.accept(
wikiPageAttachments, wikiPageAttachmentUnsafeFunction);
}
else if (contextBatchUnsafeConsumer != null) {
contextBatchUnsafeConsumer.accept(
wikiPageAttachments, wikiPageAttachmentUnsafeFunction::apply);
}
else {
for (WikiPageAttachment wikiPageAttachment : wikiPageAttachments) {
wikiPageAttachmentUnsafeFunction.apply(wikiPageAttachment);
}
}
}
public Set getAvailableCreateStrategies() {
return SetUtil.fromArray("INSERT");
}
public Set getAvailableUpdateStrategies() {
return SetUtil.fromArray();
}
@Override
public EntityModel getEntityModel(Map> multivaluedMap)
throws Exception {
return getEntityModel(
new MultivaluedHashMap(multivaluedMap));
}
@Override
public EntityModel getEntityModel(MultivaluedMap multivaluedMap)
throws Exception {
return null;
}
public String getResourceName() {
return "WikiPageAttachment";
}
public String getVersion() {
return "v1.0";
}
@Override
public Page read(
com.liferay.portal.kernel.search.filter.Filter filter,
Pagination pagination,
com.liferay.portal.kernel.search.Sort[] sorts,
Map parameters, String search)
throws Exception {
if (parameters.containsKey("wikiPageId")) {
return getWikiPageWikiPageAttachmentsPage(
_parseLong((String)parameters.get("wikiPageId")));
}
else {
throw new NotSupportedException(
"One of the following parameters must be specified: [wikiPageId]");
}
}
@Override
public void setLanguageId(String languageId) {
this.contextAcceptLanguage = new AcceptLanguage() {
@Override
public List getLocales() {
return null;
}
@Override
public String getPreferredLanguageId() {
return languageId;
}
@Override
public Locale getPreferredLocale() {
return LocaleUtil.fromLanguageId(languageId);
}
};
}
@Override
public void update(
Collection wikiPageAttachments,
Map parameters)
throws Exception {
throw new UnsupportedOperationException(
"This method needs to be implemented");
}
private Long _parseLong(String value) {
if (value != null) {
return Long.parseLong(value);
}
return null;
}
@Override
public WikiPageAttachment getItem(Long id) throws Exception {
return getWikiPageAttachment(id);
}
public void setContextAcceptLanguage(AcceptLanguage contextAcceptLanguage) {
this.contextAcceptLanguage = contextAcceptLanguage;
}
public void setContextBatchUnsafeBiConsumer(
UnsafeBiConsumer
,
UnsafeFunction,
Exception> contextBatchUnsafeBiConsumer) {
this.contextBatchUnsafeBiConsumer = contextBatchUnsafeBiConsumer;
}
public void setContextBatchUnsafeConsumer(
UnsafeBiConsumer
,
UnsafeConsumer, Exception>
contextBatchUnsafeConsumer) {
this.contextBatchUnsafeConsumer = contextBatchUnsafeConsumer;
}
public void setContextCompany(
com.liferay.portal.kernel.model.Company contextCompany) {
this.contextCompany = contextCompany;
}
public void setContextHttpServletRequest(
HttpServletRequest contextHttpServletRequest) {
this.contextHttpServletRequest = contextHttpServletRequest;
}
public void setContextHttpServletResponse(
HttpServletResponse contextHttpServletResponse) {
this.contextHttpServletResponse = contextHttpServletResponse;
}
public void setContextUriInfo(UriInfo contextUriInfo) {
this.contextUriInfo = UriInfoUtil.getVulcanUriInfo(
getApplicationPath(), contextUriInfo);
}
public void setContextUser(
com.liferay.portal.kernel.model.User contextUser) {
this.contextUser = contextUser;
}
public void setExpressionConvert(
ExpressionConvert
expressionConvert) {
this.expressionConvert = expressionConvert;
}
public void setFilterParserProvider(
FilterParserProvider filterParserProvider) {
this.filterParserProvider = filterParserProvider;
}
public void setGroupLocalService(GroupLocalService groupLocalService) {
this.groupLocalService = groupLocalService;
}
public void setResourceActionLocalService(
ResourceActionLocalService resourceActionLocalService) {
this.resourceActionLocalService = resourceActionLocalService;
}
public void setResourcePermissionLocalService(
ResourcePermissionLocalService resourcePermissionLocalService) {
this.resourcePermissionLocalService = resourcePermissionLocalService;
}
public void setRoleLocalService(RoleLocalService roleLocalService) {
this.roleLocalService = roleLocalService;
}
public void setSortParserProvider(SortParserProvider sortParserProvider) {
this.sortParserProvider = sortParserProvider;
}
protected String getApplicationPath() {
return "headless-delivery";
}
public void setVulcanBatchEngineExportTaskResource(
VulcanBatchEngineExportTaskResource
vulcanBatchEngineExportTaskResource) {
this.vulcanBatchEngineExportTaskResource =
vulcanBatchEngineExportTaskResource;
}
public void setVulcanBatchEngineImportTaskResource(
VulcanBatchEngineImportTaskResource
vulcanBatchEngineImportTaskResource) {
this.vulcanBatchEngineImportTaskResource =
vulcanBatchEngineImportTaskResource;
}
@Override
public com.liferay.portal.kernel.search.filter.Filter toFilter(
String filterString, Map> multivaluedMap) {
try {
EntityModel entityModel = getEntityModel(multivaluedMap);
FilterParser filterParser = filterParserProvider.provide(
entityModel);
com.liferay.portal.odata.filter.Filter oDataFilter =
new com.liferay.portal.odata.filter.Filter(
filterParser.parse(filterString));
return expressionConvert.convert(
oDataFilter.getExpression(),
contextAcceptLanguage.getPreferredLocale(), entityModel);
}
catch (Exception exception) {
_log.error("Invalid filter " + filterString, exception);
return null;
}
}
@Override
public com.liferay.portal.kernel.search.Sort[] toSorts(String sortString) {
if (Validator.isNull(sortString)) {
return null;
}
try {
SortParser sortParser = sortParserProvider.provide(
getEntityModel(Collections.emptyMap()));
if (sortParser == null) {
return null;
}
com.liferay.portal.odata.sort.Sort oDataSort =
new com.liferay.portal.odata.sort.Sort(
sortParser.parse(sortString));
List sortFields = oDataSort.getSortFields();
com.liferay.portal.kernel.search.Sort[] sorts =
new com.liferay.portal.kernel.search.Sort[sortFields.size()];
for (int i = 0; i < sortFields.size(); i++) {
SortField sortField = sortFields.get(i);
sorts[i] = new com.liferay.portal.kernel.search.Sort(
sortField.getSortableFieldName(
contextAcceptLanguage.getPreferredLocale()),
!sortField.isAscending());
}
return sorts;
}
catch (Exception exception) {
_log.error("Invalid sort " + sortString, exception);
return new com.liferay.portal.kernel.search.Sort[0];
}
}
protected Map addAction(
String actionName,
com.liferay.portal.kernel.model.GroupedModel groupedModel,
String methodName) {
return ActionUtil.addAction(
actionName, getClass(), groupedModel, methodName,
contextScopeChecker, contextUriInfo);
}
protected Map addAction(
String actionName, Long id, String methodName, Long ownerId,
String permissionName, Long siteId) {
return ActionUtil.addAction(
actionName, getClass(), id, methodName, contextScopeChecker,
ownerId, permissionName, siteId, contextUriInfo);
}
protected Map addAction(
String actionName, Long id, String methodName,
ModelResourcePermission modelResourcePermission) {
return ActionUtil.addAction(
actionName, getClass(), id, methodName, contextScopeChecker,
modelResourcePermission, contextUriInfo);
}
protected Map addAction(
String actionName, String methodName, String permissionName,
Long siteId) {
return addAction(
actionName, siteId, methodName, null, permissionName, siteId);
}
protected List transform(
Collection collection, UnsafeFunction unsafeFunction) {
return TransformUtil.transform(collection, unsafeFunction);
}
protected R[] transform(
T[] array, UnsafeFunction unsafeFunction,
Class extends R> clazz) {
return TransformUtil.transform(array, unsafeFunction, clazz);
}
protected R[] transformToArray(
Collection collection, UnsafeFunction unsafeFunction,
Class extends R> clazz) {
return TransformUtil.transformToArray(
collection, unsafeFunction, clazz);
}
protected List transformToList(
T[] array, UnsafeFunction unsafeFunction) {
return TransformUtil.transformToList(array, unsafeFunction);
}
protected long[] transformToLongArray(
Collection collection, UnsafeFunction unsafeFunction) {
return TransformUtil.transformToLongArray(collection, unsafeFunction);
}
protected List unsafeTransform(
Collection collection, UnsafeFunction unsafeFunction)
throws E {
return TransformUtil.unsafeTransform(collection, unsafeFunction);
}
protected R[] unsafeTransform(
T[] array, UnsafeFunction unsafeFunction,
Class extends R> clazz)
throws E {
return TransformUtil.unsafeTransform(array, unsafeFunction, clazz);
}
protected R[] unsafeTransformToArray(
Collection collection, UnsafeFunction unsafeFunction,
Class extends R> clazz)
throws E {
return TransformUtil.unsafeTransformToArray(
collection, unsafeFunction, clazz);
}
protected List unsafeTransformToList(
T[] array, UnsafeFunction unsafeFunction)
throws E {
return TransformUtil.unsafeTransformToList(array, unsafeFunction);
}
protected long[] unsafeTransformToLongArray(
Collection collection, UnsafeFunction unsafeFunction)
throws E {
return TransformUtil.unsafeTransformToLongArray(
collection, unsafeFunction);
}
protected AcceptLanguage contextAcceptLanguage;
protected UnsafeBiConsumer
,
UnsafeFunction,
Exception> contextBatchUnsafeBiConsumer;
protected UnsafeBiConsumer
,
UnsafeConsumer, Exception>
contextBatchUnsafeConsumer;
protected com.liferay.portal.kernel.model.Company contextCompany;
protected HttpServletRequest contextHttpServletRequest;
protected HttpServletResponse contextHttpServletResponse;
protected Object contextScopeChecker;
protected UriInfo contextUriInfo;
protected com.liferay.portal.kernel.model.User contextUser;
protected ExpressionConvert
expressionConvert;
protected FilterParserProvider filterParserProvider;
protected GroupLocalService groupLocalService;
protected ResourceActionLocalService resourceActionLocalService;
protected ResourcePermissionLocalService resourcePermissionLocalService;
protected RoleLocalService roleLocalService;
protected SortParserProvider sortParserProvider;
protected VulcanBatchEngineExportTaskResource
vulcanBatchEngineExportTaskResource;
protected VulcanBatchEngineImportTaskResource
vulcanBatchEngineImportTaskResource;
private static final com.liferay.portal.kernel.log.Log _log =
LogFactoryUtil.getLog(BaseWikiPageAttachmentResourceImpl.class);
private class PostWikiPageWikiPageAttachmentRequestBody {
public WikiPageAttachment WikiPageAttachment;
@io.swagger.v3.oas.annotations.media.Schema(
description = "File", format = "binary", type = "string"
)
public String file;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy