public class DefaultAppVersioningStrategy extends Object implements AppVersioningStrategy
Provides the default strategy for managing AppModel versions.
Constructor and Description |
---|
DefaultAppVersioningStrategy(WorkObjectService workObjectService,
UserManager userManager,
com.fasterxml.jackson.databind.ObjectMapper objectMapper,
String hostIdentifier,
int maxHistoryEntries,
TimeProvider timeProvider) |
Modifier and Type | Method and Description |
---|---|
com.google.common.collect.ImmutableMap<String,String> |
getAppVersioningMetaData(String appModelId)
Returns the metadata that should be stored as part of the export.
|
void |
incrementVersion(String appModelId,
String comment)
Increments the version number for the given app.
|
boolean |
isNewerVersion(String appModelId,
Map<String,String> incomingMetaData)
Checks that the incoming app is a newer version of the current app.
|
void |
markAsModified(String appModelId)
Called whenever an app has been modified (e.g. when it transitions to the 'pending' state).
|
public DefaultAppVersioningStrategy(WorkObjectService workObjectService, UserManager userManager, @Qualifier(value="persistentObjectMapper") com.fasterxml.jackson.databind.ObjectMapper objectMapper, String hostIdentifier, int maxHistoryEntries, TimeProvider timeProvider)
public void incrementVersion(String appModelId, String comment)
AppVersioningStrategy
Increments the version number for the given app.
incrementVersion
in interface AppVersioningStrategy
appModelId
- the ID of the app model whose version is to be incrementedcomment
- the modification commentpublic com.google.common.collect.ImmutableMap<String,String> getAppVersioningMetaData(String appModelId) throws AppVersioningException
AppVersioningStrategy
Returns the metadata that should be stored as part of the export.
This metadata will be needed to check whether or not a particular version should be imported.
getAppVersioningMetaData
in interface AppVersioningStrategy
appModelId
- the ID of the app model being exportedAppVersioningException
- if the app does not contain versioning informationpublic boolean isNewerVersion(String appModelId, Map<String,String> incomingMetaData) throws AppVersioningException
AppVersioningStrategy
Checks that the incoming app is a newer version of the current app.
isNewerVersion
in interface AppVersioningStrategy
appModelId
- the ID of the local app model to be checkedincomingMetaData
- the incoming app versioning metadatatrue
if the incoming app is a newer versionAppVersioningException
- if the app versioning information is incompatiblepublic void markAsModified(String appModelId)
AppVersioningStrategy
Called whenever an app has been modified (e.g. when it transitions to the 'pending' state).
markAsModified
in interface AppVersioningStrategy
appModelId
- the modified app model IDCopyright © 2010 - 2019 edorasware ag. All Rights Reserved.