Skip to content

Commit

Permalink
[irods-contrib#214][irods-contrib#327] Removed all code that depends …
Browse files Browse the repository at this point in the history
…on the Metalnx database.

- Removed code for favorites, templates, user profiles, and bookmarks.
- Removed references to the deleted forms and user fields
- Changed UserService.findByQueryString to UserService.findByUsername as
the user name is the only field that can be queried since the other
fields were all stored in the local Metalnx database.
- Removed the database sync jobs.

This fixes issue irods-contrib#327 as user info is now obtained directly from iRODS.
  • Loading branch information
JustinKyleJames committed Dec 5, 2024
1 parent f79537e commit ee98a3b
Show file tree
Hide file tree
Showing 39 changed files with 7 additions and 3,844 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.irods.jargon.core.exception.JargonException;
import org.irods.jargon.core.utils.MiscIRODSUtils;
import org.irods.jargon.extensions.dataprofiler.DataProfile;
import org.irodsext.dataprofiler.favorites.FavoritesService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -64,7 +63,6 @@
import com.emc.metalnx.services.interfaces.PermissionsService;
import com.emc.metalnx.services.interfaces.ResourceService;
import com.emc.metalnx.services.interfaces.RuleDeploymentService;
import com.emc.metalnx.services.interfaces.UserBookmarkService;
import com.emc.metalnx.services.interfaces.UserService;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
Expand Down Expand Up @@ -95,9 +93,6 @@ public class BrowseController {
@Autowired
GroupService groupService;

@Autowired
UserBookmarkService userBookmarkService;

@Autowired
MetadataService metadataService;

Expand All @@ -107,9 +102,6 @@ public class BrowseController {
@Autowired
IRODSServices irodsServices;

@Autowired
FavoritesService favoritesService;

@Autowired
LoggedUserUtils loggedUserUtils;

Expand Down Expand Up @@ -439,7 +431,6 @@ public String getDirectoriesAndFilesForUser(final Model model, @RequestParam("pa
Set<String> writePermissions = new HashSet<String>();
Set<String> ownershipPermissions = new HashSet<String>();
Set<String> inheritPermissions = new HashSet<String>();
List<String> userBookmarks = new ArrayList<String>();

// If a string is null, empty or contains only white spaces, StringUtils
// returns true
Expand All @@ -463,11 +454,6 @@ public String getDirectoriesAndFilesForUser(final Model model, @RequestParam("pa
// may not find based on permissions..it's ok
}
}

List<DataGridUser> users = userService.findByUsername(username);
if (users != null && !users.isEmpty()) {
userBookmarks = userBookmarkService.findBookmarksForUserAsString(users.get(0));
}
}
}

Expand All @@ -479,9 +465,6 @@ public String getDirectoriesAndFilesForUser(final Model model, @RequestParam("pa
model.addAttribute("writePermissions", writePermissions);
model.addAttribute("ownershipPermissions", ownershipPermissions);
model.addAttribute("inheritPermissions", inheritPermissions);
model.addAttribute("addBookmark", new ArrayList<String>());
model.addAttribute("removeBookmark", new ArrayList<String>());
model.addAttribute("userBookmarks", userBookmarks);
logger.info("model:{}", model);

logger.info("done with processing:{}", model);
Expand Down Expand Up @@ -575,28 +558,8 @@ public String modifyAction(@ModelAttribute final CollectionOrDataObjectForm coll
boolean modificationSuccessful = cs.modifyCollectionAndDataObject(previousPath, newPath,
collForm.getInheritOption());

// checking if the previousPath collection/dataobject was marked as favorite:
String username = irodsServices.getCurrentUser();
String zoneName = irodsServices.getCurrentUserZone();
DataGridUser user = userService.findByUsernameAndAdditionalInfo(username, zoneName);
boolean isMarkedFavorite = favoritesService.isPathFavoriteForUser(user, previousPath);
logger.info("Favorite status for previousPath: " + previousPath + " is: " + String.valueOf(isMarkedFavorite));

if (modificationSuccessful) {
logger.debug("Collection/Data Object {} modified to {}", previousPath, newPath);

if (isMarkedFavorite) {
Set<String> toAdd = new HashSet<String>();
Set<String> toRemove = new HashSet<String>();
toAdd.add(newPath);
toRemove.add(previousPath);
boolean operationResult = favoritesService.updateFavorites(user, toAdd, toRemove);
if (operationResult) {
logger.info("Favorite re-added successfully for: " + newPath);
} else {
logger.info("Error re-adding favorite to: " + newPath);
}
}
redirectAttributes.addFlashAttribute("collectionModifiedSuccessfully", collForm.getCollectionName());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.irods.jargon.core.exception.JargonException;
import org.irods.jargon.core.utils.CollectionAndPath;
import org.irods.jargon.core.utils.MiscIRODSUtils;
import org.irodsext.dataprofiler.favorites.FavoritesService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -38,7 +37,6 @@
import com.emc.metalnx.services.interfaces.PermissionsService;
import com.emc.metalnx.services.interfaces.ResourceService;
import com.emc.metalnx.services.interfaces.RuleDeploymentService;
import com.emc.metalnx.services.interfaces.UserBookmarkService;
import com.emc.metalnx.services.interfaces.UserService;
import com.emc.metalnx.services.interfaces.mail.MailService;

Expand All @@ -60,9 +58,6 @@ public class CollectionController {
@Autowired
GroupService groupService;

@Autowired
UserBookmarkService userBookmarkService;

@Autowired
MetadataService metadataService;

Expand All @@ -72,9 +67,6 @@ public class CollectionController {
@Autowired
IRODSServices irodsServices;

@Autowired
FavoritesService favoritesService;

@Autowired
LoggedUserUtils loggedUserUtils;

Expand Down Expand Up @@ -281,14 +273,6 @@ public void setGroupService(GroupService groupService) {
this.groupService = groupService;
}

public UserBookmarkService getUserBookmarkService() {
return userBookmarkService;
}

public void setUserBookmarkService(UserBookmarkService userBookmarkService) {
this.userBookmarkService = userBookmarkService;
}

public MetadataService getMetadataService() {
return metadataService;
}
Expand All @@ -313,14 +297,6 @@ public void setIrodsServices(IRODSServices irodsServices) {
this.irodsServices = irodsServices;
}

public FavoritesService getFavoritesService() {
return favoritesService;
}

public void setFavoritesService(FavoritesService favoritesService) {
this.favoritesService = favoritesService;
}

public LoggedUserUtils getLoggedUserUtils() {
return loggedUserUtils;
}
Expand Down

This file was deleted.

Loading

0 comments on commit ee98a3b

Please sign in to comment.