本文整理汇总了Java中liquibase.exception.UnsupportedChangeException类的典型用法代码示例。如果您正苦于以下问题:Java UnsupportedChangeException类的具体用法?Java UnsupportedChangeException怎么用?Java UnsupportedChangeException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UnsupportedChangeException类属于liquibase.exception包,在下文中一共展示了UnsupportedChangeException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleExecute
import liquibase.exception.UnsupportedChangeException; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void handleExecute(Database database) throws CustomChangeException,
UnsupportedChangeException {
String currentPassword = ApplicationPropertySecurity.KEYSTORE_PASSWORD.getValue();
if (currentPassword == null || currentPassword.length() == 0) {
Map<ApplicationConfigurationPropertyConstant, String> settings = new HashMap<ApplicationConfigurationPropertyConstant, String>();
settings.put(ApplicationPropertySecurity.KEYSTORE_PASSWORD,
DigestUtils.md5Hex(UUID.randomUUID().toString()));
SecurityContext currentContext = null;
try {
currentContext = AuthenticationHelper.setInternalSystemToSecurityContext();
CommunoteRuntime.getInstance().getConfigurationManager()
.updateApplicationConfigurationProperties(settings);
} catch (ConfigurationUpdateException e) {
throw new CustomChangeException("Storing the keystore password failed", e);
} finally {
AuthenticationHelper.setSecurityContext(currentContext);
}
}
}
示例2: execute
import liquibase.exception.UnsupportedChangeException; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void execute(Database arg0) throws CustomChangeException, UnsupportedChangeException {
NoteDao dao = ServiceLocator.findService(NoteDao.class);
TransactionManagement tm = ServiceLocator.findService(TransactionManagement.class);
Note latestNote = dao.findLatestNote();
if (latestNote != null) {
UpdateFollowablesInTransactionTask task = new UpdateFollowablesInTransactionTask(dao);
long maxId = latestNote.getId();
for (long i = 0; i <= maxId; i++) {
task.setNoteId(i);
tm.execute(task);
}
}
}
示例3: execute
import liquibase.exception.UnsupportedChangeException; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void execute(Database arg0) throws CustomChangeException, UnsupportedChangeException {
TransactionManagement tm = ServiceLocator.findService(TransactionManagement.class);
// get Blog with highest id
BlogDao dao = ServiceLocator.findService(BlogDao.class);
Blog blog = dao.findLatestBlog();
if (blog != null) {
long max = blog.getId();
UpdateGlobalIdInTransactionTask task = new UpdateGlobalIdInTransactionTask();
for (long i = 0; i <= max; i++) {
task.setBlogId(i);
tm.execute(task);
}
}
}
示例4: execute
import liquibase.exception.UnsupportedChangeException; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void execute(Database arg0) throws CustomChangeException, UnsupportedChangeException {
GlobalIdDao globalIdDao = ServiceLocator.findService(GlobalIdDao.class);
GlobalId latestGlobalId = globalIdDao.findLatestGlobalId();
int modifiedIds = 0;
if (latestGlobalId != null) {
long max = latestGlobalId.getId();
String uniqueClientId = CommunoteRuntime.getInstance().getConfigurationManager()
.getClientConfigurationProperties()
.getProperty(ClientProperty.UNIQUE_CLIENT_IDENTIFER);
String correctPrefix = "/" + uniqueClientId + "/";
// update all globalIds up to the latest
for (long i = 0; i <= max; i++) {
// try loading, if it not exists just skip it
GlobalId entityToUpdate = globalIdDao.load(i);
if (entityToUpdate != null) {
if (correctGlobalIdString(entityToUpdate, correctPrefix, globalIdDao)) {
modifiedIds++;
}
}
}
}
confirmMessage = "Updated " + modifiedIds + " global IDs";
}
示例5: handleExecute
import liquibase.exception.UnsupportedChangeException; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void handleExecute(Database database) throws CustomChangeException,
UnsupportedChangeException {
String password = ApplicationPropertySecurity.TRUSTED_CA_TRUSTSTORE_PASSWORD.getValue();
if (password == null || password.length() == 0) {
Map<ApplicationConfigurationPropertyConstant, String> settings = new HashMap<ApplicationConfigurationPropertyConstant, String>();
settings.put(ApplicationPropertySecurity.TRUSTED_CA_TRUSTSTORE_PASSWORD,
DigestUtils.md5Hex(UUID.randomUUID().toString()));
SecurityContext currentContext = null;
try {
currentContext = AuthenticationHelper.setInternalSystemToSecurityContext();
CommunoteRuntime.getInstance().getConfigurationManager()
.updateApplicationConfigurationProperties(settings);
} catch (ConfigurationUpdateException e) {
throw new CustomChangeException("Storing the application properties failed", e);
} finally {
AuthenticationHelper.setSecurityContext(currentContext);
}
}
}
示例6: execute
import liquibase.exception.UnsupportedChangeException; //导入依赖的package包/类
@Override
public void execute(Database arg0) throws CustomChangeException, UnsupportedChangeException {
SecurityContext currentContext = AuthenticationHelper.setInternalSystemToSecurityContext();
try {
Collection<User> users = ServiceLocator
.findService(UserManagement.class)
.findUsersByRole(UserRole.ROLE_KENMEI_USER, UserStatus.ACTIVE);
NavigationItemService navigationItemService = ServiceLocator
.findService(NavigationItemService.class);
for (User user : users) {
navigationItemService.createBuiltInNavigationItems(user.getId());
}
} catch (AuthorizationException e) {
throw new CustomChangeException("Creating built-in navigation items failed", e);
} finally {
AuthenticationHelper.setSecurityContext(currentContext);
}
}
示例7: execute
import liquibase.exception.UnsupportedChangeException; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void execute(Database database) throws CustomChangeException, UnsupportedChangeException {
String iid = appProperties.getProperty(ApplicationProperty.INSTALLATION_UNIQUE_ID);
if (iid == null) {
boolean installed = CommunoteRuntime.getInstance().getConfigurationManager()
.getStartupProperties().isInstallationDone();
iid = UUID.randomUUID().toString();
Map<ApplicationConfigurationPropertyConstant, String> settings = null;
settings = new HashMap<ApplicationConfigurationPropertyConstant, String>();
settings.put(ApplicationProperty.INSTALLATION_UNIQUE_ID, iid);
SecurityContext currentContext = null;
try {
if (installed) {
currentContext = AuthenticationHelper.setInternalSystemToSecurityContext();
}
CommunoteRuntime.getInstance().getConfigurationManager()
.updateApplicationConfigurationProperties(settings);
} catch (ConfigurationUpdateException e) {
throw new CustomChangeException("Storing the application properties failed", e);
} finally {
if (installed) {
AuthenticationHelper.setSecurityContext(currentContext);
}
}
}
confirmationMessage = "Add unique id to the installation.";
}
示例8: execute
import liquibase.exception.UnsupportedChangeException; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void execute(Database arg0) throws CustomChangeException, UnsupportedChangeException {
// load the configuration without decrypt the password, which would happen by using
// ClientConfigurationProperties.getSharepointConfiguration()
// The sharepoint configuration has moved to a plugin, hence the change of password to
// encrypted cannot happen here. Existing configuration still using decrypted password need
// to reset it manually.
}
示例9: execute
import liquibase.exception.UnsupportedChangeException; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void execute(Database database) throws CustomChangeException, UnsupportedChangeException {
// get Tag with highest id
TagDao dao = ServiceLocator.findService(TagDao.class);
Long tagId = null;
Statement statement;
try {
statement = database.getConnection().createStatement();
statement.execute("SELECT id FROM core_tag ORDER BY id DESC LIMIT 1");
ResultSet resultSet = statement.getResultSet();
if (resultSet.next()) {
tagId = resultSet.getLong(1);
}
} catch (SQLException e) {
throw new CustomChangeException(e);
}
TagManagement tagManagement = ServiceLocator.instance().getService(TagManagement.class);
if (tagId != null) {
for (long i = 0; i <= tagId; i++) {
Tag tagToUpdate = dao.load(i);
if (tagToUpdate != null) {
tagManagement.assignGlobalIdForTag(tagToUpdate);
}
}
}
}
示例10: execute
import liquibase.exception.UnsupportedChangeException; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void execute(Database arg0) throws CustomChangeException, UnsupportedChangeException {
// The ldap configuration has moved (partial) to a plugin, hence the change cannot happen
// here anymore.
}
示例11: execute
import liquibase.exception.UnsupportedChangeException; //导入依赖的package包/类
/**
* @param database
* The current database.
*
* @throws CustomChangeException
* Exception.
*
* @throws UnsupportedChangeException
* Exception.
*/
@Override
public void execute(Database database) throws CustomChangeException, UnsupportedChangeException {
// don't run it on newly installed systems (i.e. installed with installer); good metric is
// whether to check whether there are clients, if not it's a new installation
Collection<ClientTO> clients = ServiceLocator.findService(ClientRetrievalService.class)
.getAllClients();
if (clients == null || clients.size() == 0) {
confirmationMessage = "Skipping " + EncryptClientCreationDate.class.getSimpleName()
+ " update task on new installation";
return;
}
ClientConfigurationProperties clientConfigurationProperties = CommunoteRuntime
.getInstance().getConfigurationManager().getClientConfigurationProperties();
String encryptedCreationDate = clientConfigurationProperties
.getProperty(ClientProperty.CREATION_DATE);
ClientTO currentClient = ClientHelper.getCurrentClient();
if (encryptedCreationDate == null) { // Only if it still doesn't exist.
try {
Date time = currentClient.getCreationDate();
if (time == null) {
time = new Date(0);
}
encryptedCreationDate = EncryptionUtils.encrypt(Long.toString(time.getTime()),
ApplicationProperty.INSTALLATION_UNIQUE_ID.getValue());
CommunoteRuntime
.getInstance()
.getConfigurationManager()
.updateClientConfigurationProperty(ClientProperty.CREATION_DATE,
encryptedCreationDate);
} catch (EncryptionException e) {
throw new CustomChangeException(e);
}
}
confirmationMessage = "Updated encrypted creation date..";
}
示例12: execute
import liquibase.exception.UnsupportedChangeException; //导入依赖的package包/类
/**
* If there are already clients this method will delegate to {@link #handleExecute(Database)},
* else it will return.
*
* {@inheritDoc}
*/
@Override
public void execute(Database database) throws CustomChangeException, UnsupportedChangeException {
// don't run it on newly installed systems (i.e. installed with installer); good metric is
// whether to check whether there are clients, if not it's a new installation
Collection<ClientTO> clients = ServiceLocator.findService(ClientRetrievalService.class)
.getAllClients();
if (clients == null || clients.size() == 0) {
setConfirmationMessage("Skipping " + EncryptClientCreationDate.class.getSimpleName()
+ " update task on new installation");
return;
}
handleExecute(database);
}
示例13: execute
import liquibase.exception.UnsupportedChangeException; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void execute(Database db) throws CustomChangeException, UnsupportedChangeException {
// don't run it on newly installed systems (i.e. installed with installer); good metric is
// whether to check whether there are clients, if not it's a new installation
Collection<ClientTO> clients = ServiceLocator.findService(ClientRetrievalService.class)
.getAllClients();
if (clients == null || clients.size() == 0) {
confirmationMessage = "Skipping "
+ MoveApplicationPropertiesFromFileToDatabase.class.getSimpleName()
+ " update task on new installation";
return;
}
ConfigurationManager propsManager = CommunoteRuntime.getInstance()
.getConfigurationManager();
String context = propsManager.getApplicationConfigurationProperties().getProperty(
OldUrlApplicationProperty.WEB_APPLICATION_URI_PREFIX);
if (StringUtils.isBlank(context) || context.equals("/")) {
context = null;
}
String urlPrefix = propsManager.getApplicationConfigurationProperties().getProperty(
OldUrlApplicationProperty.WEB_APPLICATION_URL_PREFIX);
String secureUrlPrefix = propsManager.getApplicationConfigurationProperties().getProperty(
OldUrlApplicationProperty.WEB_APPLICATION_URL_PREFIX_SECURE);
Map<ApplicationConfigurationPropertyConstant, String> settings = buildUpdateSettings(
urlPrefix, secureUrlPrefix, context);
SecurityContext currentContext = null;
try {
currentContext = AuthenticationHelper.setInternalSystemToSecurityContext();
propsManager.updateApplicationConfigurationProperties(settings);
} catch (ConfigurationUpdateException e) {
throw new CustomChangeException("Refactoring the properties failed", e);
} finally {
AuthenticationHelper.setSecurityContext(currentContext);
}
confirmationMessage = "Refactored URL properties.";
}
示例14: execute
import liquibase.exception.UnsupportedChangeException; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void execute(Database arg0) throws CustomChangeException, UnsupportedChangeException {
TaskManagement taskManagement = ServiceLocator.findService(TaskManagement.class);
// now + 5 minutes.
Long startDate = System.currentTimeMillis() + 5 * 60 * 1000;
try {
taskManagement.addTask("SynchronizeGroups", true, 3600000L, new Date(startDate),
"com.communote.server.core.user.groups.UserGroupSynchronizationTaskHandler");
taskManagement.addTask("RemindUsers", true, 8640000L, new Date(startDate),
"com.communote.server.core.user.RemindUserJob");
} catch (TaskManagementException e) {
throw new CustomChangeException(e);
}
}
示例15: generateRollbackStatements
import liquibase.exception.UnsupportedChangeException; //导入依赖的package包/类
@Override
public SqlStatement[] generateRollbackStatements(Database database) throws UnsupportedChangeException, RollbackImpossibleException {
List<SqlStatement> statements = new ArrayList<SqlStatement>();
SqlStatement[] forward = this.generateStatements(database);
for(SqlStatement thisForward: forward){
InsertOrUpdateStatement thisInsert = (InsertOrUpdateStatement)thisForward;
DeleteStatement delete = new DeleteStatement(getSchemaName(),getTableName());
delete.setWhereClause(getWhereClause(thisInsert,database));
statements.add(delete);
}
return statements.toArray(new SqlStatement[statements.size()]);
}