@groovy.util.logging.Slf4j @groovy.transform.CompileStatic class NCubeManager extends java.lang.Object
This class manages a list of NCubes. This class is referenced by NCube in one place - when it joins to other cubes, it consults the NCubeManager to find the joined NCube.
This class takes care of creating, loading, updating, releasing, and deleting NCubes. It also allows you to get a list of NCubes matching a wildcard (SQL Like) string.Constructor and description |
---|
NCubeManager
(NCubePersister persister, org.springframework.cache.CacheManager permCacheManager) |
Type Params | Return Type | Name and description |
---|---|---|
|
java.lang.Integer |
acceptMine(ApplicationID appId, java.lang.Object[] cubeNames) Forcefully merge the branch cubes passed in, into head, making them the latest revision in head. |
|
java.lang.Integer |
acceptTheirs(ApplicationID appId, java.lang.Object[] cubeNames, java.lang.String sourceBranch = ApplicationID.HEAD) Forcefully update the branch cubes with the cube with the same name from the HEAD branch. |
|
protected boolean |
assertNotLockBlocked(ApplicationID appId) |
|
java.lang.Boolean |
assertPermissions(ApplicationID appId, java.lang.String resource, Action action = Action.READ) Assert that the requested permission is allowed. |
|
void |
cancelPullRequest(java.lang.String prId) |
|
void |
changeVersionValue(ApplicationID appId, java.lang.String newVersion) |
|
java.util.Map |
checkMultiplePermissions(ApplicationID appId, java.lang.String resource, java.lang.Object[] actions) |
|
java.lang.Boolean |
checkPermissions(ApplicationID appId, java.lang.String resource, Action action) Verify whether the action can be performed against the resource (typically cube name). |
|
void |
clearCache(ApplicationID appId) |
|
void |
clearPermCache() |
|
void |
clearTestDatabase() |
|
java.util.Map<java.lang.String, java.lang.Object> |
commitBranch(ApplicationID appId, java.lang.Object[] inputCubes = null, java.lang.String notes = null) Commit the passed in changed cube records identified by NCubeInfoDtos. |
|
java.lang.Integer |
copyBranch(ApplicationID srcAppId, ApplicationID targetAppId, boolean copyWithHistory = false) Copy branch from one app id to another |
|
void |
createCube(NCube ncube) |
|
NCube |
createCube(ApplicationID appId, java.lang.String cubeName, byte[] cubeBytes) |
|
protected void |
createPermissionsCubes(ApplicationID appId) |
|
protected void |
createPermissionsCubesIfNewAppId(ApplicationID appId) |
|
void |
createRefAxis(ApplicationID appId, java.lang.String cubeName, java.lang.String axisName, ApplicationID refAppId, java.lang.String refCubeName, java.lang.String refAxisName) Create a reference axis from an existing axis. |
|
protected void |
createSysAppIfNotExists(java.lang.String tenant) |
|
java.lang.Boolean |
deleteApp(ApplicationID appId) |
|
java.lang.Boolean |
deleteBranch(ApplicationID appId) |
|
java.lang.Boolean |
deleteCubes(ApplicationID appId, java.lang.Object[] cubeNames) Delete the named NCube from the database |
|
java.lang.Boolean |
deleteCubes(ApplicationID appId, java.lang.Object[] cubeNames, boolean allowDelete) |
|
protected boolean |
detectNewAppId(ApplicationID appId) |
|
java.lang.Boolean |
duplicate(ApplicationID oldAppId, ApplicationID newAppId, java.lang.String oldName, java.lang.String newName) Duplicate the given n-cube specified by oldAppId and oldName to new ApplicationID and name, |
|
java.util.List<Delta> |
fetchJsonBranchDiffs(NCubeInfoDto newInfoDto, NCubeInfoDto oldInfoDto) Get a list of deltas between two NCubes from NCubeInfoDtos |
|
java.util.List<Delta> |
fetchJsonRevDiffs(long newCubeId, long oldCubeId) Get a list of deltas between two NCubes from NCube ids |
|
java.lang.String |
generatePullRequestHash(ApplicationID appId, java.lang.Object[] infoDtos, java.lang.String notes = '') |
|
java.lang.String |
getAppLockedBy(ApplicationID appId) Determine if the ApplicationID is locked. |
|
java.lang.Object[] |
getAppNames() Return a List of Strings containing all unique App names for the given tenant. |
|
java.util.Map |
getAppTests(ApplicationID appId) |
|
java.util.List<NCubeInfoDto> |
getBranchChangesForHead(ApplicationID appId) Get a list of NCubeInfoDto's that represent the n-cubes that have been made to this branch. |
|
java.util.List<NCubeInfoDto> |
getBranchChangesForMyBranch(ApplicationID appId, java.lang.String branch) Update a branch from the HEAD. |
|
java.lang.Integer |
getBranchCount(ApplicationID appId) |
|
java.lang.Object[] |
getBranches(ApplicationID appId) |
|
java.util.List<NCubeInfoDto> |
getCellAnnotation(ApplicationID appId, java.lang.String cubeName, java.util.Set<java.lang.Long> ids, boolean ignoreVersion = false) Get a List |
|
NCube |
getCube(ApplicationID appId, java.lang.String cubeName) Load the n-cube with the given name. |
|
java.util.List<NCubeInfoDto> |
getHeadChangesForBranch(ApplicationID appId) Update a branch from the HEAD. |
|
java.lang.String |
getJson(ApplicationID appId, java.lang.String cubeName, java.util.Map options) |
|
java.lang.String |
getLatestVersion(ApplicationID appId) Get the lastest version for the given tenant, app, and SNAPSHOT or RELEASE. |
|
java.lang.String |
getNotes(ApplicationID appId, java.lang.String cubeName) |
|
NCubePersister |
getPersister() |
|
java.lang.Object[] |
getPullRequests(java.util.Date startDate = null, java.util.Date endDate = null, java.lang.String prId = null) |
|
java.util.List<AxisRef> |
getReferenceAxes(ApplicationID appId) This API will hand back a List of AxisRef, which is a complete description of a Reference Axis pointer. |
|
java.util.Set<java.lang.String> |
getReferencesFrom(ApplicationID appId, java.lang.String name, java.util.Set<java.lang.String> refs = new CaseInsensitiveSet<>() Retrieve all cube names that are deeply referenced by ApplicationID + n-cube name. |
|
java.util.List<NCubeInfoDto> |
getRevisionHistory(ApplicationID appId, java.lang.String cubeName, boolean ignoreVersion = false) Get a List |
|
java.lang.String |
getTenant() |
|
java.lang.Object[] |
getTests(ApplicationID appId, java.lang.String cubeName) |
|
java.lang.String |
getUserId() Retrieve the user ID from the current thread |
|
java.lang.Object[] |
getVersions(java.lang.String app) Get all of the versions that exist for the given ApplicationID (app name). |
|
java.lang.Boolean |
isAppAdmin(ApplicationID appId) |
|
java.lang.Boolean |
isCubeUpToDate(ApplicationID appId, java.lang.String cubeName) |
|
java.lang.Boolean |
isSysAdmin() |
|
protected java.lang.Boolean |
isTypeOfAdmin(ApplicationID appId) |
|
NCubeInfoDto |
loadCubeRecord(ApplicationID appId, java.lang.String cubeName, java.util.Map options = null) Load n-cube, bypassing any caching. |
|
NCubeInfoDto |
loadCubeRecordById(long id, java.util.Map options = null) |
|
java.lang.Boolean |
lockApp(ApplicationID appId, boolean shouldLock) Lock the given appId so that no changes can be made to any cubes within it |
|
protected NCube |
mergeCubesIfPossible(NCubeInfoDto branchInfo, NCubeInfoDto headInfo, boolean headToBranch) |
|
java.lang.Boolean |
mergeDeltas(ApplicationID appId, java.lang.String cubeName, java.util.List<Delta> deltas) Merge the passed in List of Delta's into the named n-cube. |
|
java.util.Map<java.lang.String, java.lang.Object> |
mergePullRequest(java.lang.String prId) |
|
java.lang.Integer |
moveBranch(ApplicationID appId, java.lang.String newSnapVer) Move the branch specified in the appId to the newer snapshot version (newSnapVer). |
|
void |
obsoletePullRequest(java.lang.String prId) |
|
NCubeInfoDto |
promoteRevision(long cubeId) Promote a previous revision of an NCube. |
|
java.lang.Integer |
releaseCubes(ApplicationID appId, java.lang.String newSnapVer = null) Perform release (SNAPSHOT to RELEASE) for the given ApplicationIDs n-cubes. |
|
java.lang.Integer |
releaseVersion(ApplicationID appId, java.lang.String newSnapVer = null) Perform release (SNAPSHOT to RELEASE) for the given ApplicationIDs n-cubes. |
|
java.lang.Boolean |
renameCube(ApplicationID appId, java.lang.String oldName, java.lang.String newName) |
|
void |
reopenPullRequest(java.lang.String prId) |
|
java.lang.Boolean |
restoreCubes(ApplicationID appId, java.lang.Object[] cubeNames) Restore a previously deleted n-cube. |
|
java.lang.Integer |
rollbackBranch(ApplicationID appId, java.lang.Object[] names) Rollback the passed in list of n-cubes. |
|
java.util.List<NCubeInfoDto> |
search(ApplicationID appId, java.lang.String cubeNamePattern, java.lang.String content, java.util.Map options) Fetch an array of NCubeInfoDto's where the cube names match the cubeNamePattern (contains) and the content (in JSON format) 'contains' the passed in content String. |
|
void |
setUserId(java.lang.String user) Set the user ID on the current thread |
|
void |
updateAxisMetaProperties(ApplicationID appId, java.lang.String cubeName, java.lang.String axisName, java.util.Map<java.lang.String, java.lang.Object> newMetaProperties) Update an Axis meta-properties |
|
java.util.Map<java.lang.String, java.lang.Object> |
updateBranch(ApplicationID appId, java.lang.Object[] cubeDtos = null) Update the branch represented by the passed in ApplicationID (appId), with the cubes to be updated identified by cubeNames, and the sourceBranch is the branch (could be HEAD) source of the cubes from which to update. |
|
java.lang.Boolean |
updateCube(NCube ncube, boolean updateHead = false) Update the passed in NCube. |
|
java.lang.Boolean |
updateCube(ApplicationID appId, java.lang.String cubeName, byte[] cubeBytes) |
|
java.lang.Boolean |
updateNotes(ApplicationID appId, java.lang.String cubeName, java.lang.String notes) |
|
protected void |
updateOpenPullRequestVersions(ApplicationID appId, java.lang.String newSnapVer, boolean onlyCurrentBranch = false) |
|
void |
updateReferenceAxes(java.lang.Object[] axisRefs) |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Forcefully merge the branch cubes passed in, into head, making them the latest revision in head. This API is typically only called after verification from user that they understand there is a conflict, and the user is choosing to take the cube in their branch as the next revision, ignoring the content in the cube with the same name in the HEAD branch.
appId
- ApplicationID for the passed in cube namescubeNames
- Object[] of String names of n-cubeForcefully update the branch cubes with the cube with the same name from the HEAD branch. The branch is specified on the ApplicationID. This API is typically only be called after verification from the user that they understand there is a conflict, but they are choosing to overwrite their changes in their branch with the cube with the same name, from HEAD.
appId
- ApplicationID for the passed in cube namescubeNames
- Object[] of String names of n-cubeObject[]
- of String SHA-1's for each of the cube names in the branch.Assert that the requested permission is allowed. Throw a SecurityException if not.
Verify whether the action can be performed against the resource (typically cube name).
appId
- ApplicationID containing the n-cube being checked.resource
- String cubeName or cubeName with wildcards('*' or '?') or cubeName / axisName (with wildcards).action
- Action To be attempted.Commit the passed in changed cube records identified by NCubeInfoDtos.
Copy branch from one app id to another
srcAppId
- Branch copied from (source branch)targetAppId
- Branch copied to (must not exist)Create a reference axis from an existing axis. If the reference information is does not point to an existing n-cube, then a new one will be created. The source axis will provide the values for the newly created reference axis. The source cube will also be updated to have a reference axis. If the reference information points to an existing n-cube, then the source cube's axis will be updated to point to the existing reference axis. If the new reference axis had fewer or more columns, the cells in the columns that no longer exist are dropped. If the referenced axis has columns that did not exist on the source axis, those newly created cells will be empty. Finally, for columns that existed on the original source axis as well as exist on the existing referenced axis, they will be kept.
Delete the named NCube from the database
cubeNames
- Object[] of String cube names to be deleted (soft deleted)Duplicate the given n-cube specified by oldAppId and oldName to new ApplicationID and name,
Get a list of deltas between two NCubes from NCubeInfoDtos
newInfoDto
- NCubeInfoDtooldInfoDto
- NCubeInfoDtoGet a list of deltas between two NCubes from NCube ids
newCubeId
- longoldCubeId
- longDetermine if the ApplicationID is locked. This is an expensive call because it always hits the database. Use judiciously (obtain value before loops, etc.)
Return a List of Strings containing all unique App names for the given tenant.
Get a list of NCubeInfoDto's that represent the n-cubes that have been made to this branch. This is the source of n-cubes for the 'Commit' and 'Rollback' lists.
Update a branch from the HEAD. Changes from the HEAD are merged into the supplied branch. If the merge cannot be done perfectly, an exception is thrown indicating the cubes that are in conflict.
Get a List
Load the n-cube with the given name. This API works identically to loadCube(). It is strongly recommended that this method should not be called and instead that loadCube() should be called, when it is being called in a situation where it is known the target is an NCubeManager.
Update a branch from the HEAD. Changes from the HEAD are merged into the supplied branch. If the merge cannot be done perfectly, an exception is thrown indicating the cubes that are in conflict.
Get the lastest version for the given tenant, app, and SNAPSHOT or RELEASE.
This API will hand back a List of AxisRef, which is a complete description of a Reference Axis pointer. It includes the Source ApplicationID, source Cube Name, source Axis Name, and all the referenced cube/axis and filter (cube/method) parameters.
appId
- ApplicationID of the cube-set from which to fetch all the reference axes.Retrieve all cube names that are deeply referenced by ApplicationID + n-cube name.
Get a List
Retrieve the user ID from the current thread
Get all of the versions that exist for the given ApplicationID (app name).
Load n-cube, bypassing any caching. This is necessary for n-cube-editor (IDE time usage). If the IDE environment is clustered, cannot be getting stale copies from cache. Any advices in the manager will be applied to the n-cube.
Lock the given appId so that no changes can be made to any cubes within it
appId
- ApplicationID to lockshouldLock
- - true to lock, false to unlockMerge the passed in List of Delta's into the named n-cube.
appId
- ApplicationID containing the named n-cube.cubeName
- String name of the n-cube into which the Delta's will be merged.deltas
- List of Delta instancesMove the branch specified in the appId to the newer snapshot version (newSnapVer).
ApplicationID
- indicating what to movenewSnapVer
- String version to move cubes toPromote a previous revision of an NCube.
cubeId
- longPerform release (SNAPSHOT to RELEASE) for the given ApplicationIDs n-cubes.
Perform release (SNAPSHOT to RELEASE) for the given ApplicationIDs n-cubes.
Restore a previously deleted n-cube.
Rollback the passed in list of n-cubes. Each one will be returned to the state is was when the branch was created. This is an insert cube (maintaining revision history) for each cube passed in.
Fetch an array of NCubeInfoDto's where the cube names match the cubeNamePattern (contains) and the content (in JSON format) 'contains' the passed in content String.
appId
- ApplicationID on which we are workingcubeNamePattern
- cubeNamePattern String pattern to match cube namescontent
- String value that is 'contained' within the cube's JSONoptions
- map with possible keys. See NCubeConstants.SEARCH_*Set the user ID on the current thread
user
- String user IdUpdate an Axis meta-properties
Update the branch represented by the passed in ApplicationID (appId), with the cubes to be updated identified by cubeNames, and the sourceBranch is the branch (could be HEAD) source of the cubes from which to update.
appId
- ApplicationID of the destination branchcubeNames
- [optional] Object[] of NCubeInfoDto's to limit the update to. Only n-cubes matching these
will be updated. This can be null, in which case all possible updates will be performed. If not supplied, this
will default to null.sourceBranch
- [optional] String name of branch to update from. This is often 'HEAD' as HEAD is the most
common branch from which to pull updates. However, it could be the name of another user's branch,
in which case the updates will be pulled from that branch (and optionally filtered by cubeNames). If not
supplied, this defaults to HEAD.
Update the passed in NCube. Only SNAPSHOT cubes can be updated.
ncube
- NCube to be updated.