Skip to content

Commit

Permalink
Merge branch 'main' into bugfix/4602-Project-specific-user-preference…
Browse files Browse the repository at this point in the history
…s-may-be-saved-without-a-user

* main:
  #4600 - Error when exporting project during preference phase
  No issue: Fix example CSS file for custom XML format which was actually an SCSS file

% Conflicts:
%	inception/inception-preferences/src/main/java/de/tudarmstadt/ukp/inception/preferences/PreferencesServiceImpl.java
  • Loading branch information
reckart committed Mar 7, 2024
2 parents 9d6b468 + c8eca75 commit 8d13bf3
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@ tt|p {
border-radius: 0.5em;
margin-top: 0.25em;
margin-bottom: 0.25em;
}
&::before {
border-radius: 0.5em 0em 0em 0.5em;
display: inline-block;
padding-left: 0.5em;
padding-right: 0.5em;
margin-right: 0.5em;
background-color: lightgray;
min-width: 10em;
content: attr(agent) '\a0';
}
tt|p::before {
border-radius: 0.5em 0em 0em 0.5em;
display: inline-block;
padding-left: 0.5em;
padding-right: 0.5em;
margin-right: 0.5em;
background-color: lightgray;
min-width: 10em;
content: attr(agent) '\a0';
}
----

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import static java.util.Objects.requireNonNull;

import java.io.IOException;
import java.lang.invoke.MethodHandles;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
Expand All @@ -41,6 +42,7 @@
import de.tudarmstadt.ukp.inception.preferences.model.DefaultProjectPreference;
import de.tudarmstadt.ukp.inception.preferences.model.UserPreference;
import de.tudarmstadt.ukp.inception.preferences.model.UserProjectPreference;
import de.tudarmstadt.ukp.inception.preferences.model.UserProjectPreference_;
import de.tudarmstadt.ukp.inception.support.json.JSONUtil;

/**
Expand All @@ -52,7 +54,7 @@
public class PreferencesServiceImpl
implements PreferencesService
{
private static final Logger LOG = LoggerFactory.getLogger(PreferencesServiceImpl.class);
private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

private final @PersistenceContext EntityManager entityManager;

Expand Down Expand Up @@ -243,14 +245,14 @@ public List<UserProjectPreference> listUserPreferencesForProject(Project aProjec
{
requireNonNull(aProject, "Parameter [project] must be specified");

String query = String.join("\n", //
"FROM UserProjectPreference ", //
"WHERE project = :project");
var builder = entityManager.getCriteriaBuilder();
var query = builder.createQuery(UserProjectPreference.class);
var root = query.from(UserProjectPreference.class);

return entityManager //
.createQuery(query, UserProjectPreference.class) //
.setParameter("project", aProject) //
.getResultList();
query.select(root);
query.where(builder.equal(root.get(UserProjectPreference_.project), aProject));

return entityManager.createQuery(query).getResultList();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,7 @@

<changeSet author="INCEpTION Team" id="20240307-1">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="user_project_preference" />
</not>
<tableExists tableName="user_project_preference" />
</preConditions>
<delete tableName="user_project_preference">
<where>user IS NULL</where>
Expand All @@ -134,9 +132,7 @@

<changeSet author="INCEpTION Team" id="20240307-2">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="user_preference" />
</not>
<tableExists tableName="user_preference" />
</preConditions>
<delete tableName="user_project_preference">
<where>user IS NULL</where>
Expand All @@ -146,11 +142,9 @@

<changeSet author="INCEpTION Team" id="20240307-3">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="default_project_preference" />
</not>
<tableExists tableName="default_project_preference" />
</preConditions>
<delete tableName="user_project_preference">
<delete tableName="default_project_preference">
<where>project IS NULL</where>
</delete>
<addNotNullConstraint tableName="default_project_preference" columnName="project" columnDataType="BIGINT"/>
Expand Down

0 comments on commit 8d13bf3

Please sign in to comment.