-
Notifications
You must be signed in to change notification settings - Fork 61
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
[RESSUP-1356] Add Sort ID to Custom Attribute Document #1605
Open
chao-yue
wants to merge
2
commits into
kuali:contrib
Choose a base branch
from
iu-uits-es:RESSUP-1356
base: contrib
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
...esources/co/kuali/coeus/data/migration/sql/oracle/kc/bootstrap/V1601_002__RESSUP-1356.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-- RESSUP-1356 | ||
|
||
ALTER TABLE CUSTOM_ATTRIBUTE_DOCUMENT ADD SORT_ID NUMBER(12,0); | ||
|
||
|
49 changes: 49 additions & 0 deletions
49
...rc/main/java/org/kuali/coeus/common/framework/custom/CustomAttributeSortIdComparator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package org.kuali.coeus.common.framework.custom; | ||
|
||
import java.util.Comparator; | ||
|
||
import org.kuali.coeus.common.framework.custom.attr.CustomAttributeDocument; | ||
|
||
/** Add Sort ID to Custom Attribute Document Maintenance Document */ | ||
/** | ||
* | ||
* 1. If SORT_IDs for all the custom data fields have been defined, then display them based on the | ||
* SORT_ID in ascending order from the top to the bottom under the Full Group Name: *** sub panel | ||
* | ||
* 2. If none of the custom data fields has SORT_ID defined, then display them alphabetically | ||
* | ||
* 3. If some of the custom data fields have SORT_ID defined while the rest do not, then display all of the fields with a SORT_ID first, | ||
* organized by sort ID. Then list the ones without a SORT_ID in alphabetical order. | ||
* | ||
*/ | ||
public class CustomAttributeSortIdComparator implements Comparator<CustomAttributeDocument> { | ||
|
||
private static final int MAX_CUSTOM_DATA_SORT_ID = 999999; | ||
|
||
public int compare(CustomAttributeDocument cad1, CustomAttributeDocument cad2) { | ||
try { | ||
String label1 = cad1.getCustomAttribute().getLabel(); | ||
String label2 = cad2.getCustomAttribute().getLabel(); | ||
if (label1 == null) { | ||
label1 = ""; | ||
} | ||
if (label2 == null) { | ||
label2 = ""; | ||
} | ||
|
||
if(cad1.getSortId() == null) { | ||
cad1.setSortId(new Integer(MAX_CUSTOM_DATA_SORT_ID)); | ||
} | ||
if(cad2.getSortId() == null) { | ||
cad2.setSortId(new Integer(MAX_CUSTOM_DATA_SORT_ID)); | ||
} | ||
|
||
int sortIdComp = cad1.getSortId().compareTo(cad2.getSortId()); | ||
return ((sortIdComp == 0) ? label1.compareTo(label2) : sortIdComp); | ||
} | ||
catch (Exception e) { | ||
return 0; | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
should extend KraSortablePersistableBusinessObjectBase
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.
Hi Travis,
The changes have been pushed to RESSUP-1356.
Thanks,
Chao
From: Travis Schneeberger <[email protected]mailto:[email protected]>
Reply-To: kuali/kc <[email protected]mailto:[email protected]>
Date: Monday, March 14, 2016 1:24 PM
To: kuali/kc <[email protected]mailto:[email protected]>
Cc: Chao Yue <[email protected]mailto:[email protected]>
Subject: Re: [kc] [RESSUP-1356] Add Sort ID to Custom Attribute Document (#1605)
In coeus-impl/src/main/java/org/kuali/coeus/common/framework/custom/attr/CustomAttributeDocument.javahttps://github.com//pull/1605#discussion_r56039542:
should extend KraSortablePersistableBusinessObjectBase
Reply to this email directly or view it on GitHubhttps://github.com//pull/1605/files#r56039542.