Checks if the installed module is updatable with the version from the import zip file.<p>

@param cms the current CMS context

@return true if the module is updatable
774419
public boolean checkUpdatable(CmsObject cms) {

        CmsModule newModule = getModule();
        LOG.info("Checking if module " + newModule.getName() + " is updateable");
        String exportVersion = newModule.getExportVersion();
        CmsModule installedModule = OpenCms.getModuleManager().getModule(getModule().getName());
        if (!CmsModuleUpdater.checkCompatibleModuleResources(installedModule, newModule)) {
            LOG.info("Module is not updateable because of incompatible module resources. ");
            return false;
        }

        if ((exportVersion == null) || !exportVersion.equals("" + CmsImportVersion10.IMPORT_VERSION10)) {
            LOG.info("Module is not updateable because the export version is not 10.");
            return false;
        }

        try {
            Map<CmsUUID, CmsResourceImportData> importResourcesById = new HashMap<>();
            for (CmsResourceImportData resData : getResourceData()) {
                if (resData.hasStructureId()) {
                    importResourcesById.put(resData.getResource().getStructureId(), resData);
                }
            }
            cms = getCms();
            CmsObject onlineCms = OpenCms.initCmsObject(cms);
            m_onlineCms = onlineCms;
            CmsProject online = cms.readProject(CmsProject.ONLINE_PROJECT_NAME);
            onlineCms.getRequestContext().setCurrentProject(online);
            for (CmsResourceImportData resData : getResourceData()) {
                String importPath = CmsModuleUpdater.normalizePath(resData.getResource().getRootPath());
                if (resData.hasStructureId()) {
                    CmsUUID importId = resData.getResource().getStructureId();
                    for (CmsObject cmsToRead : Arrays.asList(cms, onlineCms)) {
                        try {
                            CmsResource resourceFromVfs = cmsToRead.readResource(importPath, CmsResourceFilter.ALL);
                            boolean skipResourceIdCheck = false;
                            if (!resourceFromVfs.getStructureId().equals(importId)) {

                                if (resData.getResource().isFile()
                                    && resourceFromVfs.isFile()
                                    && !containsStructureId(resourceFromVfs.getStructureId())
                                    && !vfsResourceWithStructureId(importId)) {

                                    LOG.info(
                                        "Permitting conflicting id in module update for resource "
                                            + resData.getPath()
                                            + " because the id from the module is not present in the VFS and vice versa.");
                                    m_conflictingIds.put(importId, resourceFromVfs.getStructureId());

                                    // If we have different structure ids, but they don't conflict with anything else in the manifest or VFS,
                                    // we don't compare resource ids. First, because having different resource ids is normal in this scenario, second
                                    // because the resource in the VFS is deleted anyway during the module update.
                                    skipResourceIdCheck = true;

                                } else {

                                    LOG.info(
                                        "Module is not updateable because the same path is mapped to different structure ids in the import and in the VFS: "
                                            + importPath);
                                    return false;
                                }
                            }
                            if (!skipResourceIdCheck
                                && resData.getResource().isFile()
                                && !(resData.getResource().getResourceId().equals(resourceFromVfs.getResourceId()))) {
                                LOG.info(
                                    "Module is not updateable because of a resource id conflict for "
                                        + resData.getResource().getRootPath());
                                return false;
                            }
                        } catch (CmsVfsResourceNotFoundException e) {
                            // ignore
                        }
                    }

                    try {
                        CmsResource vfsResource = cms.readResource(importId, CmsResourceFilter.ALL);
                        if (vfsResource.isFolder() != resData.getResource().isFolder()) {
                            LOG.info(
                                "Module is not updateable because the same id belongs to a file in the import and a folder in the VFS, or vice versa");
                            return false;
                        }
                    } catch (CmsVfsResourceNotFoundException e) {
                        // ignore
                    }
                } else {
                    CmsModule module = getModule();
                    boolean included = false;
                    boolean excluded = false;
                    for (String res : module.getResources()) {
                        if (CmsStringUtil.isPrefixPath(res, resData.getPath())) {
                            included = true;
                            break;
                        }
                    }
                    for (String res : module.getExcludeResources()) {
                        if (CmsStringUtil.isPrefixPath(res, resData.getPath())) {
                            excluded = true;
                            break;
                        }
                    }
                    if (included && !excluded) {
                        LOG.info(
                            "Module is not updateable because one of the resource entries included in the module resources has no structure id in the manifest.");
                        return false;
                    }
                }

            }
            return true;
        } catch (CmsException e) {
            LOG.info("Module is not updateable because of error: " + e.getLocalizedMessage(), e);
            return false;
        }
    }
913249
@SuppressWarnings("unchecked")
  public <T extends CMAResource> T setVersion(Integer version) {
    getSystem().setVersion(version);
    return (T) this;
  }
1166873
private boolean versionCheck(String title) {
        if (this.type != UpdateType.NO_VERSION_CHECK) {
            final String version = caller.getPluginVersion();
            final String remoteVersion = title; // Get the newest file's version number

            if (this.hasTag(version) || version.contains(remoteVersion)) {
                // We already have the latest version, or this build is tagged for no-update
                this.result = Updater.UpdateResult.NO_UPDATE;
                return false;
            }
        }
        return true;
    }
511271
public static boolean checkConfiguredInModules() {

        Boolean result = m_moduleCheckCache.get();
        if (result == null) {
            result = Boolean.valueOf(getConfiguredTemplateMapping() != null);
            m_moduleCheckCache.set(result);
        }
        return result.booleanValue();
    }
717280
protected <T> boolean checkIfModified(CachedResource<T> cachedResource) {
        final Resource resource = cachedResource.getResource();

        // Check if the resource has been modified since it was last loaded.
        final long lastLoadTime = cachedResource.getLastLoadTime();
        final long mainLastModified = this.getLastModified(resource);
        boolean resourceModified = lastLoadTime < mainLastModified;
        if (resourceModified) {
            this.logger.trace(
                    "Resource {} was modified at {}, reloading",
                    new Object[] {resource, mainLastModified});
            return true;
        }

        // If the main resource hasn't changed check additional resources for modifications
        for (final Map.Entry<Resource, Long> additionalResourceEntry :
                cachedResource.getAdditionalResources().entrySet()) {
            final Resource additionalResource = additionalResourceEntry.getKey();
            final Long resourceLastLoadTime = additionalResourceEntry.getValue();

            final long lastModified = this.getLastModified(additionalResource);
            if (resourceLastLoadTime < lastModified) {
                this.logger.trace(
                        "Additional resource {} for {} was modified at {}, reloading",
                        new Object[] {additionalResource, resource, lastModified});
                return true;
            }
        }

        this.logger.trace(
                "{} has not been modified since last loaded {}, returning",
                cachedResource,
                lastLoadTime);
        return false;
    }
646705
protected boolean isUpdateAvailable() {
		boolean result = false;
		String version = EMPTY_VERSION;
		try {
			version = retrieveRemoteVersion(store.getVersionUrl(), store.getCharset());
		} catch (final IOException e) {
			LOG.info(MSG_NO_UPDATE_CHECK_POSSIBLE);
			LOG.debug(String.format(MSG_NO_UPDATE_CHECK_POSSIBLE__DEBUG, e.getClass().getName(), e.getLocalizedMessage()));
		}
		if (hasUpdate(version, getCurrentVersion())) {
			LOG.debug(String.format(MSG_UPDATE_AVAILABLE, getCurrentVersion(), version));
			result = true;
		} else {
			LOG.debug(String.format(MSG_NO_UPDATE_AVAILABLE, getCurrentVersion()));
		}
		lastUpdateCheck = System.currentTimeMillis();
		return result;
	}
1002329
public boolean isModifiedOnVersion(String version) {
		if (version == null || version.isEmpty()) {
			return true;
		}
		if (this.history != null && this.history.isModifiedOnVersion(version)) {
			return true;
		}
		if (this.fields != null) {
			for (APIParameter param : this.fields) {
				if (param.isModifiedOnVersion(version)) {
					return true;
				}
			}
		}
		return false;
	}
1371897
public static void checkVersionUpgradable(int oldVersion) 
                                     throws IOException {
    if (oldVersion > LAST_UPGRADABLE_LAYOUT_VERSION) {
      String msg = "*********** Upgrade is not supported from this older" +
                   " version of storage to the current version." + 
                   " Please upgrade to " + LAST_UPGRADABLE_HADOOP_VERSION +
                   " or a later version and then upgrade to current" +
                   " version. Old layout version is " + 
                   (oldVersion == 0 ? "'too old'" : (""+oldVersion)) +
                   " and latest layout version this software version can" +
                   " upgrade from is " + LAST_UPGRADABLE_LAYOUT_VERSION +
                   ". ************";
      LOG.error(msg);
      throw new IOException(msg); 
    }
    
  }
105605
public static boolean isEditingModelGroups(CmsObject cms, CmsResource containerPage) {

        return (OpenCms.getResourceManager().getResourceType(containerPage).getTypeName().equals(
            CmsResourceTypeXmlContainerPage.MODEL_GROUP_TYPE_NAME)
            && OpenCms.getRoleManager().hasRole(cms, CmsRole.DEVELOPER));
    }
119379
private boolean resourceExists(CmsObject cms, String resource) {

        try {
            cms.readResource(resource, CmsResourceFilter.ALL);
            return true;
        } catch (CmsException e) {
            return false;
        }
    }
699283
public static boolean isVersionDownloadableNewer(Activity mActivity, String versionDownloadable) {
        String versionInstalled = null;
        try {
            versionInstalled = mActivity.getPackageManager().getPackageInfo(mActivity.getPackageName(), 0).versionName;
        } catch (PackageManager.NameNotFoundException ignored) {
        }
        if (versionInstalled.equals(versionDownloadable)) { // If it is equal, no new version downloadable
            return false;
        } else {
            return versionCompareNumerically(versionDownloadable, versionInstalled) > 0; // Return if the versionDownloadble is newer than the installed
        }
    }
1078414
public void updateModuleFromDefault(String importFile) throws Exception {

        String exportPath = OpenCms.getSystemInfo().getPackagesRfsPath();
        String fileName = OpenCms.getSystemInfo().getAbsoluteRfsPathRelativeToWebInf(
            exportPath + CmsSystemInfo.FOLDER_MODULES + importFile);
        updateModule(fileName);
    }
557041
public static boolean updatingIndexNecessesary(CmsObject cms) {

        // Set request to the offline project.
        setCmsOfflineProject(cms);

        // Check whether the spellcheck index directories are empty.
        // If they are, the index has to be built obviously.
        if (isSolrSpellcheckIndexDirectoryEmpty()) {
            return true;
        }

        // Compare the most recent date of a dictionary with the oldest timestamp
        // that determines when an index has been built.
        long dateMostRecentDictionary = getMostRecentDate(cms);
        long dateOldestIndexWrite = getOldestIndexDate(cms);

        return dateMostRecentDictionary > dateOldestIndexWrite;
    }
930495
private void updateValidation() {

        boolean changed = false;
        changed |= CmsVaadinUtils.updateComponentError(m_textField, null);
        String path = getValue();
        if (!CmsStringUtil.isEmptyOrWhitespaceOnly(path)) {
            if (!m_cms.existsResource(path, CmsResourceFilter.IGNORE_EXPIRATION)) {
                ErrorMessage error = new UserError(
                    CmsVaadinUtils.getMessageText(Messages.GUI_MODULES_MODULE_RESOURCE_NOT_FOUND_0),
                    ContentMode.TEXT,
                    ErrorLevel.WARNING);
                changed |= CmsVaadinUtils.updateComponentError(m_textField, error);
            }
        }
        if (changed) {
            fireEvent(new Component.ErrorEvent(null, this));
        }
    }
225276
public boolean isModifiedOnVersion(String version) {
		if( this.modificationHistory.isModifiedOnVersion(version)
				|| this.outParameter.isModifiedOnVersion(version) ) {
			return true;
		}
		for(APIParameter inParameter : inParameters) {
			if(inParameter.isModifiedOnVersion(version)) {
				return true;
			}
		}
		return false;
	}
1001874
public boolean isShowUpgradeWizard() {
        HttpSession session = Stapler.getCurrentRequest().getSession(false);
        if(session != null) {
            return Boolean.TRUE.equals(session.getAttribute(SHOW_UPGRADE_WIZARD_FLAG));
        }
        return false;
    }
257929
public boolean canBeImplemented(Page page) {
        Integer implementedVersion = getImplementedVersion(page);
        return implementedVersion == null || page.getVersion() != implementedVersion;
    }