protected Release toUnwrappedModel(Release release) { if (release instanceof ReleaseImpl) { return release; } ReleaseImpl releaseImpl = new ReleaseImpl(); releaseImpl.setNew(release.isNew()); releaseImpl.setPrimaryKey(release.getPrimaryKey()); releaseImpl.setReleaseId(release.getReleaseId()); releaseImpl.setCreateDate(release.getCreateDate()); releaseImpl.setModifiedDate(release.getModifiedDate()); releaseImpl.setServletContextName(release.getServletContextName()); releaseImpl.setBuildNumber(release.getBuildNumber()); releaseImpl.setBuildDate(release.getBuildDate()); releaseImpl.setVerified(release.isVerified()); releaseImpl.setState(release.getState()); releaseImpl.setTestString(release.getTestString()); return releaseImpl; }
public static void verify() throws Exception { // Check release Release release = null; try { release = ReleaseLocalServiceUtil.getRelease( ReleaseConstants.DEFAULT_SERVLET_CONTEXT_NAME, ReleaseInfo.getParentBuildNumber()); } catch (PortalException pe) { release = ReleaseLocalServiceUtil.addRelease( ReleaseConstants.DEFAULT_SERVLET_CONTEXT_NAME, ReleaseInfo.getParentBuildNumber()); } _checkReleaseState(); // Update indexes if (PropsValues.DATABASE_INDEXES_UPDATE_ON_STARTUP) { StartupHelperUtil.setDropIndexes(true); StartupHelperUtil.updateIndexes(); } else if (StartupHelperUtil.isUpgraded()) { StartupHelperUtil.updateIndexes(); } // Verify if (PropsValues.VERIFY_DATABASE_TRANSACTIONS_DISABLED) { _disableTransactions(); } try { StartupHelperUtil.verifyProcess(release.isVerified()); } catch (Exception e) { _updateReleaseState(ReleaseConstants.STATE_VERIFY_FAILURE); throw e; } finally { if (PropsValues.VERIFY_DATABASE_TRANSACTIONS_DISABLED) { _enableTransactions(); } } // Update indexes if (PropsValues.DATABASE_INDEXES_UPDATE_ON_STARTUP || StartupHelperUtil.isUpgraded()) { StartupHelperUtil.updateIndexes(false); } // Update release boolean verified = StartupHelperUtil.isVerified(); if (release.isVerified()) { verified = true; } ReleaseLocalServiceUtil.updateRelease( release.getReleaseId(), ReleaseInfo.getParentBuildNumber(), ReleaseInfo.getBuildDate(), verified); // Enable database caching after verify CacheRegistryUtil.setActive(true); }