Skip to content

Commit

Permalink
address code quality issues #EA-3823
Browse files Browse the repository at this point in the history
  • Loading branch information
GordeaS authored and GordeaS committed Jun 27, 2024
1 parent dd497c2 commit 35258da
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ ItemIdsResultPage buildItemIdsResultsPage(String setId, List<String> itemIds, in
* Gets the profile for pagination urls and item page. Basically gets the profile valid for
* collection page from the list of profiles passed during search request
*
* @param profiles
* @return
* @param profiles list of candidate profiles
* @return the profile to be applied for generating the pagination
*/
LdProfiles getProfileForPagination(List<LdProfiles> profiles);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,9 +485,7 @@ protected ResponseEntity<String> insertItemIntoUserSet(HttpServletRequest reques
try {
// validate params - profile
List<LdProfiles> profiles = getProfiles(profileStr, request);
// get profile for pagination urls and item Page
LdProfiles profile = getUserSetService().getProfileForPagination(profiles);


// check if the Set exists, if not respond with HTTP 404
// retrieve an existing user set based on its identifier
UserSet existingUserSet = getUserSetService().getUserSetById(identifier);
Expand Down Expand Up @@ -518,6 +516,10 @@ protected ResponseEntity<String> insertItemIntoUserSet(HttpServletRequest reques
checkIfMatchHeader(eTagOrigin, request);
UserSet updatedUserSet =
getUserSetService().insertItem(datasetId, localId, position, existingUserSet);

// get profile for pagination urls and item Page
LdProfiles profile = getUserSetService().getProfileForPagination(profiles);

String serializedUserSetJsonLdStr = serializeUserSet(profile, updatedUserSet);

String etag =
Expand Down Expand Up @@ -666,8 +668,6 @@ protected ResponseEntity<String> deleteItemFromUserSet(HttpServletRequest reques
try {
// validate params - profile
List<LdProfiles> profiles = getProfiles(profileStr, request);
// get profile for pagination urls and item Page
LdProfiles profile = getUserSetService().getProfileForPagination(profiles);

// check if the Set exists, if not respond with HTTP 404
// retrieve an existing user set based on its identifier
Expand Down Expand Up @@ -707,6 +707,9 @@ protected ResponseEntity<String> deleteItemFromUserSet(HttpServletRequest reques
// update an existing user set
UserSet updatedUserSet = getUserSetService().updateItemList(existingUserSet);

// get profile for pagination urls and item Page
LdProfiles profile = getUserSetService().getProfileForPagination(profiles);

// serialize to JsonLd
String serializedUserSetJsonLdStr = serializeUserSet(profile, updatedUserSet);
String etag =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import org.springframework.http.HttpStatus;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import eu.europeana.api.commons.config.i18n.I18nService;
import eu.europeana.api.commons.definitions.vocabulary.CommonApiConstants;
import eu.europeana.api.commons.oauth2.model.ApiCredentials;
import eu.europeana.api.commons.web.exception.ApplicationAuthenticationException;
Expand Down Expand Up @@ -50,8 +49,6 @@ public abstract class BaseUserSetServiceImpl implements UserSetService {

@Resource(name = UserSetConfiguration.BEAN_SET_PERSITENCE_SERVICE)
PersistentUserSetService mongoPersistance;
@Resource
I18nService i18nService;

UserSetUtils userSetUtils = new UserSetUtils();

Expand Down

0 comments on commit 35258da

Please sign in to comment.