| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
package org.kuali.rice.kew.useroptions.dao.impl; |
| 18 |
|
|
| 19 |
|
import java.util.ArrayList; |
| 20 |
|
import java.util.Collection; |
| 21 |
|
import java.util.List; |
| 22 |
|
|
| 23 |
|
import javax.persistence.EntityManager; |
| 24 |
|
import javax.persistence.PersistenceContext; |
| 25 |
|
|
| 26 |
|
import org.kuali.rice.core.framework.persistence.platform.DatabasePlatform; |
| 27 |
|
import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader; |
| 28 |
|
import org.kuali.rice.core.util.RiceConstants; |
| 29 |
|
import org.kuali.rice.kew.useroptions.UserOptions; |
| 30 |
|
import org.kuali.rice.kew.useroptions.dao.UserOptionsDAO; |
| 31 |
|
|
| 32 |
|
|
|
|
|
| 0% |
Uncovered Elements: 35 (35) |
Complexity: 14 |
Complexity Density: 0.74 |
|
| 33 |
|
public class UserOptionsDaoJpaImpl implements UserOptionsDAO { |
| 34 |
|
|
| 35 |
|
@PersistenceContext |
| 36 |
|
private EntityManager entityManager; |
| 37 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 38 |
0
|
public Long getNewOptionIdForActionList() {... |
| 39 |
0
|
return getPlatform().getNextValSQL("KREW_ACTN_LIST_OPTN_S", entityManager); |
| 40 |
|
} |
| 41 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 42 |
0
|
protected DatabasePlatform getPlatform() {... |
| 43 |
0
|
return (DatabasePlatform) GlobalResourceLoader.getService(RiceConstants.DB_PLATFORM); |
| 44 |
|
} |
| 45 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 46 |
0
|
public List findByUserQualified(String principalId, String likeString) {... |
| 47 |
0
|
return new ArrayList(entityManager.createNamedQuery("UserOptions.FindByUserQualified").setParameter("workflowId", principalId).setParameter("optionId", likeString).getResultList()); |
| 48 |
|
} |
| 49 |
|
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 50 |
0
|
public void deleteByUserQualified(String principalId, String likeString) {... |
| 51 |
0
|
List<UserOptions> userOptions = (List<UserOptions>) entityManager.createNamedQuery("UserOptions.FindByUserQualified").setParameter("workflowId", principalId).setParameter("optionId", likeString).getResultList(); |
| 52 |
0
|
for (UserOptions uo : userOptions) { |
| 53 |
0
|
entityManager.remove(uo); |
| 54 |
|
} |
| 55 |
|
} |
| 56 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 57 |
0
|
public Collection findByWorkflowUser(String principalId) {... |
| 58 |
0
|
return entityManager.createNamedQuery("UserOptions.FindByWorkflowId").setParameter("workflowId", principalId).getResultList(); |
| 59 |
|
} |
| 60 |
|
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 61 |
0
|
public void save(UserOptions userOptions) {... |
| 62 |
0
|
if (userOptions.getOptionId() == null) { |
| 63 |
0
|
entityManager.persist(userOptions); |
| 64 |
|
} else { |
| 65 |
0
|
entityManager.merge(userOptions); |
| 66 |
|
} |
| 67 |
|
} |
| 68 |
|
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 69 |
0
|
public void save(Collection<UserOptions> userOptions) {... |
| 70 |
0
|
if (userOptions != null) for (UserOptions option : userOptions) { |
| 71 |
0
|
save(option); |
| 72 |
|
} |
| 73 |
|
} |
| 74 |
|
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 75 |
0
|
public void deleteUserOptions(UserOptions userOptions) {... |
| 76 |
0
|
UserOptions reattatched = entityManager.merge(userOptions); |
| 77 |
0
|
entityManager.remove(reattatched); |
| 78 |
|
} |
| 79 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 80 |
0
|
public UserOptions findByOptionId(String optionId, String principalId) {... |
| 81 |
0
|
return (UserOptions) entityManager.createNamedQuery("UserOptions.FindByOptionId").setParameter("optionId", optionId).setParameter("workflowId", principalId).getSingleResult(); |
| 82 |
|
} |
| 83 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 84 |
0
|
public Collection findByOptionValue(String optionId, String optionValue) {... |
| 85 |
0
|
return entityManager.createNamedQuery("UserOptions.FindByOptionValue").setParameter("optionId", optionId).setParameter("optionValue", optionValue).getResultList(); |
| 86 |
|
} |
| 87 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 88 |
0
|
public EntityManager getEntityManager() {... |
| 89 |
0
|
return this.entityManager; |
| 90 |
|
} |
| 91 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 92 |
0
|
public void setEntityManager(EntityManager entityManager) {... |
| 93 |
0
|
this.entityManager = entityManager; |
| 94 |
|
} |
| 95 |
|
} |