Skip to content

Commit

Permalink
SAK-33238 DelegatedAccess fixing up some missing Override annotations (
Browse files Browse the repository at this point in the history
  • Loading branch information
ottenhoff authored Jun 5, 2024
1 parent a73bad6 commit 1822e4d
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 119 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ public boolean isVisible() {
//Headers
Link<Void> userIdSort = new Link<Void>("userIdSortLink"){
private static final long serialVersionUID = 1L;
public void onClick() {
@Override
public void onClick() {
changeOrder(DelegatedAccessConstants.SEARCH_COMPARE_EID);
}

Expand All @@ -99,7 +100,8 @@ public boolean isVisible() {
add(userIdSort);
Link<Void> nameSort = new Link<Void>("nameSortLink"){
private static final long serialVersionUID = 1L;
public void onClick() {
@Override
public void onClick() {
changeOrder(DelegatedAccessConstants.SEARCH_COMPARE_SORT_NAME);
}

Expand All @@ -111,7 +113,8 @@ public boolean isVisible() {
add(nameSort);
Link<Void> emailSort = new Link<Void>("emailSortLink"){
private static final long serialVersionUID = 1L;
public void onClick() {
@Override
public void onClick() {
changeOrder(DelegatedAccessConstants.SEARCH_COMPARE_EMAIL);
}

Expand All @@ -123,7 +126,8 @@ public boolean isVisible() {
add(emailSort);
Link<Void> typeSort = new Link<Void>("typeSortLink"){
private static final long serialVersionUID = 1L;
public void onClick() {
@Override
public void onClick() {
changeOrder(DelegatedAccessConstants.SEARCH_COMPARE_TYPE);
}

Expand All @@ -142,14 +146,16 @@ public void populateItem(final Item item) {
item.add(new Label("userId", searchResult.getEid()));
Link<Void> userEditLink = new Link("editLink"){
private static final long serialVersionUID = 1L;
public void onClick() {
@Override
public void onClick() {
setResponsePage(new UserEditPage(searchResult.getId(), searchResult.getDisplayName()));
}
};
item.add(userEditLink);
Link<Void> userViewLink = new Link("viewLink"){
private static final long serialVersionUID = 1L;
public void onClick() {
@Override
public void onClick() {
setResponsePage(new SearchAccessPage(false, searchResult.getEid()));
}
};
Expand All @@ -172,11 +178,8 @@ public boolean isVisible() {

@Override
public boolean isVisible() {
if(provider.size() > DelegatedAccessConstants.SEARCH_RESULTS_PAGE_SIZE) {
return true;
}
return false;
}
return provider.size() > DelegatedAccessConstants.SEARCH_RESULTS_PAGE_SIZE;
}

@Override
public void onBeforeRender() {
Expand All @@ -190,11 +193,8 @@ public void onBeforeRender() {

@Override
public boolean isVisible() {
if(provider.size() > DelegatedAccessConstants.SEARCH_RESULTS_PAGE_SIZE) {
return true;
}
return false;
}
return provider.size() > DelegatedAccessConstants.SEARCH_RESULTS_PAGE_SIZE;
}

@Override
public void onBeforeRender() {
Expand Down Expand Up @@ -232,20 +232,20 @@ private class SearchResultDataProvider implements IDataProvider<SearchResult>{
private int lastOrderBy = DelegatedAccessConstants.SEARCH_COMPARE_DEFAULT;

private List<SearchResult> list;
public void detach() {

}

public void detachManually(){
this.list = null;
}
public Iterator<? extends SearchResult> iterator(long first, long count) {
@Override
public Iterator<? extends SearchResult> iterator(long first, long count) {
//should really check bounds here
int f = (int) first;
int c = (int) count;
return getData().subList(f, f + c).iterator();
}

public IModel<SearchResult> model(final SearchResult object) {
@Override
public IModel<SearchResult> model(final SearchResult object) {
return new IModel<SearchResult>() {
private static final long serialVersionUID = 1L;

Expand All @@ -256,7 +256,8 @@ public SearchResult getObject() {
};
}

public long size() {
@Override
public long size() {
return getData().size();
}

Expand All @@ -268,8 +269,7 @@ private List<SearchResult> getData(){
//only allow super admins to modify their own permissions,
//otherwise, remove the current user's id
String userId = sakaiProxy.getCurrentUserId();
for (Iterator userItr = list.iterator(); userItr
.hasNext();) {
for (Iterator<SearchResult> userItr = list.iterator(); userItr.hasNext();) {
SearchResult user = (SearchResult) userItr.next();
if(userId.equals(user.getId())){
userItr.remove();
Expand All @@ -279,7 +279,7 @@ private List<SearchResult> getData(){
}
sortList();
}else{
list = new ArrayList<SearchResult>();
list = new ArrayList<>();
}
}else if(lastOrderAsc != orderAsc || lastOrderBy != orderBy){
sortList();
Expand All @@ -288,7 +288,7 @@ private List<SearchResult> getData(){
}

private void sortList(){
Collections.sort(list, new SearchResultComparator(orderBy));
list.sort(new SearchResultComparator(orderBy));
if(!orderAsc){
Collections.reverse(list);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ public class UserPage extends BaseTreePage{
public List<String> nodeSelectOrder;
public Map<String, String> hierarchyLabels = new HashMap<String, String>();

protected AbstractTree getTree()
@Override
protected AbstractTree getTree()
{
return tree;
}
Expand Down Expand Up @@ -177,11 +178,6 @@ protected void onJunctionLinkClicked(AjaxRequestTarget target, Object node) {
}
}
}

@Override
protected boolean isForceRebuildOnSelectionChange() {
return false;
};
};
tree.setRootLess(true);
add(tree);
Expand Down Expand Up @@ -233,7 +229,7 @@ protected void onSubmit() {
hierarchySearchFields.put(entry.getKey(), entry.getValue().getValue().trim());
}
}
if(hierarchySearchFields.size() > 0){
if(!hierarchySearchFields.isEmpty()){
advancedOptions.put(DelegatedAccessConstants.ADVANCED_SEARCH_HIERARCHY_FIELDS, hierarchySearchFields);
}
//need to set the tree model so that is is the full model
Expand Down Expand Up @@ -292,7 +288,7 @@ public boolean isVisible() {
final String[] hierarchy = hierarchyTmp;
WebMarkupContainer hierarchyDiv = new WebMarkupContainer("hierarchyFields");
final Comparator<SelectOption> optionComparator = new SelectOptionComparator();
if(hierarchySelectOptions == null || hierarchySelectOptions.size() == 0){
if(hierarchySelectOptions == null || hierarchySelectOptions.isEmpty()){
nodeSelectOrder = new ArrayList<String>();
hierarchySearchMap = new HashMap<String, SelectOption>();
for(String s : hierarchy){
Expand All @@ -311,17 +307,12 @@ public boolean isVisible() {
for(String s : entry.getValue()){
options.add(new SelectOption(s, s));
}
Collections.sort(options, optionComparator);
options.sort(optionComparator);
hierarchySelectOptions.put(entry.getKey(), options);
}
}
DataView dropdowns = new DataView("hierarchyDropdowns", new IDataProvider<String>(){

@Override
public void detach() {

}

@Override
public Iterator<? extends String> iterator(long first, long count) {
//should really check bounds here
Expand Down Expand Up @@ -357,7 +348,8 @@ protected void populateItem(Item item) {
//keeps the null option (choose one) after a user selects an option
choice.setNullValid(true);
choice.add(new AjaxFormComponentUpdatingBehavior("onchange"){
protected void onUpdate(AjaxRequestTarget target) {
@Override
protected void onUpdate(AjaxRequestTarget target) {
Map<String, String> searchParams = new HashMap<String, String>();
for(Entry<String, SelectOption> entry : hierarchySearchMap.entrySet()){
searchParams.put(entry.getKey(), entry.getValue() == null ? "" : entry.getValue().getValue());
Expand All @@ -369,7 +361,7 @@ protected void onUpdate(AjaxRequestTarget target) {
for(String s : entry.getValue()){
options.add(new SelectOption(s, s));
}
Collections.sort(options, optionComparator);
options.sort(optionComparator);
hierarchySelectOptions.put(entry.getKey(), options);
}

Expand All @@ -379,19 +371,14 @@ protected void onUpdate(AjaxRequestTarget target) {
});
item.add(choice);
}


};
hierarchyDiv.add(dropdowns);
form.add(hierarchyDiv);


// form.add(new WebMarkupContainer("searchHeader"));
// form.add(new Button("submitButton"));

add(form);


}

private void setTreeModel(String userId, boolean cascade){
Expand Down Expand Up @@ -429,11 +416,6 @@ public NodeSelectModel(String nodeId){
this.nodeId = nodeId;
}

@Override
public void detach() {

}

@Override
public SelectOption getObject() {
return hierarchySearchMap.get(nodeId);
Expand Down
Loading

0 comments on commit 1822e4d

Please sign in to comment.