当前位置: 首页>>代码示例>>Java>>正文


Java PersistenceException.getLocalizedMessage方法代码示例

本文整理汇总了Java中javax.persistence.PersistenceException.getLocalizedMessage方法的典型用法代码示例。如果您正苦于以下问题:Java PersistenceException.getLocalizedMessage方法的具体用法?Java PersistenceException.getLocalizedMessage怎么用?Java PersistenceException.getLocalizedMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.persistence.PersistenceException的用法示例。


在下文中一共展示了PersistenceException.getLocalizedMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: update

import javax.persistence.PersistenceException; //导入方法依赖的package包/类
@Override
@Transactional
public Module update(Module module) throws ServiceException {
    logger.debug("update : Methods parameters : " + module.toString());
    logger.info("ModuleService : Starting updating Module " + module.getName());
    try {
        module = moduleDAO.save(module);
    } catch (PersistenceException e) {
        module.setStatus(Status.FAIL);
        module = moduleDAO.save(module);
        logger.error("ModuleService Error : update Module" + e);
        throw new ServiceException(e.getLocalizedMessage(), e);
    }
    logger.info("ModuleService : Module " + module.getName() + " successfully updated.");
    return module;
}
 
开发者ID:oncecloud,项目名称:devops-cstack,代码行数:17,代码来源:ModuleServiceImpl.java

示例2: activationAccount

import javax.persistence.PersistenceException; //导入方法依赖的package包/类
@Override
@Transactional
public void activationAccount(User user)
        throws ServiceException {
    try {
        logger.debug("UserService : User " + user.toString());

        user = userDAO.findOne(user.getId());
        user.setStatus(User.STATUS_ACTIF);
        user = userDAO.saveAndFlush(user);

    } catch (PersistenceException e) {
        logger.error("UserService Error : Activate User Account" + e);
        throw new ServiceException(e.getLocalizedMessage(), e);
    }

    logger.info("UserService : User " + user.getLastName()
            + " account activated - status = " + user.getStatus());

}
 
开发者ID:oncecloud,项目名称:devops-cstack,代码行数:21,代码来源:UserServiceImpl.java

示例3: update

import javax.persistence.PersistenceException; //导入方法依赖的package包/类
@Override
@Transactional
public User update(User user)
        throws ServiceException {

    logger.debug("update : Methods parameters : " + user.toString());
    logger.info("UserService : Starting updating user "
            + user.getLastName());
    try {
        userDAO.saveAndFlush(user);
    } catch (PersistenceException e) {
        logger.error("UserService Error : update User" + e);
        throw new ServiceException(e.getLocalizedMessage(), e);
    }

    logger.info("UserService : User " + user.getLogin()
            + " successfully updated.");

    return user;
}
 
开发者ID:oncecloud,项目名称:devops-cstack,代码行数:21,代码来源:UserServiceImpl.java

示例4: startModule

import javax.persistence.PersistenceException; //导入方法依赖的package包/类
@Override
@Transactional
public Module startModule(String moduleName) throws ServiceException {
    logger.info("Module : Starting module " + moduleName);
    Module module = null;
    try {
        module = findByName(moduleName);
        module = dockerService.startModule(moduleName, module);
        applicationEventPublisher.publishEvent(new ModuleStartEvent(module));
        if (!module.isInitialized()) {
            module.setInitialized(true);
            module = moduleDAO.save(module);
            applicationEventPublisher
                    .publishEvent(new HookEvent(new Hook(moduleName, RemoteExecAction.MODULE_POST_START_ONCE)));
        }
        applicationEventPublisher
                .publishEvent(new HookEvent(new Hook(moduleName, RemoteExecAction.MODULE_POST_START)));
    } catch (PersistenceException e) {
        logger.error("ModuleService Error : fail to start Module" + moduleName);
        throw new ServiceException(e.getLocalizedMessage(), e);
    }
    return module;
}
 
开发者ID:oncecloud,项目名称:devops-cstack,代码行数:24,代码来源:ModuleServiceImpl.java

示例5: update

import javax.persistence.PersistenceException; //导入方法依赖的package包/类
@Override
@Transactional
public Image update(Image image)
        throws ServiceException {

    logger.debug("update : Methods parameters : " + image.toString());
    logger.info("ImageService : Starting updating image " + image.getName());

    try {
        imageDAO.saveAndFlush(image);
    } catch (PersistenceException e) {
        logger.error("ImageService Error : update Image" + e);
        throw new ServiceException(e.getLocalizedMessage(), e);
    }

    logger.info("ImageService : Image " + image.getName()
            + "successfully updated.");

    return image;
}
 
开发者ID:oncecloud,项目名称:devops-cstack,代码行数:21,代码来源:ImageServiceImpl.java

示例6: changePassword

import javax.persistence.PersistenceException; //导入方法依赖的package包/类
@Transactional
@Override
public void changePassword(User user, String newPassword)
        throws ServiceException {

    Map<String, String> configShell = new HashMap<>();
    String userLogin = user.getLogin();
    user = this.findById(user.getId());
    user.setPassword(newPassword);
    List<Application> listApplications = user.getApplications();

    try {
        logger.debug("Methods parameters : " + user + " new password : "
                + newPassword);

        userDAO.saveAndFlush(user);
    } catch (PersistenceException e) {
        logger.error("Error UserService : error changePassword : " + e);
        throw new ServiceException(e.getLocalizedMessage(), e);
    }
    logger.info("UserService : User " + user.getLastName()
            + " password successfully updated.");

}
 
开发者ID:oncecloud,项目名称:devops-cstack,代码行数:25,代码来源:UserServiceImpl.java

示例7: create

import javax.persistence.PersistenceException; //导入方法依赖的package包/类
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public Message create(Message message)
        throws ServiceException {
    try {
        message.setCuInstanceName(cuInstanceName);
        return messageDAO.save(message);
    } catch (PersistenceException e) {
        throw new ServiceException(e.getLocalizedMessage(), e);
    }
}
 
开发者ID:oncecloud,项目名称:devops-cstack,代码行数:12,代码来源:MessageServiceImpl.java

示例8: delete

import javax.persistence.PersistenceException; //导入方法依赖的package包/类
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void delete(Message message)
        throws ServiceException {
    try {
        messageDAO.delete(message);
    } catch (PersistenceException e) {
        throw new ServiceException(e.getLocalizedMessage(), e);
    }
}
 
开发者ID:oncecloud,项目名称:devops-cstack,代码行数:11,代码来源:MessageServiceImpl.java

示例9: findById

import javax.persistence.PersistenceException; //导入方法依赖的package包/类
@Override
public Image findById(Integer id)
        throws ServiceException {
    try {
        logger.debug("findById : Methods parameters : " + id);
        Image image = imageDAO.findOne(id);
        logger.info("image with id " + id + " found!");
        return image;
    } catch (PersistenceException e) {
        logger.error("Error ImageService : error findById Method : " + e);
        throw new ServiceException(e.getLocalizedMessage(), e);

    }
}
 
开发者ID:oncecloud,项目名称:devops-cstack,代码行数:15,代码来源:ImageServiceImpl.java

示例10: listByApp

import javax.persistence.PersistenceException; //导入方法依赖的package包/类
@Override
public List<Message> listByApp(User user, String applicationName,
                               int nbMessages)
        throws ServiceException {
    try {
        Pageable pageable = new PageRequest(0, nbMessages,
                sortByLastNameAsc());
        Page<Message> requestedPage = messageDAO.listByApp(user,
                applicationName, cuInstanceName, pageable);
        return requestedPage.getContent();
    } catch (PersistenceException e) {
        throw new ServiceException(e.getLocalizedMessage(), e);
    }
}
 
开发者ID:oncecloud,项目名称:devops-cstack,代码行数:15,代码来源:MessageServiceImpl.java

示例11: findById

import javax.persistence.PersistenceException; //导入方法依赖的package包/类
@Override
public Module findById(Integer id) throws ServiceException {
    try {
        logger.debug("findById : Methods parameters : " + id);
        Module module = moduleDAO.findOne(id);
        logger.info("Module with id " + id + " found!");
        return module;
    } catch (PersistenceException e) {
        logger.error("Error ModuleService : error findById Method : " + e);
        throw new ServiceException(e.getLocalizedMessage(), e);
    }
}
 
开发者ID:oncecloud,项目名称:devops-cstack,代码行数:13,代码来源:ModuleServiceImpl.java

示例12: findAll

import javax.persistence.PersistenceException; //导入方法依赖的package包/类
@Override
public List<Server> findAll() throws ServiceException {
	try {
		logger.debug("start findAll");
		List<Server> servers = serverDAO.findAll();
		logger.info("ServerService : All Servers found ");
		return servers;
	} catch (PersistenceException e) {
		logger.error("Error ServerService : error findAll Method : " + e);
		throw new ServiceException("Error database :  " + e.getLocalizedMessage(), e);

	}
}
 
开发者ID:oncecloud,项目名称:devops-cstack,代码行数:14,代码来源:ServerServiceImpl.java

示例13: findEnabledImages

import javax.persistence.PersistenceException; //导入方法依赖的package包/类
@Override
public List<Image> findEnabledImages()
        throws ServiceException {
    try {
        logger.debug("start find enabled images");
        List<Image> images = imageDAO.findAllEnabledImages();
        logger.info("ImageService : enabled found ");
        return images;
    } catch (PersistenceException e) {
        logger.error("Error ImageService : error find enabled images Method : "
                + e);
        throw new ServiceException(e.getLocalizedMessage(), e);
    }
}
 
开发者ID:oncecloud,项目名称:devops-cstack,代码行数:15,代码来源:ImageServiceImpl.java

示例14: findAll

import javax.persistence.PersistenceException; //导入方法依赖的package包/类
@Override
public List<Image> findAll()
        throws ServiceException {
    try {
        logger.debug("start findAll");
        List<Image> images = imageDAO.findAll();
        logger.info("ImageService : All Images found ");
        return images;
    } catch (PersistenceException e) {
        logger.error("Error ImageService : error findById Method : " + e);
        throw new ServiceException(e.getLocalizedMessage(), e);

    }
}
 
开发者ID:oncecloud,项目名称:devops-cstack,代码行数:15,代码来源:ImageServiceImpl.java

示例15: findByContainerID

import javax.persistence.PersistenceException; //导入方法依赖的package包/类
@Override
public Server findByContainerID(String id) throws ServiceException {
	try {
		return serverDAO.findByContainerID(id);
	} catch (PersistenceException e) {
		throw new ServiceException("Error database : " + e.getLocalizedMessage(), e);
	}
}
 
开发者ID:oncecloud,项目名称:devops-cstack,代码行数:9,代码来源:ServerServiceImpl.java


注:本文中的javax.persistence.PersistenceException.getLocalizedMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。