-
Notifications
You must be signed in to change notification settings - Fork 467
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
#30277 API/Factory methods to insert in the unique_fields table #30332
#30277 API/Factory methods to insert in the unique_fields table #30332
Conversation
…sert-in-the-unique_fields-table
Pull request was converted to draft
…sert-in-the-unique_fields-table
…-unique_fields-table' of https://github.com/dotCMS/core into issue-30277-Create-API-Factory-methods-to-insert-in-the-unique_fields-table
…sert-in-the-unique_fields-table
…sert-in-the-unique_fields-table
/** | ||
* This API allow you to interact with the unique_fields table | ||
*/ | ||
public interface UniqueFieldAPI { |
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.
Do we really need a separate API for unique fields? Why not using the existing Field API?
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.
I think it is ok but should be called UniqueAPI and be able to use with other things not only field
at the end it is key value stuff
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.
@jcastro-dotcms it have too much logic bi itself so that is why I think a new API and Factory are better, also is a different table
@jdotcms Really it is just for field right now if in the future we need it to be used for more cases then we can rename it and change the method signature but for now I don't think we should do changes for something that maybe never happend
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.
done 504efaa
…-unique_fields-table' of https://github.com/dotCMS/core into issue-30277-Create-API-Factory-methods-to-insert-in-the-unique_fields-table
/** | ||
* This Helper allow you to interact with the unique_fields table | ||
*/ | ||
public class UniqueFieldAPIHelper { |
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.
I think helper is tied to Resources on dotCMS, for biz logic we used to use Util
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.
* @throws UniqueFieldValueDupliacatedException when the Value is duplicated | ||
* @throws DotDataException when a DotDataException is throws | ||
*/ | ||
public void insert(final UniqueFieldCriteria uniqueFieldCriteria, final String contentletId) |
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.
missing annotation here
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.
*/ | ||
public void insert(final UniqueFieldCriteria uniqueFieldCriteria, final String contentletId) | ||
throws UniqueFieldValueDupliacatedException, 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.
may be add some logs for the support guys in the future
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.
* @param supportingValues | ||
*/ | ||
@Override | ||
public void insert(final String key, final Map<String, Object> supportingValues) 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.
the factory concept usually is next to an API, since you do not have any, and there are not any plans of covering more general cases, this is just a single line you may move straight to the Helper/API you have
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.
I think is better kepp the Factory because I am going to include more SQL Statement here later
/** | ||
* Throw if try to insert a duplicated register in unique_fiedls table | ||
*/ | ||
public class UniqueFieldValueDupliacatedException extends Exception{ |
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.
typo here
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.
done 0aa9ced
…sert-in-the-unique_fields-table
Pull request was converted to draft
…API-Factory-methods-to-insert-in-the-unique_fields-table
…sert-in-the-unique_fields-table
…-unique_fields-table' of https://github.com/dotCMS/core into issue-30277-Create-API-Factory-methods-to-insert-in-the-unique_fields-table
Quality Gate passedIssues Measures |
Proposed Changes
this APi Method is going to be sued here Use new Database validation for Unique Fields when a Contentlets is saved or updated #30279