本文整理汇总了Java中de.espirit.firstspirit.access.store.LockException类的典型用法代码示例。如果您正苦于以下问题:Java LockException类的具体用法?Java LockException怎么用?Java LockException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LockException类属于de.espirit.firstspirit.access.store包,在下文中一共展示了LockException类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: releaseEntity
import de.espirit.firstspirit.access.store.LockException; //导入依赖的package包/类
/**
* This method is used to release an entity.
*
* @param content2 The content2 object of the entity.
* @param entity The Entity to release.
* @param checkOnly Determines if the method should do only a check or really release the object.
* @return true if successful.
*/
private boolean releaseEntity(Content2 content2, Entity entity, boolean checkOnly) {
boolean result = true;
String validationError = new FormValidator(workflowScriptContext).isValid(content2, entity);
if (validationError == null) {
if (!checkOnly) {
try {
entity.refresh();
content2.refresh();
content2.release(entity);
content2.refresh();
content2.getParent().refresh();
} catch (LockException e) {
Logging.logError("Exception during Release of " + entity, e, LOGGER);
result = false;
}
}
} else {
Logging.logError("Validation failure during release!", LOGGER);
validationErrorList.add(validationError);
result = false;
}
return result;
}
示例2: deleteProject
import de.espirit.firstspirit.access.store.LockException; //导入依赖的package包/类
/**
* This methods deletes a FirstSpirit project from a server
* @param connection to the FirstSpirit server
* @param projectName of the project you want to delete
* @return true if the project was deleted successfully, false otherwise.
* @throws ExecutionException If a project with the given name does not exist on the server or it does exists, but cannot be locked.
*/
public boolean deleteProject(Connection connection, String projectName) {
LOGGER.info("Start deleting project: '{}'", projectName);
if (connection == null) {
LOGGER.error("Connection is not set!");
throw new IllegalArgumentException("Connection is null.");
}
Project project = connection.getProjectByName(projectName);
if (project == null) {
LOGGER.error("Cannot find project!");
throw new ExecutionException(EXCEPTIONSTRING + projectName + " does not exist on server.");
}
LOGGER.debug("Lock project");
try {
project.lock();
LOGGER.debug("Project is locked.");
} catch (LockException e) {
LOGGER.error("Cannot lock project. ", e);
throw new ExecutionException(EXCEPTIONSTRING + projectName + " could not be locked.");
}
ProjectStorage projectStorage = returnProjectStorage(connection, project);
if (projectStorage == null) {
LOGGER.error("Cannot process deletion. Preparation failed.");
throw new ExecutionException(EXCEPTIONSTRING + "ProjectStorage is missing.");
}
return performDeletion(project, projectStorage);
}
示例3: setActiveWebServerForProject
import de.espirit.firstspirit.access.store.LockException; //导入依赖的package包/类
private static boolean setActiveWebServerForProject(WebScope webScope, Project project) {
try {
project.lock();
project.setActiveWebServer(webScope.toString(), project.getSelectedWebServer(webScope.toString()));
project.save();
project.unlock();
return true;
} catch (LockException e) {
LOGGER.error("Cannot lock and save project!", e);
return false;
}
}