Example usage for org.springframework.transaction.annotation Propagation NOT_SUPPORTED

List of usage examples for org.springframework.transaction.annotation Propagation NOT_SUPPORTED

Introduction

In this page you can find the example usage for org.springframework.transaction.annotation Propagation NOT_SUPPORTED.

Prototype

Propagation NOT_SUPPORTED

To view the source code for org.springframework.transaction.annotation Propagation NOT_SUPPORTED.

Click Source Link

Document

Execute non-transactionally, suspend the current transaction if one exists.

Usage

From source file:com.newmainsoftech.spray.slingong.datastore.Slim3PlatformTransactionManagerTest.java

@Transactional(propagation = Propagation.NOT_SUPPORTED)
protected void notSupportedToRequiredPropagation() throws Throwable {
    prepTestModels();//from w ww.  ja  va2  s  . c  o m

    cascadeCommitCallee1(); //  cascadeCommitCallee1 method is annotated with Propagation.REQUIRED
}

From source file:com.salesmanager.core.service.order.OrderService.java

@Transactional(propagation = Propagation.NOT_SUPPORTED)
public void saveOrUpdateOrderAccount(OrderAccount order) throws Exception {
    orderAccountDao.saveOrUpdate(order);
}

From source file:com.gettec.fsnip.fsn.service.business.impl.BusinessUnitServiceImpl.java

@Transactional(propagation = Propagation.NOT_SUPPORTED, rollbackFor = Exception.class)
public BusinessUnit getBusinessUnitByCondition(String businessName, String qsNo, String licenseNo) {
    return businessUnitDAO.getBusinessUnitByCondition(businessName, qsNo, licenseNo);
}

From source file:org.ednovo.gooru.controllers.api.ResourceRestController.java

@AuthorizeOperations(operations = { GooruOperationConstants.OPERATION_RESOURCE_ADD })
@Transactional(readOnly = false, propagation = Propagation.NOT_SUPPORTED, noRollbackFor = Exception.class)
@RequestMapping(method = RequestMethod.GET, value = "resource/add-new")
public ModelAndView addNew(@RequestParam(value = URL) String url,
        @RequestParam(value = TITLE, required = false) String title,
        @RequestParam(value = TEXT, required = false) String text,
        @RequestParam(value = CATEGORY, required = false) String category,
        @RequestParam(value = SHARING, required = false) String sharing,
        @RequestParam(value = TYPENAME, required = false) String type_name,
        @RequestParam(value = LICENSE_NAME, required = false) String licenseName,
        @RequestParam(value = BROKEN_STATUS, required = false) Integer brokenStatus,
        @RequestParam(value = HAS_FRAME_BREAKER, required = false) Boolean hasFrameBreaker,
        @RequestParam(value = DESCRIPTION, required = false) String description,
        @RequestParam(value = IS_FEATURED, required = false) Integer isFeatured,
        @RequestParam(value = MEDIA_TYPE, required = false) String mediaType,
        @RequestParam(value = TAGS, required = false) String tags,
        @RequestParam(value = IS_RETURN_JSON, required = false) boolean isReturnJson,
        @RequestParam(value = "resourceFormat", required = false) String resourceFormat,
        @RequestParam(value = "resourceInstructional", required = false) String resourceInstructional,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    // request.setAttribute("predicate", "resource.add-new");

    User apiCaller = (User) request.getAttribute(Constants.USER);
    Resource resource = resourceService.addNewResource(url, title, text, category, sharing, type_name,
            licenseName, brokenStatus, hasFrameBreaker, description, isFeatured, tags, isReturnJson, apiCaller,
            mediaType, resourceFormat, resourceInstructional);

    if (isReturnJson) {
        ModelAndView jsonmodel = new ModelAndView(REST_MODEL);
        JSONSerializer serializer = new JSONSerializer();
        Object serializedData = serializer.include(RESOURCE_META_DATA).serialize(resource);
        jsonmodel.addObject(MODEL, serializedData.toString());
        return jsonmodel;

    } else {/*from w w w .j a  v  a  2s . c  o m*/
        return toModelAndView(DONE);
    }
}

From source file:org.ednovo.gooru.domain.service.resource.ResourceImportServiceImpl.java

@Override
@Transactional(readOnly = false, propagation = Propagation.NOT_SUPPORTED, noRollbackFor = Exception.class)
public void createOrUpdateResource(String filename, User user) {
    final String mediaFileName = UserGroupSupport.getUserOrganizationNfsInternalPath()
            + Constants.UPLOADED_MEDIA_FOLDER + '/' + filename;
    List<String> keys = null;
    StringBuffer json = new StringBuffer();
    CSVReader csvReader = null;/*from   w w w . j  av a  2  s. c o  m*/
    File file = null;
    try {
        file = new File(mediaFileName);
        csvReader = new CSVReader(new FileReader(file));
        String[] row = null;
        while ((row = csvReader.readNext()) != null) {
            if (keys == null) {
                keys = getJsonKeys(row);
            } else {
                String data = formInputJson(row, json, keys).toString();
                JSONObject jsonObj = requestData(generateJSONInput(data, UNDER_SCORE));
                String gooruOid = getValue(GOORU_OID, requestData(getValue(RESOURCE, jsonObj)));
                if (!(StringUtils.isBlank(gooruOid))) {
                    this.getResourceService().updateResource(gooruOid,
                            this.buildResourceFromInputParameters(getValue(RESOURCE, jsonObj)),
                            getValue(RESOURCE_TAGS, jsonObj) == null ? null
                                    : buildResourceTags(getValue(RESOURCE_TAGS, jsonObj)),
                            user);
                } else {
                    this.getResourceService().createResource(
                            this.getResourceService()
                                    .buildResourceFromInputParameters(getValue(RESOURCE, jsonObj), user),
                            (getValue(RESOURCE_TAGS, jsonObj) != null)
                                    ? buildResourceTags(getValue(RESOURCE_TAGS, jsonObj))
                                    : null,
                            user, true);
                }
                json.setLength(0);
            }
        }
    } catch (FileNotFoundException e) {
        throw new NotFoundException(generateErrorMessage(GL0056, FILE), GL0056);
    } catch (Exception e) {
        LOGGER.error(_ERROR, e);
    } finally {
        try {
            if (file.exists()) {
                csvReader.close();
                file.delete();
            }
        } catch (Exception e) {
            LOGGER.error(_ERROR, e);
        }
    }
}

From source file:org.ednovo.gooru.domain.service.resource.ResourceServiceImpl.java

@Override
@Transactional(readOnly = false, propagation = Propagation.NOT_SUPPORTED, noRollbackFor = Exception.class)
public Resource createResource(final Resource newResource, final List<String> tags, final User user,
        boolean updateIfExist) throws Exception {
    Resource resource = null;/* w  w  w.  java  2  s  . c om*/
    if (newResource.getUrl() != null && !newResource.getUrl().isEmpty() && newResource.getAttach() == null) {
        resource = this.getResourceRepository().findResourceByUrl(newResource.getUrl(),
                updateIfExist ? null : Sharing.PUBLIC.getSharing(), null);
    }
    if (updateIfExist && !hasUnrestrictedContentAccess() && resource != null && resource.getSharing() != null
            && resource.getSharing().equalsIgnoreCase(Sharing.PUBLIC.getSharing())) {
        throw new AccessDeniedException(generateErrorMessage("GL0012"));
    }

    final String title = newResource.getTitle().length() > 1000 ? newResource.getTitle().substring(0, 1000)
            : newResource.getTitle();
    if (resource == null) {
        resource = new Resource();
        resource.setGooruOid(UUID.randomUUID().toString());
        resource.setUser(user);
        resource.setTitle(title);
        if (newResource.getCategory() != null) {
            resource.setCategory(newResource.getCategory().toLowerCase());
        }
        if (newResource.getInstructional() != null) {
            final CustomTableValue resourceCategory = this.getCustomTableRepository()
                    .getCustomTableValue(RESOURCE_INSTRUCTIONAL_USE, newResource.getInstructional().getValue());
            resource.setInstructional(resourceCategory);
        }
        if (newResource.getResourceFormat() != null) {
            CustomTableValue resourcetype = this.getCustomTableRepository()
                    .getCustomTableValue(RESOURCE_CATEGORY_FORMAT, newResource.getResourceFormat().getValue());
            resource.setResourceFormat(resourcetype);
        }
        resource.setDescription(newResource.getDescription());
        License license = new License();
        license.setName(OTHER);
        resource.setRecordSource(Resource.RecordSource.COLLECTION.getRecordSource());
        final ResourceType resourceTypeDo = new ResourceType();
        resource.setResourceType(resourceTypeDo);
        String fileExtension = null;
        if (newResource.getAttach() != null && newResource.getAttach().getFilename() != null) {
            fileExtension = org.apache.commons.lang.StringUtils
                    .substringAfterLast(newResource.getAttach().getFilename(), ".");
            if (fileExtension.contains(PDF) || BaseUtil.supportedDocument().containsKey(fileExtension)) {
                resourceTypeDo.setName(ResourceType.Type.HANDOUTS.getType());
            } else {
                resourceTypeDo.setName(ResourceType.Type.IMAGE.getType());
            }
            resource.setUrl(newResource.getAttach().getFilename());
            resource.setIsOer(1);
            license.setName(CREATIVE_COMMONS);
        } else {
            resource.setUrl(newResource.getUrl());
            if (ResourceImageUtil.getYoutubeVideoId(newResource.getUrl()) != null) {
                resourceTypeDo.setName(ResourceType.Type.VIDEO.getType());
            } else if (newResource.getUrl() != null && newResource.getUrl().contains("vimeo.com")) {
                final String id = org.apache.commons.lang.StringUtils.substringAfterLast(newResource.getUrl(),
                        "/");
                if (org.apache.commons.lang.StringUtils.isNumeric(id)) {
                    final ResourceMetadataCo resourceMetadataCo = ResourceImageUtil
                            .getMetaDataFromVimeoVideo(newResource.getUrl());
                    resourceTypeDo.setName(ResourceType.Type.VIMEO_VIDEO.getType());
                    newResource.setThumbnail(
                            resourceMetadataCo != null ? resourceMetadataCo.getThumbnail() : null);
                } else {
                    resourceTypeDo.setName(ResourceType.Type.RESOURCE.getType());
                }

            } else {
                resourceTypeDo.setName(ResourceType.Type.RESOURCE.getType());
            }

        }
        resource.setLicense(license);
        if (newResource.getSharing() != null) {
            resource.setSharing(Sharing.PRIVATE.getSharing());
        } else {
            resource.setSharing(newResource.getSharing());
        }
        String domainName = BaseUtil.getDomainName(newResource.getUrl());
        ResourceSource resourceSource = null;
        if (domainName != null) {
            resourceSource = this.getResourceRepository().findResourceSource(domainName);
        }
        if (resourceSource != null && resourceSource.getFrameBreaker() != null
                && resourceSource.getFrameBreaker() == 1) {
            resource.setHasFrameBreaker(true);
        } else if ((newResource.getUrl() != null && newResource.getUrl().contains(YOUTUBE_URL)
                && ResourceImageUtil.getYoutubeVideoId(newResource.getUrl()) == null)) {
            resource.setHasFrameBreaker(true);
        } else {
            resource.setHasFrameBreaker(false);
        }

        resourceRepository.saveOrUpdate(resource);
        saveOrUpdateResourceTaxonomy(resource, newResource.getTaxonomySet());
        updateYoutubeResourceFeeds(resource, false);
        resourceRepository.saveOrUpdate(resource);
        mapSourceToResource(resource);
        if (newResource.getHost() != null && newResource.getHost().size() > 0) {
            resource.setHost(
                    updateContentProvider(resource.getGooruOid(), newResource.getHost(), user, "host"));
        }
        if (tags != null && tags.size() > 0) {
            resource.setResourceTags(
                    this.getContentService().createTagAssoc(resource.getGooruOid(), tags, user));
        }
        try {
            if (newResource.getThumbnail() != null || fileExtension != null && fileExtension.contains(PDF)) {
                this.getResourceImageUtil().downloadAndSendMsgToGenerateThumbnails(resource,
                        newResource.getThumbnail());
            }
        } catch (Exception e) {
            LOGGER.error(_ERROR, e);
        }

        if (resource != null && resource.getContentId() != null) {
            try {
                indexHandler.setReIndexRequest(resource.getGooruOid(), IndexProcessor.INDEX, RESOURCE, null,
                        false, false);
            } catch (Exception e) {
                LOGGER.error(_ERROR, e);
            }
        }

        if (newResource.getAttach() != null) {
            this.getResourceImageUtil().moveAttachment(newResource, resource);
        }
    } else if (updateIfExist) {
        if (!resource.getSharing().equalsIgnoreCase(PUBLIC)) {
            updateResource(resource.getGooruOid(), newResource, tags, user);
        }
    }

    return resource;
}

From source file:org.finra.herd.service.impl.BusinessObjectDataFinalizeRestoreHelperServiceImpl.java

/**
 * {@inheritDoc}//w ww  .ja va  2 s  . c o m
 * <p/>
 * This implementation executes non-transactionally, suspends the current transaction if one exists.
 */
@Override
@Transactional(propagation = Propagation.NOT_SUPPORTED)
public void executeS3SpecificSteps(BusinessObjectDataRestoreDto businessObjectDataRestoreDto) {
    executeS3SpecificStepsImpl(businessObjectDataRestoreDto);
}

From source file:org.finra.herd.service.impl.BusinessObjectDataInitiateDestroyHelperServiceImpl.java

/**
 * {@inheritDoc}/* w  w  w.j  a  va2 s. co m*/
 * <p/>
 * This implementation executes non-transactionally, suspends the current transaction if one exists.
 */
@Override
@Transactional(propagation = Propagation.NOT_SUPPORTED)
public void executeS3SpecificSteps(BusinessObjectDataDestroyDto businessObjectDataDestroyDto) {
    executeS3SpecificStepsImpl(businessObjectDataDestroyDto);
}

From source file:org.finra.herd.service.impl.BusinessObjectDataServiceImpl.java

/**
 * {@inheritDoc}/*www. jav  a2  s. c o m*/
 * <p/>
 * This implementation executes non-transactionally, suspends the current transaction if one exists.
 */
@NamespacePermission(fields = "#businessObjectDataKey.namespace", permissions = NamespacePermissionEnum.WRITE)
@Override
@Transactional(propagation = Propagation.NOT_SUPPORTED)
public BusinessObjectData destroyBusinessObjectData(BusinessObjectDataKey businessObjectDataKey) {
    return destroyBusinessObjectDataImpl(businessObjectDataKey);
}

From source file:org.finra.herd.service.impl.BusinessObjectDataServiceImpl.java

/**
 * {@inheritDoc}/*from   ww w .j av a2 s . com*/
 * <p/>
 * This implementation executes non-transactionally, suspends the current transaction if one exists.
 */
@NamespacePermission(fields = "#businessObjectDataKey.namespace", permissions = NamespacePermissionEnum.WRITE)
@Override
@Transactional(propagation = Propagation.NOT_SUPPORTED)
public BusinessObjectData restoreBusinessObjectData(BusinessObjectDataKey businessObjectDataKey,
        Integer expirationInDays, String archiveRetrievalOption) {
    return restoreBusinessObjectDataImpl(businessObjectDataKey, expirationInDays, archiveRetrievalOption);
}