Skip to content
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

customer/uk-it-15 #541

Merged
merged 39 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
dc628c9
ufal/downloading-restricted-bitstreams-not-working-properly (#457)
milanmajchrak Nov 15, 2023
2f8a81d
ufal/be-cannot-download-and-preview-files-after-migration (#454)
milanmajchrak Nov 15, 2023
7d1fdb8
ufal/update-canonical-prefix-to-hdl (#460)
milanmajchrak Nov 23, 2023
29880ed
ufal/be-user-registration-missing (#463)
milanmajchrak Dec 1, 2023
e2322c5
ufal/be-license-download-statistics (#462)
milanmajchrak Dec 1, 2023
c01af03
ufal/be-shibboleth-headers-encoding (#464)
milanmajchrak Dec 6, 2023
6eb3726
using our dspace-dependencies
MajoBerger Dec 6, 2023
4b9e7fc
ufal/be-fix-email-parameters
milanmajchrak Dec 13, 2023
989e6e8
ufal/be-provenance-subbmitter-missing (#469)
milanmajchrak Dec 13, 2023
85225d2
ufal/be-get-user-ip-address (#468)
milanmajchrak Dec 14, 2023
f85e76a
ufal/publisher-ok-fix (#473)
milanmajchrak Dec 14, 2023
27abb8a
ufal/zip-preview-configurable (#475)
milanmajchrak Dec 15, 2023
de08f26
ufal/fe-oversized-file-upload-message
milanmajchrak Dec 15, 2023
bad4a91
ufal/be-email-restricted-download
milanmajchrak Dec 21, 2023
7b4bf52
ufal/be-not-show-shib-welcome-page (#485)
milanmajchrak Dec 21, 2023
3f2ecbb
ufal/be-s3-customization (#481)
milanmajchrak Dec 21, 2023
51d7a45
ufal/be-s3-checker-sync (#486)
milanmajchrak Dec 22, 2023
faf9e42
internal/load-version-from-file (#488)
milanmajchrak Jan 3, 2024
bf4f503
ufal/be-s3-checksum-fix (#487)
milanmajchrak Jan 3, 2024
b5cdf03
internal/versioning (#491)
milanmajchrak Jan 5, 2024
2986f5c
ufal/comment-ever-failing-test
milanmajchrak Jan 5, 2024
98c74d7
internal/verion-update-path (#492)
milanmajchrak Jan 8, 2024
88d76fd
internal/be-upgrade-clarin-dspace-7.6 (#497)
milanmajchrak Jan 27, 2024
7e855d9
The cas.init() method is called in the VocabularyRestRepositoryIT#set…
milanmajchrak Jan 27, 2024
220fce8
Update docker.yml (#502)
milanmajchrak Jan 27, 2024
c54fbd4
Update docker.yml (#503)
milanmajchrak Jan 27, 2024
0322cc2
Update docker.yml (#504)
milanmajchrak Jan 27, 2024
0b3cb36
Empty commit - run actions
milanmajchrak Jan 29, 2024
a623f9a
use checkstyle before commit
Jan 29, 2024
93978f8
Merge pull request #501 from dataquest-dev/internal/fix_failing_vocab…
vidiecan Jan 31, 2024
f4dff5d
Merge pull request #506 from dataquest-dev/pre_commit
vidiecan Feb 2, 2024
a9d00d4
remove fix duplicate dependency
Feb 2, 2024
3f7ca7e
remove discofeed related fetching from obsolete discojuice servers (#…
vidiecan Feb 9, 2024
855c369
ufal/cannot-upload-big-file (#533)
milanmajchrak Feb 12, 2024
a2254c2
ufal/license-agreement-wrong-behaviour (#534)
milanmajchrak Feb 15, 2024
2553357
internal/discofeed-it (#535)
milanmajchrak Feb 15, 2024
92df659
allow running from branch rework-actions for testing
MajoBerger Feb 21, 2024
e198b09
ufal/s3-check-etag (#537)
milanmajchrak Feb 21, 2024
ab7a0f2
Merged changes from dtq-dev and resolved conflicts
milanmajchrak Feb 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
repos:
- repo: local
hooks:
- id: mvn-checkstyle
verbose: true
entry: python scripts/pre-commit/checkstyle.py
name: Runs maven checkstyle
language: python
files: \.(java)$
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import java.sql.SQLException;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import java.util.stream.Collectors;

import org.apache.commons.lang.NullArgumentException;
import org.dspace.authorize.AuthorizeException;
Expand Down Expand Up @@ -76,4 +78,44 @@ public void delete(Context context, ClarinUserMetadata clarinUserMetadata) throw
}
clarinUserMetadataDAO.delete(context, clarinUserMetadata);
}

@Override
public List<ClarinUserMetadata> findByUserRegistrationAndBitstream(Context context, Integer userRegUUID,
UUID bitstreamUUID, boolean lastTransaction)
throws SQLException {
if (lastTransaction) {
return getLastTransactionUserMetadata(clarinUserMetadataDAO.findByUserRegistrationAndBitstream(context,
userRegUUID, bitstreamUUID));
}
return clarinUserMetadataDAO.findByUserRegistrationAndBitstream(context, userRegUUID, bitstreamUUID);
}

private List<ClarinUserMetadata> getLastTransactionUserMetadata(List<ClarinUserMetadata> userMetadataList) {
Integer latestTransactionId = getIdOfLastTransaction(userMetadataList);
if (latestTransactionId == null) {
return userMetadataList;
}

List<ClarinUserMetadata> filteredUserMetadata = null;
// Filter all user metadata by the last transaction
try {
filteredUserMetadata = userMetadataList.stream()
.filter(clarinUserMetadata -> clarinUserMetadata.getTransaction().getID()
.equals(latestTransactionId))
.collect(Collectors.toList());
} catch (Exception e) {
log.error("Error filtering user metadata by the last transaction", e);
}
return filteredUserMetadata;
}

private Integer getIdOfLastTransaction(List<ClarinUserMetadata> userMetadataList) {
// userMetadataList is filtered by the last transaction - first element is the last transaction
try {
return userMetadataList.get(0).getTransaction().getID();
} catch (IndexOutOfBoundsException e) {
log.error("No transaction found for the user metadata");
return null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,15 @@
*/
package org.dspace.content.dao.clarin;

import java.sql.SQLException;
import java.util.List;
import java.util.UUID;

import org.dspace.content.clarin.ClarinUserMetadata;
import org.dspace.core.Context;
import org.dspace.core.GenericDAO;

public interface ClarinUserMetadataDAO extends GenericDAO<ClarinUserMetadata> {
List<ClarinUserMetadata> findByUserRegistrationAndBitstream(Context context, Integer userRegUUID,
UUID bitstreamUUID) throws SQLException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,38 @@
*/
package org.dspace.content.dao.impl.clarin;

import java.sql.SQLException;
import java.util.List;
import java.util.UUID;
import javax.persistence.Query;

import org.dspace.content.clarin.ClarinUserMetadata;
import org.dspace.content.dao.clarin.ClarinUserMetadataDAO;
import org.dspace.core.AbstractHibernateDAO;
import org.dspace.core.Context;

public class ClarinUserMetadataDAOImpl extends AbstractHibernateDAO<ClarinUserMetadata>
implements ClarinUserMetadataDAO {

protected ClarinUserMetadataDAOImpl() {
super();
}

@Override
public List<ClarinUserMetadata> findByUserRegistrationAndBitstream(Context context, Integer userRegUUID,
UUID bitstreamUUID) throws SQLException {
Query query = createQuery(context, "SELECT cum FROM ClarinUserMetadata as cum " +
"JOIN cum.eperson as ur " +
"JOIN cum.transaction as clrua " +
"JOIN clrua.licenseResourceMapping as map " +
"WHERE ur.id = :userRegUUID " +
"AND map.bitstream.id = :bitstreamUUID " +
"ORDER BY clrua.id DESC");

query.setParameter("userRegUUID", userRegUUID);
query.setParameter("bitstreamUUID", bitstreamUUID);
query.setHint("org.hibernate.cacheable", Boolean.TRUE);

return list(query);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import java.sql.SQLException;
import java.util.List;
import java.util.UUID;

import org.dspace.authorize.AuthorizeException;
import org.dspace.content.clarin.ClarinUserMetadata;
Expand All @@ -22,4 +23,8 @@ public interface ClarinUserMetadataService {
List<ClarinUserMetadata> findAll(Context context) throws SQLException;
void update(Context context, ClarinUserMetadata clarinUserMetadata) throws SQLException;
void delete(Context context, ClarinUserMetadata clarinUserMetadata) throws SQLException, AuthorizeException;

List<ClarinUserMetadata> findByUserRegistrationAndBitstream(Context context, Integer userRegUUID,
UUID bitstreamUUID, boolean lastTransaction)
throws SQLException;
}
Loading
Loading