List of usage examples for com.liferay.portal.kernel.util LoggingTimer LoggingTimer
public LoggingTimer(String name)
From source file:com.liferay.exportimport.internal.upgrade.v1_0_0.UpgradePublisherRequest.java
License:Open Source License
protected void updateScheduledPublications(Group group) throws PortalException { try (LoggingTimer loggingTimer = new LoggingTimer(String.valueOf(group.getGroupId()))) { boolean localStaging = true; if (group.isStagedRemotely() || group.hasRemoteStagingGroup()) { localStaging = false;// w w w . j a va 2 s . c om } List<SchedulerResponse> scheduledJobs = _schedulerEngineHelper.getScheduledJobs( getSchedulerGroupName(group.getGroupId(), localStaging), StorageType.PERSISTED); for (SchedulerResponse schedulerResponse : scheduledJobs) { if (localStaging) { updateScheduledLocalPublication(schedulerResponse); } else { updateScheduleRemotePublication(schedulerResponse); } } } }
From source file:com.liferay.invitation.invite.members.internal.upgrade.v1_0_0.UpgradeNamespace.java
License:Open Source License
protected void renameTable(String oldTableName, String newTableName, Object[][] tableColumns, String tableSqlCreate, String tableSqlDrop) throws Exception { try (LoggingTimer loggingTimer = new LoggingTimer(newTableName)) { boolean hasNewTable = hasTable(newTableName); if (hasNewTable && hasRows(newTableName)) { if (_log.isWarnEnabled()) { _log.warn("Not renaming " + oldTableName + " to " + newTableName + " because " + newTableName + " has data"); }//from w w w.j a v a 2 s .c o m return; } boolean hasOldTable = hasTable(oldTableName); if (hasOldTable && !hasRows(oldTableName)) { if (_log.isWarnEnabled()) { _log.warn("Not renaming " + oldTableName + " to " + newTableName + " because " + oldTableName + " has no data"); } return; } if (!hasNewTable && !hasOldTable) { runSQL(tableSqlCreate); return; } if (hasNewTable) { runSQL(tableSqlDrop); } UpgradeTable upgradeTable = UpgradeTableFactoryUtil.getUpgradeTable(oldTableName, tableColumns); upgradeTable.setCreateSQL(tableSqlCreate); upgradeTable.updateTable(); } }
From source file:com.liferay.marketplace.internal.upgrade.v0_0_1.UpgradeExpando.java
License:Open Source License
protected void updateMPExpandoColumns(long companyId) throws Exception { try (LoggingTimer loggingTimer = new LoggingTimer(String.valueOf(companyId))) { ExpandoTable expandoTable = null; try {/* w w w .ja v a 2 s . c om*/ expandoTable = _expandoTableLocalService.getTable(companyId, User.class.getName(), "MP"); } catch (NoSuchTableException nste) { // LPS-52675 if (_log.isDebugEnabled()) { _log.debug(nste, nste); } return; } ExpandoColumn oldExpandoColumn = _expandoColumnLocalService.getColumn(companyId, User.class.getName(), expandoTable.getName(), "client-id"); if (oldExpandoColumn == null) { return; } ExpandoColumn newExpandoColumn = _expandoColumnLocalService.getColumn(companyId, User.class.getName(), expandoTable.getName(), "clientID"); if (newExpandoColumn == null) { newExpandoColumn = _expandoColumnLocalService.updateColumn(oldExpandoColumn.getColumnId(), "clientID", ExpandoColumnConstants.STRING); } List<ExpandoValue> expandoValues = _expandoValueLocalService .getColumnValues(oldExpandoColumn.getColumnId(), QueryUtil.ALL_POS, QueryUtil.ALL_POS); for (ExpandoValue expandoValue : expandoValues) { _expandoValueLocalService.addValue(expandoValue.getCompanyId(), User.class.getName(), expandoTable.getName(), newExpandoColumn.getName(), expandoValue.getClassPK(), expandoValue.getString()); } _expandoColumnLocalService.deleteColumn(oldExpandoColumn.getColumnId()); } }