diff --git a/profile2/api/src/java/org/sakaiproject/profile2/logic/ProfilePrivacyLogic.java b/profile2/api/src/java/org/sakaiproject/profile2/logic/ProfilePrivacyLogic.java index 9aa2575ca6a5..6f7d05c27bc0 100644 --- a/profile2/api/src/java/org/sakaiproject/profile2/logic/ProfilePrivacyLogic.java +++ b/profile2/api/src/java/org/sakaiproject/profile2/logic/ProfilePrivacyLogic.java @@ -16,7 +16,6 @@ package org.sakaiproject.profile2.logic; import org.sakaiproject.profile2.model.ProfilePrivacy; -import org.sakaiproject.profile2.types.PreferenceType; import org.sakaiproject.profile2.types.PrivacyType; /** diff --git a/profile2/api/src/java/org/sakaiproject/profile2/model/FriendConfirmBullhornHandler.java b/profile2/api/src/java/org/sakaiproject/profile2/model/FriendConfirmBullhornHandler.java index 9d55f3916917..5db14a95a176 100644 --- a/profile2/api/src/java/org/sakaiproject/profile2/model/FriendConfirmBullhornHandler.java +++ b/profile2/api/src/java/org/sakaiproject/profile2/model/FriendConfirmBullhornHandler.java @@ -68,8 +68,8 @@ public Optional> handleEvent(Event e) { transactionTemplate.execute(status -> { sessionFactory.getCurrentSession().createQuery("delete BullhornAlert where event = :event and fromUser = :fromUser") - .setString("event", ProfileConstants.EVENT_FRIEND_REQUEST) - .setString("fromUser", to).executeUpdate(); + .setParameter("event", ProfileConstants.EVENT_FRIEND_REQUEST) + .setParameter("fromUser", to).executeUpdate(); return null; }); } catch (Exception e1) { diff --git a/profile2/api/src/java/org/sakaiproject/profile2/model/FriendIgnoreBullhornHandler.java b/profile2/api/src/java/org/sakaiproject/profile2/model/FriendIgnoreBullhornHandler.java index 6358f484866f..c776962cd72b 100644 --- a/profile2/api/src/java/org/sakaiproject/profile2/model/FriendIgnoreBullhornHandler.java +++ b/profile2/api/src/java/org/sakaiproject/profile2/model/FriendIgnoreBullhornHandler.java @@ -63,8 +63,8 @@ public Optional> handleEvent(Event e) { transactionTemplate.execute(status -> { sessionFactory.getCurrentSession().createQuery("delete BullhornAlert where event = :event and fromUser = :fromUser") - .setString("event", ProfileConstants.EVENT_FRIEND_REQUEST) - .setString("fromUser", to).executeUpdate(); + .setParameter("event", ProfileConstants.EVENT_FRIEND_REQUEST) + .setParameter("fromUser", to).executeUpdate(); return null; }); } catch (Exception e1) { diff --git a/profile2/impl/src/java/org/sakaiproject/profile2/conversion/ProfileConverter.java b/profile2/impl/src/java/org/sakaiproject/profile2/conversion/ProfileConverter.java index 062b4cdc06da..6a9497970149 100644 --- a/profile2/impl/src/java/org/sakaiproject/profile2/conversion/ProfileConverter.java +++ b/profile2/impl/src/java/org/sakaiproject/profile2/conversion/ProfileConverter.java @@ -44,7 +44,6 @@ import org.sakaiproject.profile2.util.ProfileConstants; import org.sakaiproject.profile2.util.ProfileUtils; -import com.opencsv.bean.CsvToBean; import com.opencsv.bean.CsvToBeanBuilder; import com.opencsv.bean.HeaderColumnNameTranslateMappingStrategy; diff --git a/profile2/impl/src/java/org/sakaiproject/profile2/dao/impl/ProfileDaoImpl.java b/profile2/impl/src/java/org/sakaiproject/profile2/dao/impl/ProfileDaoImpl.java index 5e33cdf53bf9..3e1c5f1b2ec8 100644 --- a/profile2/impl/src/java/org/sakaiproject/profile2/dao/impl/ProfileDaoImpl.java +++ b/profile2/impl/src/java/org/sakaiproject/profile2/dao/impl/ProfileDaoImpl.java @@ -73,7 +73,7 @@ public List getRequestedConnectionUserIdsForUser(final String userId) { final HibernateCallback> hcb = session -> { final Query q = session.getNamedQuery(QUERY_GET_FRIEND_REQUESTS_FOR_USER); q.setParameter(USER_UUID, userId, StringType.INSTANCE); - q.setBoolean("false", Boolean.FALSE); + q.setParameter("false", Boolean.FALSE); //q.setResultTransformer(Transformers.aliasToBean(Friend.class)); return q.list(); @@ -92,8 +92,8 @@ public List getOutgoingConnectionUserIdsForUser(final String userId) { //updated: now just returns a List of Strings final HibernateCallback> hcb = session -> { final Query q = session.getNamedQuery(QUERY_GET_OUTGOING_FRIEND_REQUESTS_FOR_USER); - q.setString(USER_UUID, userId); - q.setBoolean("false", Boolean.FALSE); + q.setParameter(USER_UUID, userId); + q.setParameter("false", Boolean.FALSE); return q.list(); }; @@ -111,7 +111,7 @@ public List getConfirmedConnectionUserIdsForUser(final String userId) { final HibernateCallback> hcb = session -> { final Query q = session.getNamedQuery(QUERY_GET_CONFIRMED_FRIEND_USERIDS_FOR_USER); q.setParameter(USER_UUID, userId, StringType.INSTANCE); - q.setBoolean("true", Boolean.TRUE); + q.setParameter("true", Boolean.TRUE); return q.list(); }; @@ -779,7 +779,7 @@ public int getAllUnreadMessagesCount(final String userId) { final HibernateCallback hcb = session -> { final Query q = session.getNamedQuery(QUERY_GET_ALL_UNREAD_MESSAGES_COUNT); q.setParameter(UUID, userId, StringType.INSTANCE); - q.setBoolean("false", Boolean.FALSE); + q.setParameter("false", Boolean.FALSE); return (Number) q.uniqueResult(); }; @@ -795,7 +795,7 @@ public int getThreadsWithUnreadMessagesCount(final String userId) { final HibernateCallback hcb = session -> { final Query q = session.getNamedQuery(QUERY_GET_THREADS_WITH_UNREAD_MESSAGES_COUNT); q.setParameter(UUID, userId, StringType.INSTANCE); - q.setBoolean("false", Boolean.FALSE); + q.setParameter("false", Boolean.FALSE); return (Number) q.uniqueResult(); }; diff --git a/profile2/impl/src/java/org/sakaiproject/profile2/logic/ProfileContentProducer.java b/profile2/impl/src/java/org/sakaiproject/profile2/logic/ProfileContentProducer.java index 88544d2c0c0c..9c83a0179410 100644 --- a/profile2/impl/src/java/org/sakaiproject/profile2/logic/ProfileContentProducer.java +++ b/profile2/impl/src/java/org/sakaiproject/profile2/logic/ProfileContentProducer.java @@ -21,33 +21,28 @@ package org.sakaiproject.profile2.logic; +import java.io.Reader; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + import org.sakaiproject.api.common.edu.person.SakaiPerson; import org.sakaiproject.api.common.edu.person.SakaiPersonManager; import org.sakaiproject.component.api.ServerConfigurationService; import org.sakaiproject.entity.api.Entity; -import org.sakaiproject.entity.api.Reference; import org.sakaiproject.event.api.Event; -import org.sakaiproject.profile2.logic.ProfilePrivacyLogic; import org.sakaiproject.profile2.model.ProfilePrivacy; import org.sakaiproject.profile2.util.ProfileConstants; import org.sakaiproject.search.api.EntityContentProducer; import org.sakaiproject.search.api.EntityContentProducerEvents; import org.sakaiproject.search.api.SearchIndexBuilder; -import org.sakaiproject.search.api.SearchService; -import org.sakaiproject.search.api.SearchUtils; import org.sakaiproject.search.model.SearchBuilderItem; import org.sakaiproject.user.api.User; import org.sakaiproject.user.api.UserDirectoryService; import org.sakaiproject.user.api.UserNotDefinedException; -import java.io.Reader; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - import lombok.Setter; import lombok.extern.slf4j.Slf4j; diff --git a/profile2/impl/src/java/org/sakaiproject/profile2/logic/ProfileLogicImpl.java b/profile2/impl/src/java/org/sakaiproject/profile2/logic/ProfileLogicImpl.java index 2d48ec8c495d..eb500b84280a 100644 --- a/profile2/impl/src/java/org/sakaiproject/profile2/logic/ProfileLogicImpl.java +++ b/profile2/impl/src/java/org/sakaiproject/profile2/logic/ProfileLogicImpl.java @@ -362,7 +362,7 @@ public Person getPerson(User user) { */ @Override public List getPersons(List users) { - List list = new ArrayList(); + List list = new ArrayList<>(); for (User u : users) { list.add(getPerson(u)); } diff --git a/profile2/impl/src/java/org/sakaiproject/profile2/service/ProfileServiceImpl.java b/profile2/impl/src/java/org/sakaiproject/profile2/service/ProfileServiceImpl.java index 7c519cf8db87..3c80cb3bea83 100644 --- a/profile2/impl/src/java/org/sakaiproject/profile2/service/ProfileServiceImpl.java +++ b/profile2/impl/src/java/org/sakaiproject/profile2/service/ProfileServiceImpl.java @@ -20,8 +20,6 @@ import org.sakaiproject.profile2.logic.ProfileConnectionsLogic; import org.sakaiproject.profile2.model.Person; -import org.sakaiproject.profile2.service.ProfileService; - /** * A facade on the various logic component methods to improve backwards compatibility with * clients of the older Profile2 apis. See PRFL-551.