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

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

Introduction

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

Prototype

Propagation REQUIRED

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

Click Source Link

Document

Support a current transaction, create a new one if none exists.

Usage

From source file:com.webfileanalyzer.service.impl.FileStatisticServiceImpl.java

@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
@Override
public void update(FileStatistic dbFile) {
    clearCache();
    fileStatisticDAO.delete(dbFile);
}

From source file:com.tsg.contactlistmvc.dao.ContactListDaoDbImpl.java

@Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public Contact addContact(Contact contact) {
    jdbcTemplate.update(SQL_INSERT_CONTACT, contact.getFirstName(), contact.getLastName(), contact.getCompany(),
            contact.getPhone(), contact.getEmail());
    contact.setContactId(jdbcTemplate.queryForObject("select LAST_INSERT_ID()", Integer.class));
    return contact;
}

From source file:com.inkubator.hrm.service.impl.NotificationJadwalKerjaEmailMessagesListener.java

@SuppressWarnings("unchecked")
@Override// ww  w.  j  a v  a 2s . c om
@Transactional(readOnly = false, propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED, timeout = 50, rollbackFor = Exception.class)
public void onMessage(Message message) {
    try {
        TextMessage textMessage = (TextMessage) message;
        String json = textMessage.getText();
        Gson gson = new GsonBuilder().create();
        JsonObject jsonObject = (JsonObject) gson.fromJson(json, JsonObject.class);
        String locale = jsonObject.get("locale").getAsString();
        String userEmail = jsonObject.get("userEmail").getAsString();

        List<String> toSend = new ArrayList<>();
        List<String> toSentCC = new ArrayList<String>();
        List<String> toSentBCC = new ArrayList<String>();
        toSend.add(userEmail);
        toSentCC.add("rizky.maulana@incubatechnology.com");
        toSentCC.add("rizkykojek@gmail.com");
        toSentCC.add("rizal2_dfhr@yahoo.com");
        VelocityTempalteModel vtm = new VelocityTempalteModel();
        vtm.setFrom(ownerEmail);
        vtm.setTo(toSend.toArray(new String[toSend.size()]));
        vtm.setCc(toSentCC.toArray(new String[toSentCC.size()]));
        vtm.setBcc(toSentBCC.toArray(new String[toSentBCC.size()]));

        Map maptoSend = new HashMap();
        maptoSend.put("startDate", jsonObject.get("startDate").getAsString());
        maptoSend.put("endDate", jsonObject.get("endDate").getAsString());
        maptoSend.put("userName", jsonObject.get("userName").getAsString());
        maptoSend.put("userNik", jsonObject.get("userNik").getAsString());
        maptoSend.put("ownerAdministrator", ownerAdministrator);
        maptoSend.put("ownerCompany", ownerCompany);
        maptoSend.put("applicationUrl", applicationUrl);
        maptoSend.put("applicationName", applicationName);
        List<String> listSchedule = gson.fromJson(jsonObject.get("listSchedule").getAsString(),
                new TypeToken<List<String>>() {
                }.getType());
        maptoSend.put("listSchedule", listSchedule);
        if (StringUtils.equals(locale, "en")) {
            vtm.setSubject("Employee Working Schedule");
            vtm.setTemplatePath("email_employee_working_schedule_en.vm");
        } else {
            vtm.setSubject("Jadwal Kerja Karyawan");
            vtm.setTemplatePath("email_employee_working_schedule.vm");
        }

        velocityTemplateSender.sendMail(vtm, maptoSend);
    } catch (Exception ex) {
        LOGGER.error("Error", ex);
    }
}

From source file:no.dusken.barweb.service.impl.BalanceTransaksjonExtendedService.java

@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, readOnly = false)
public void saveBalanceTransaksjonAndPerson(BalanceTransaksjon balanceTransaksjon, BarPerson barPerson) {
    barPersonService.save(barPerson);//w  w w . java2s  . c o  m
    balanceTransactionService.save(balanceTransaksjon);
}

From source file:com.mycompany.dvdmvc.dao.NotesDaoDbImpl.java

@Override
@Transactional(propagation = Propagation.REQUIRED)
public Note get(Integer id) {
    return jdbcTemplate.queryForObject(SQL_GET_NOTE, new NoteMapper(), id);
}

From source file:org.fits.proweb.business.UserRoleComponent.java

@Override
@Transactional(propagation = Propagation.REQUIRED)
public void updateUserRole(String userLogin, String roleName) {
    userRoleDao.updateUserRole(userLogin, roleName);
}

From source file:com.swcguild.blacksmithblogcapstone.dao.BlackSmithDaoImpl.java

@Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public BlogEntry addBlogEntry(BlogEntry blogEntry) {

    blogEntry.setApprovalStatus("NOT_APPROVED");

    jdbcTemplate.update(SQL_ADD_BLOG_ENTRY, blogEntry.getAuthorName(), new java.util.Date(),
            blogEntry.getTitle(), blogEntry.getBody(), blogEntry.getCategory(), blogEntry.getApprovalStatus()
    //                "NOT_APPROVED"
    );/*  w w  w.j  av  a  2 s  .c  o m*/
    int id = jdbcTemplate.queryForObject("SELECT LAST_INSERT_ID()", Integer.class);
    blogEntry.setId(id);

    if (blogEntry.getCategory() != null && !blogEntry.getCategory().equals("")) {
        addCategoryFromBlogEntry(blogEntry.getCategory(), blogEntry.getId());
    }

    return blogEntry;
}

From source file:org.openhie.openempi.recordlinkage.RecordLinkageProtocol.java

@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public PersonMatchRequest sendPersonMatchRequest(Dataset dataset, String remoteTableName, String matchName,
        String keyServerUserName, String keyServerPassword, String dataIntegratorUserName,
        String dataIntegratorPassword, String parameterManagerUserName, String parameterManagerPassword);

From source file:uk.ac.ebi.intact.editor.services.curate.interaction.InteractionRemoteService.java

@Transactional(value = "jamiTransactionManager", readOnly = true, propagation = Propagation.REQUIRED)
public Collection<IntactInteractionEvidence> loadInteractions(String[] proteins, String pubRef) {
    Collection<IntactInteractionEvidence> interactions = getIntactDao().getInteractionDao()
            .getByInteractorsPrimaryId(proteins);

    Iterator<IntactInteractionEvidence> iterator = interactions.iterator();

    if (pubRef != null) {
        while (iterator.hasNext()) {
            IntactInteractionEvidence interaction = iterator.next();
            if (interaction.getExperiment() != null && interaction.getExperiment().getPublication() != null) {
                Publication pub = interaction.getExperiment().getPublication();
                if (pub.getPubmedId() != null && !pub.getPubmedId().equals(pubRef)) {
                    iterator.remove();/* w w w  . j  a va2  s  . c  o  m*/
                } else {
                    for (ParticipantEvidence participant : interaction.getParticipants()) {
                        IntactInteractor interactor = (IntactInteractor) participant.getInteractor();
                        if (interactor.getAc() != null) {
                            Hibernate.initialize(interactor.getDbXrefs());
                        }
                    }
                }
            } else {
                iterator.remove();
            }
        }
    }

    return interactions;
}

From source file:uk.ac.ebi.intact.editor.services.curate.interactor.InteractorEditorService.java

@Transactional(value = "jamiTransactionManager", readOnly = true, propagation = Propagation.REQUIRED)
public int countAnnotations(IntactInteractor interactor) {
    return getIntactDao().getInteractorDao(IntactInteractor.class)
            .countAnnotationsForInteractor(interactor.getAc());
}