All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.liferay.object.rest.internal.jaxrs.exception.mapper.ObjectEntryCountExceptionMapper Maven / Gradle / Ivy

There is a newer version: 1.0.149
Show newest version
/**
 * SPDX-FileCopyrightText: (c) 2023 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.object.rest.internal.jaxrs.exception.mapper;

import com.liferay.object.exception.ObjectEntryCountException;
import com.liferay.object.jaxrs.exception.mapper.util.ObjectExceptionMapperUtil;
import com.liferay.portal.kernel.language.Language;
import com.liferay.portal.vulcan.accept.language.AcceptLanguage;
import com.liferay.portal.vulcan.jaxrs.exception.mapper.BaseExceptionMapper;
import com.liferay.portal.vulcan.jaxrs.exception.mapper.Problem;

import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.Provider;

/**
 * @author Thalles Montenegro
 */
@Provider
public class ObjectEntryCountExceptionMapper
	extends BaseExceptionMapper {

	public ObjectEntryCountExceptionMapper(Language language) {
		_language = language;
	}

	@Override
	protected Problem getProblem(
		ObjectEntryCountException objectEntryCountException) {

		return new Problem(
			Response.Status.BAD_REQUEST,
			ObjectExceptionMapperUtil.getTitle(
				_acceptLanguage, objectEntryCountException.getArguments(),
				_language, objectEntryCountException.getMessage(),
				objectEntryCountException.getMessageKey()));
	}

	@Context
	private AcceptLanguage _acceptLanguage;

	private final Language _language;

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy