List of usage examples for javax.ejb TransactionAttributeType REQUIRES_NEW
TransactionAttributeType REQUIRES_NEW
To view the source code for javax.ejb TransactionAttributeType REQUIRES_NEW.
Click Source Link
REQUIRES_NEW
with a new transaction context. From source file:org.rhq.enterprise.server.resource.ResourceManagerBean.java
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public void deleteResourceError(Subject user, int resourceErrorId) { ResourceError error = entityManager.find(ResourceError.class, resourceErrorId); if (error != null) { if (!authorizationManager.hasResourcePermission(user, Permission.MODIFY_RESOURCE, error.getResource().getId())) { throw new PermissionException("Cannot delete Resource error [" + resourceErrorId + "]. User [" + user + "] does not have permission to modify Resource [" + error.getResource().getName() + "]."); }/*from w w w .j av a 2 s.c om*/ entityManager.remove(error); } return; }
From source file:gov.medicaid.services.impl.ProviderEnrollmentServiceBean.java
/** * Callback from legacy system for setting the legacy ID. * /*from w w w .j a v a2s .c o m*/ * @param ticketId the ticket id * @param legacyId the legacy id * @throws PortalServiceException for any errors encountered */ @Override @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public void updateLegacyId(long ticketId, String legacyId) throws PortalServiceException { Enrollment ticket = getTicketDetails(getSystemUser(), ticketId); long profileId = ticket.getProfileReferenceId(); ProviderProfile provider = getProviderDetails(getSystemUser(), profileId); provider.getEntity().setLegacyId(legacyId); getEm().merge(provider.getEntity()); }
From source file:io.hops.hopsworks.common.project.ProjectController.java
/** * Updates the role of a member/*from w ww.ja v a2 s.co m*/ * * @param project * @param owner that is performing the update * @param toUpdateEmail * @param newRole */ @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public void updateMemberRole(Project project, String owner, String toUpdateEmail, String newRole) throws UserException, ProjectException { Users projOwner = project.getOwner(); Users opsOwner = userFacade.findByEmail(owner); Users user = userFacade.findByEmail(toUpdateEmail); if (projOwner.equals(user)) { throw new ProjectException(RESTCodes.ProjectErrorCode.PROJECT_OWNER_ROLE_NOT_ALLOWED, Level.FINE, "project: " + project.getName()); } if (user == null) { throw new UserException(RESTCodes.UserErrorCode.USER_WAS_NOT_FOUND, Level.FINE, "user: " + toUpdateEmail); } ProjectTeam projectTeam = projectTeamFacade.findProjectTeam(project, user); if (projectTeam == null) { throw new ProjectException(RESTCodes.ProjectErrorCode.TEAM_MEMBER_NOT_FOUND, Level.FINE, "project: " + project.getName() + ", user: " + user.getUsername()); //member not found } if (!projectTeam.getTeamRole().equals(newRole)) { projectTeam.setTeamRole(newRole); projectTeam.setTimestamp(new Date()); projectTeamFacade.update(projectTeam); if (newRole.equals(AllowedRoles.DATA_OWNER)) { hdfsUsersController.addUserToProjectGroup(project, projectTeam); } else { hdfsUsersController.modifyProjectMembership(user, project); } logActivity(ActivityFacade.CHANGE_ROLE + toUpdateEmail, ActivityFacade.FLAG_PROJECT, opsOwner, project); } }
From source file:org.rhq.enterprise.server.content.ContentSourceManagerBean.java
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) @TransactionTimeout(45 * 60)/*from w w w . ja va2 s.co m*/ public long outputPackageVersionBitsGivenResource(int resourceId, PackageDetailsKey packageDetailsKey, OutputStream outputStream) { return outputPackageVersionBitsRangeGivenResource(resourceId, packageDetailsKey, outputStream, 0, -1); }
From source file:org.rhq.enterprise.server.content.ContentSourceManagerBean.java
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) @TransactionTimeout(45 * 60)//from ww w . ja v a2s .co m public long outputPackageBitsForChildResource(int parentResourceId, String resourceTypeName, PackageDetailsKey packageDetailsKey, OutputStream outputStream) { Resource parentResource = entityManager.find(Resource.class, parentResourceId); ResourceType parentResourceType = parentResource.getResourceType(); Query query = entityManager.createNamedQuery(ResourceType.QUERY_FIND_BY_PARENT_AND_NAME); query.setParameter("parent", parentResourceType); query.setParameter("name", resourceTypeName); ResourceType childResourceType = (ResourceType) query.getSingleResult(); query = entityManager .createNamedQuery(PackageVersion.QUERY_FIND_BY_PACKAGE_DETAILS_KEY_WITH_NON_NULL_RESOURCE_TYPE); query.setParameter("packageName", packageDetailsKey.getName()); query.setParameter("packageTypeName", packageDetailsKey.getPackageTypeName()); query.setParameter("architectureName", packageDetailsKey.getArchitectureName()); query.setParameter("version", packageDetailsKey.getVersion()); query.setParameter("resourceTypeId", childResourceType.getId()); PackageVersion packageVersion = (PackageVersion) query.getSingleResult(); return outputPackageVersionBitsRangeHelper(parentResourceId, packageDetailsKey, outputStream, 0, -1, packageVersion.getId()); }
From source file:org.rhq.enterprise.server.content.ContentSourceManagerBean.java
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) @TransactionTimeout(45 * 60)/*from ww w . j a v a 2 s. c o m*/ public long outputPackageVersionBitsRangeGivenResource(int resourceId, PackageDetailsKey packageDetailsKey, OutputStream outputStream, long startByte, long endByte) { if (startByte < 0L) { throw new IllegalArgumentException("startByte[" + startByte + "] < 0"); } if ((endByte > -1L) && (endByte < startByte)) { throw new IllegalArgumentException("endByte[" + endByte + "] < startByte[" + startByte + "]"); } // what package version? Query query = entityManager .createNamedQuery(PackageVersion.QUERY_FIND_ID_BY_PACKAGE_DETAILS_KEY_AND_RES_ID); query.setParameter("packageName", packageDetailsKey.getName()); query.setParameter("packageTypeName", packageDetailsKey.getPackageTypeName()); query.setParameter("architectureName", packageDetailsKey.getArchitectureName()); query.setParameter("version", packageDetailsKey.getVersion()); query.setParameter("resourceId", resourceId); int packageVersionId = ((Integer) query.getSingleResult()).intValue(); return outputPackageVersionBitsRangeHelper(resourceId, packageDetailsKey, outputStream, startByte, endByte, packageVersionId); }
From source file:org.rhq.enterprise.server.content.ContentSourceManagerBean.java
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) @TransactionTimeout(45 * 60)//from w w w . j av a2 s .co m public long outputPackageVersionBits(PackageVersion packageVersion, OutputStream outputStream) { // Used by export of content through http PackageDetailsKey packageDetailsKey = new PackageDetailsKey(packageVersion.getDisplayName(), packageVersion.getDisplayVersion(), packageVersion.getGeneralPackage().getPackageType().toString(), packageVersion.getArchitecture().toString()); int resourceId = 0; //set to dummy value log.debug("Calling outputPackageVersionBitsRangeHelper() with package details: " + packageDetailsKey); return outputPackageVersionBitsRangeHelper(resourceId, packageDetailsKey, outputStream, 0, -1, packageVersion.getId()); }
From source file:edu.harvard.iq.dvn.core.study.StudyServiceBean.java
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public void setIndexTime(Long studyId, Date indexTime) { Study study = em.find(Study.class, studyId); study.setLastIndexTime(indexTime);/* w w w . j a v a 2s .c o m*/ em.merge(study); }
From source file:org.rhq.enterprise.server.content.ContentSourceManagerBean.java
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) @TransactionTimeout(45 * 60)/*from w w w. ja va 2 s . c o m*/ public long outputPackageVersionBits(PackageVersion packageVersion, OutputStream outputStream, long startByte, long endByte) { // Used by export of content through http PackageDetailsKey packageDetailsKey = new PackageDetailsKey(packageVersion.getDisplayName(), packageVersion.getDisplayVersion(), packageVersion.getGeneralPackage().getPackageType().toString(), packageVersion.getArchitecture().toString()); int resourceId = 0; //set to dummy value log.debug("Calling outputPackageVersionBitsRangeHelper() with package details: " + packageDetailsKey); return outputPackageVersionBitsRangeHelper(resourceId, packageDetailsKey, outputStream, startByte, endByte, packageVersion.getId()); }
From source file:edu.harvard.iq.dvn.core.study.StudyServiceBean.java
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public Study setLinkedToNetworks(Long studyId, List<VDCNetwork> linkedToNetworks) { Study study = em.find(Study.class, studyId); study.setLinkedToNetworks(linkedToNetworks); return em.merge(study); }