Keep transaction simplication
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
package com.wisemapping.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.transaction.TransactionManager;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
import org.springframework.transaction.interceptor.TransactionAttributeSource;
|
||||
import org.springframework.transaction.interceptor.TransactionInterceptor;
|
||||
import org.springframework.web.servlet.HandlerExceptionResolver;
|
||||
import org.springframework.web.servlet.ViewResolver;
|
||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
@@ -11,8 +16,12 @@ import org.springframework.web.servlet.view.JstlView;
|
||||
|
||||
@EnableWebMvc
|
||||
@Configuration
|
||||
@EnableTransactionManagement
|
||||
public class AppConfig {
|
||||
|
||||
@Autowired
|
||||
TransactionManager txManager;
|
||||
|
||||
@Bean
|
||||
HandlerExceptionResolver errorHandler() {
|
||||
final SimpleMappingExceptionResolver result = new SimpleMappingExceptionResolver();
|
||||
|
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Copyright [2022] [wisemapping]
|
||||
*
|
||||
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
|
||||
* It is basically the Apache License, Version 2.0 (the "License") plus the
|
||||
* "powered by wisemapping" text requirement on every single page;
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the license at
|
||||
*
|
||||
* http://www.wisemapping.org/license
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.wisemapping.service;
|
||||
|
||||
import jakarta.servlet.ServletContextEvent;
|
||||
import jakarta.servlet.ServletContextListener;
|
||||
|
||||
public class HibernateAppListener implements ServletContextListener {
|
||||
|
||||
public void contextInitialized(ServletContextEvent ce) {
|
||||
|
||||
try {
|
||||
|
||||
Class.forName("tomcatJndi.HibernateUtil").newInstance();
|
||||
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
|
||||
/* Application Shutdown Event */
|
||||
public void contextDestroyed(ServletContextEvent ce)
|
||||
{ }
|
||||
}
|
@@ -23,17 +23,20 @@ import com.wisemapping.model.Label;
|
||||
import com.wisemapping.model.User;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service("labelService")
|
||||
@Transactional(propagation = Propagation.REQUIRED)
|
||||
public class LabelServiceImpl implements LabelService {
|
||||
|
||||
@Autowired
|
||||
private LabelManager labelManager;
|
||||
|
||||
public void setLabelManager(LabelManager labelManager) {
|
||||
this.labelManager = labelManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addLabel(@NotNull final Label label, @NotNull final User user) throws WiseMappingException {
|
||||
|
||||
|
@@ -27,7 +27,11 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Calendar;
|
||||
@@ -35,8 +39,10 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
@Service("mindmapService")
|
||||
@Transactional(propagation = Propagation.REQUIRED)
|
||||
public class MindmapServiceImpl
|
||||
|
||||
implements MindmapService {
|
||||
|
||||
@Autowired
|
||||
@@ -49,6 +55,8 @@ public class MindmapServiceImpl
|
||||
@Autowired
|
||||
private NotificationService notificationService;
|
||||
|
||||
|
||||
@Value("${admin.user}")
|
||||
private String adminUser;
|
||||
final private LockManager lockManager;
|
||||
|
||||
|
@@ -33,18 +33,31 @@ import com.wisemapping.util.VelocityEngineUtils;
|
||||
import com.wisemapping.util.VelocityEngineWrapper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@Service("userService")
|
||||
@Transactional(propagation = Propagation.REQUIRED)
|
||||
public class UserServiceImpl
|
||||
implements UserService {
|
||||
|
||||
@Autowired
|
||||
private UserManager userManager;
|
||||
@Autowired
|
||||
private MindmapService mindmapService;
|
||||
@Autowired
|
||||
private NotificationService notificationService;
|
||||
@Autowired
|
||||
private MessageSource messageSource;
|
||||
@Autowired
|
||||
private VelocityEngineWrapper velocityEngineWrapper;
|
||||
@Autowired
|
||||
private GoogleService googleService;
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user