New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#27979 new lang vars endpoint #28237
Conversation
…tCMS/core into issue-27979-lang-vars-backend
…tCMS/core into issue-27979-lang-vars-backend
@fabrizzio-dotCMS about your concern here "My Main concern here is that the new methods are designed to simply return the LanguageVariables no user or permission is contemplated here. I need to know if we're gonna need to do that." ....we agreed that the language variables would inherit permissions from the LanguageVariable content type |
@nollymar The second method I'm introducing here is the one I intend to use to replace the properties LanguageKey on that one I introduced a User. And I perform a permission check. My reasoning here is that we can always call it using system user. to get everything |
@wezell do we want to get language variables from the database? I understand that we don't want to depend on ES for it and @fabrizzio-dotCMS is caching those records after hitting the database. However, considering that language variables are pieces of content now, shouldn't we just leverage on the index the same way we do in Content Search for example? On the other hand, @fabrizzio-dotCMS has another point that is totally valid ... we shouldn't rely on ES when a user wants to use a specific language variable. We would like to have your input on it. |
Quality Gate passedIssues Measures |
dotCMS/src/main/java/com/dotcms/content/elasticsearch/business/ESContentFactoryImpl.java
Show resolved
Hide resolved
@CloseDBIfOpened | ||
@Override | ||
public List<LanguageVariable> findVariables(final long langId, final User user) throws DotDataException { | ||
final ContentletFactory contentletFactory = FactoryLocator.getContentletFactory(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log inputs
@@ -0,0 +1,63 @@ | |||
package com.dotcms.rest; | |||
|
|||
public class AbstractPaginationContext { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice abstraction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but create a buider
public Response getVariables( | ||
@Context final HttpServletRequest request, | ||
@Context final HttpServletResponse response, | ||
@BeanParam final PaginationContext paginationContext) throws DotDataException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keep in mind we already have some standard to do pagination by PaginationUtil, take a look
*/ | ||
@Override | ||
public int countByTypeWorkingOrLive(final ContentType contentType, final boolean working) { | ||
final DotConnect dotConnect = new DotConnect(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you want you can reduce this to one line
return new DotConnect().setSQL("select count(distinct contentlet.identifier) as x "
+ " from contentlet, contentlet_version_info, inode "
+ " where contentlet.structure_inode = ? "
+ " and contentlet_version_info.identifier = contentlet.identifier "
+ " and contentlet_version_info."+ (working?WORKING_INODE:LIVE_INODE)+"= contentlet.inode "
+ " and contentlet.inode = inode.inode "
+ " and contentlet_version_info.deleted = 'false' ")
.addParam(contentType.inode()).dotConnect.getInt("x");
closed in favor of #28429 |
Proposed Changes