Package org.craftercms.studio.api.v2.dal
Interface ItemDAO
public interface ItemDAO
-
Field Summary
FieldsModifier and TypeFieldDescription -
Method Summary
Modifier and TypeMethodDescriptionvoidclearPreviousPath(String siteId, String path) Clear previous path of the contentintcountAllContentItems(List<String> nonContentItemTypes) Count all content items in the systemintcountPreviousPaths(String siteId, String previousPath, long newMask) Count non-new items having previous path property set to given pathvoiddeleteBySiteAndPath(long siteId, String path) Delete itemvoiddeleteBySiteAndPathForFolder(long siteId, String path) Delete items for site and folder pathvoiddeleteItemsForSite(long siteId) Delete all items for sitegetChangeSetForSubtree(String siteId, String path, String likePath, List<String> nonContentItemTypes, long inProgressMask) Get change set for subtreegetChildrenByPath(Long siteId, String path, String systemTypeFolder, String localeCode, String keyword, List<String> systemTypes, List<String> excludeSystemTypes, List<String> excludes, String sortStrategy, String order, int offset, int limit) Get children for given path from databaseintgetChildrenByPathTotal(Long siteId, String path, String localeCode, String keyword, List<String> systemTypes, List<String> excludeSystemTypes, List<String> excludes) Get total number of children for given pathgetContentTypeUsages(String siteId, String contentType, String scriptPath) Finds all items related to a given content-typegetDetailedItemsByStates(long siteId, long statesBitMap, String systemTypeFolder, String completedState, List<String> systemTypes, List<org.craftercms.commons.rest.parameters.SortField> sortFields, String stagingEnvironment, String liveEnvironment, int offset, int limit) Get a list ofDetailedItemfor given site and filters (system_types, states)getExistingRenamedChildrenOfMandatoryParentsForPublishing(String siteId, List<String> parents, long newMask, long modifiedMask) getInProgressItems(String siteId, long inProgressMask) Get in progress items from DBgetItemById(long id, String siteId, String systemTypeFolder, String completedState, String stagingEnvironment, String liveEnvironment) Get item by idgetItemByPath(Long siteId, String path, String systemTypeFolder, String completedState, String stagingEnvironment, String liveEnvironment) Get item for given path from databasegetItemByPathPreferContent(Long siteId, String path, String systemTypeFolder, String completedState, String stagingEnvironment, String liveEnvironment) Get item with prefer content option for given path from databasegetItemBySiteIdAndPath(long siteId, String path, String systemTypeFolder, String completedState, String stagingEnvironment, String liveEnvironment) Get item for given site and pathgetItemBySiteIdAndPathPreferContent(long siteId, String path, String systemTypeFolder, String completedState, String stagingEnvironment, String liveEnvironment) Get item with prefer content option for given site and pathgetItemStates(String siteId, String path, Long states, List<String> systemTypes, List<org.craftercms.commons.rest.parameters.SortField> sortFields, int offset, int limit) Get item states for given filters by path regex and states maskintGet total number of item states records for given filters by path regex and states maskgetMandatoryParentsForPublishing(String siteId, List<String> possibleParents, long newMask, long modifiedMask) Get mandatory parents for publishinggetSandboxItemsById(List<Long> itemIds, String systemTypeFolder, List<org.craftercms.commons.rest.parameters.SortField> sortFields) Get sandbox items for given idsgetSandboxItemsByIdPreferContent(List<Long> itemIds, String systemTypeFolder, List<org.craftercms.commons.rest.parameters.SortField> sortFields) Get sandbox items for given ids with prefer content optiongetSandboxItemsByPath(Long siteId, List<String> paths, String systemTypeFolder, boolean preferContent) Get sandbox items for given pathsgetSubtreeForDelete(String siteId, String likePath) Get subtree for deletevoidlockItemByPath(String siteId, String path, long lockOwnerId, long lockedBitOn, String systemTypeFolder) Lock itemvoidmoveItem(String siteId, String oldPath, String newPath, Long parentId, String oldPreviewUrl, String newPreviewUrl, String label, long onStatesBitMap, long offStatesBitMap) Move itemvoidresetStatesBySiteAndPathBulk(long siteId, List<String> paths, long statesBitMap) Reset items statevoidsetStatesBySiteAndPathBulk(long siteId, List<String> paths, long statesBitMap) Set items statevoidunlockItemByPath(String siteId, String path, long lockedBitOff) Lock itemvoidupdateCommitId(String siteId, String path, String commitId) Update commit id for itemvoidupdateItem(Item item) Update itemvoidupdateLastPublishedOn(String siteId, String path, ZonedDateTime lastPublishedOn) Update last published date for itemvoidupdateNewPageChildren(String siteId, String folderPath) When creating a new page in an already existing folder, we need to update the children of the folder to become the children of the page.voidupdateStatesByQuery(String siteId, String path, Long states, long setStatesMask, long resetStatesMask) Update item state by queryvoidupdateStatesBySiteAndPathBulk(long siteId, Collection<String> paths, long onStatesBitMap, long offStatesBitMap) Update states to flip on list off states and flip off another list of states for itemsvoidupdateStatesForSite(long siteId, long onStatesBitMap, long offStatesBitMap) Update states to flip on list off states and flip off another list of states for itemsvoidupsertEntry(Item item) insert or update item
-
Field Details
-
SORT_FIELD_MAP
-
DETAILED_ITEM_SORT_FIELD_MAP
-
-
Method Details
-
getChildrenByPathTotal
int getChildrenByPathTotal(@Param("siteId") Long siteId, @Param("path") String path, @Param("localeCode") String localeCode, @Param("keyword") String keyword, @Param("systemTypes") List<String> systemTypes, @Param("excludeSystemTypes") List<String> excludeSystemTypes, @Param("excludes") List<String> excludes) Get total number of children for given path- Parameters:
siteId- site identifierpath- path to get children forlocaleCode- local codekeyword- filter by keywordsystemTypes- filter by typeexcludeSystemTypes- system types to excludeexcludes- exclude items by path- Returns:
- total number of children
-
getChildrenByPath
List<Item> getChildrenByPath(@Param("siteId") Long siteId, @Param("path") String path, @Param("systemTypeFolder") String systemTypeFolder, @Param("localeCode") String localeCode, @Param("keyword") String keyword, @Param("systemTypes") List<String> systemTypes, @Param("excludeSystemTypes") List<String> excludeSystemTypes, @Param("excludes") List<String> excludes, @Param("sortStrategy") String sortStrategy, @Param("order") String order, @Param("offset") int offset, @Param("limit") int limit) Get children for given path from database- Parameters:
siteId- site identifierpath- path to get children forsystemTypeFolder- system type value for folderlocaleCode- locale codekeyword- filter by keywordsystemTypes- filter by typeexcludeSystemTypes- system types to excludeexcludes- exclude items by pathsortStrategy- sort strategyorder- order of childrenoffset- offset of the first record to returnlimit- number of children to return- Returns:
- list of items (parent, level descriptor, children)
-
upsertEntry
insert or update item- Parameters:
item- item to insert/update
-
getItemById
DetailedItem getItemById(@Param("id") long id, @Param("siteId") String siteId, @Param("systemTypeFolder") String systemTypeFolder, @Param("completedState") String completedState, @Param("stagingEnvironment") String stagingEnvironment, @Param("liveEnvironment") String liveEnvironment) Get item by id- Parameters:
id- item idsiteId- site identifiersystemTypeFolder- value for system type foldercompletedState- completed statestagingEnvironment- staging environmentliveEnvironment- live environment- Returns:
- item identified by given id
-
getItemBySiteIdAndPath
DetailedItem getItemBySiteIdAndPath(@Param("siteId") long siteId, @Param("path") String path, @Param("systemTypeFolder") String systemTypeFolder, @Param("completedState") String completedState, @Param("stagingEnvironment") String stagingEnvironment, @Param("liveEnvironment") String liveEnvironment) Get item for given site and path- Parameters:
siteId- site identifierpath- path of the itemsystemTypeFolder- value for system type foldercompletedState- completed statestagingEnvironment- staging environmentliveEnvironment- live environment- Returns:
- item for given site and path
-
getItemBySiteIdAndPathPreferContent
DetailedItem getItemBySiteIdAndPathPreferContent(@Param("siteId") long siteId, @Param("path") String path, @Param("systemTypeFolder") String systemTypeFolder, @Param("completedState") String completedState, @Param("stagingEnvironment") String stagingEnvironment, @Param("liveEnvironment") String liveEnvironment) Get item with prefer content option for given site and path- Parameters:
siteId- site identifierpath- path of the itemsystemTypeFolder- value for system type foldercompletedState- completed statestagingEnvironment- staging environmentliveEnvironment- live environment- Returns:
- item for given site and path
-
updateItem
Update item- Parameters:
item- item to update
-
deleteBySiteAndPath
Delete item- Parameters:
siteId- site identifierpath- path of item to delete
-
setStatesBySiteAndPathBulk
void setStatesBySiteAndPathBulk(@Param("siteId") long siteId, @Param("paths") List<String> paths, @Param("statesBitMap") long statesBitMap) Set items state- Parameters:
siteId- site identifierpaths- paths of itemsstatesBitMap- states bit map to be set
-
resetStatesBySiteAndPathBulk
void resetStatesBySiteAndPathBulk(@Param("siteId") long siteId, @Param("paths") List<String> paths, @Param("statesBitMap") long statesBitMap) Reset items state- Parameters:
siteId- site identifierpaths- paths of itemsstatesBitMap- states bit map to be reset
-
updateStatesBySiteAndPathBulk
void updateStatesBySiteAndPathBulk(@Param("siteId") long siteId, @Param("paths") Collection<String> paths, @Param("onStatesBitMap") long onStatesBitMap, @Param("offStatesBitMap") long offStatesBitMap) Update states to flip on list off states and flip off another list of states for items- Parameters:
siteId- site identifierpaths- list of paths to update states foronStatesBitMap- state bitmap to flip onoffStatesBitMap- state bitmap to flip off
-
updateStatesForSite
void updateStatesForSite(@Param("siteId") long siteId, @Param("onStatesBitMap") long onStatesBitMap, @Param("offStatesBitMap") long offStatesBitMap) Update states to flip on list off states and flip off another list of states for items- Parameters:
siteId- site identifieronStatesBitMap- state bitmap to flip onoffStatesBitMap- state bitmap to flip off
-
deleteItemsForSite
void deleteItemsForSite(@Param("siteId") long siteId) Delete all items for site- Parameters:
siteId- site id
-
deleteBySiteAndPathForFolder
Delete items for site and folder path- Parameters:
siteId- site idpath- path of the folder
-
moveItem
void moveItem(@Param("siteId") String siteId, @Param("oldPath") String oldPath, @Param("newPath") String newPath, @Param("parentId") Long parentId, @Param("oldPreviewUrl") String oldPreviewUrl, @Param("newPreviewUrl") String newPreviewUrl, @Param("label") String label, @Param("onStatesBitMap") long onStatesBitMap, @Param("offStatesBitMap") long offStatesBitMap) Move item- Parameters:
siteId- site identifieroldPath- old pathnewPath- new pathparentId- new parent IDoldPreviewUrl- old preview urlnewPreviewUrl- new preview urllabel- the new labelonStatesBitMap- state bitmap to flip onoffStatesBitMap- state bitmap to flip off
-
getItemByPath
DetailedItem getItemByPath(@Param("siteId") Long siteId, @Param("path") String path, @Param("systemTypeFolder") String systemTypeFolder, @Param("completedState") String completedState, @Param("stagingEnvironment") String stagingEnvironment, @Param("liveEnvironment") String liveEnvironment) Get item for given path from database- Parameters:
siteId- site identifierpath- path of the itemsystemTypeFolder- value for system type foldercompletedState- completed statestagingEnvironment- staging environmentliveEnvironment- live environment- Returns:
- item
-
getDetailedItemsByStates
List<DetailedItem> getDetailedItemsByStates(@Param("siteId") long siteId, @Param("statesBitMap") long statesBitMap, @Param("systemTypeFolder") String systemTypeFolder, @Param("completedState") String completedState, @Param("systemTypes") List<String> systemTypes, @Param("sortFields") List<org.craftercms.commons.rest.parameters.SortField> sortFields, @Param("stagingEnvironment") String stagingEnvironment, @Param("liveEnvironment") String liveEnvironment, @Param("offset") int offset, @Param("limit") int limit) Get a list ofDetailedItemfor given site and filters (system_types, states)- Parameters:
siteId- site identifierstatesBitMap- states bit map to filter bysystemTypeFolder- value for system type foldercompletedState- completed statesystemTypes- system types to filter bysortFields- sort fieldsstagingEnvironment- staging environmentliveEnvironment- live environmentoffset- offset for the first record in result setlimit- number of records to return- Returns:
- list of filtered
DetailedItems
-
getItemByPathPreferContent
DetailedItem getItemByPathPreferContent(@Param("siteId") Long siteId, @Param("path") String path, @Param("systemTypeFolder") String systemTypeFolder, @Param("completedState") String completedState, @Param("stagingEnvironment") String stagingEnvironment, @Param("liveEnvironment") String liveEnvironment) Get item with prefer content option for given path from database- Parameters:
siteId- site identifierpath- path of the itemsystemTypeFolder- value for system type foldercompletedState- completed statestagingEnvironment- staging environmentliveEnvironment- live environment- Returns:
- item
-
getSandboxItemsByPath
List<Item> getSandboxItemsByPath(@Param("siteId") Long siteId, @Param("paths") List<String> paths, @Param("systemTypeFolder") String systemTypeFolder, @Param("preferContent") boolean preferContent) Get sandbox items for given paths- Parameters:
siteId- site identifierpaths- paths to get items forsystemTypeFolder- value for system type folderpreferContent- indicates if pages should be returned instead of folders when available- Returns:
- list of items
-
getSandboxItemsByIdPreferContent
List<Item> getSandboxItemsByIdPreferContent(@Param("itemIds") List<Long> itemIds, @Param("systemTypeFolder") String systemTypeFolder, @Param("sortFields") List<org.craftercms.commons.rest.parameters.SortField> sortFields) Get sandbox items for given ids with prefer content option- Parameters:
itemIds- item idssystemTypeFolder- value for system type foldersortFields-- Returns:
- list of items
-
getSandboxItemsById
List<Item> getSandboxItemsById(@Param("itemIds") List<Long> itemIds, @Param("systemTypeFolder") String systemTypeFolder, @Param("sortFields") List<org.craftercms.commons.rest.parameters.SortField> sortFields) Get sandbox items for given ids- Parameters:
itemIds- item idssystemTypeFolder- value for system type foldersortFields-- Returns:
- list of items
-
getMandatoryParentsForPublishing
List<String> getMandatoryParentsForPublishing(@Param("siteId") String siteId, @Param("possibleParents") List<String> possibleParents, @Param("newMask") long newMask, @Param("modifiedMask") long modifiedMask) Get mandatory parents for publishing- Parameters:
siteId- site identifierpossibleParents- possible parentsnewMask- states mask for detecting new itemsmodifiedMask- states mask for detecting modified items- Returns:
- list of mandatory parents
-
getExistingRenamedChildrenOfMandatoryParentsForPublishing
-
countAllContentItems
Count all content items in the system- Returns:
- number of content items in the system
-
clearPreviousPath
Clear previous path of the content- Parameters:
siteId- site identifierpath- path of the content
-
getInProgressItems
List<Item> getInProgressItems(@Param("siteId") String siteId, @Param("inProgressMask") long inProgressMask) Get in progress items from DB- Parameters:
siteId- site identifierinProgressMask- in progress states mask- Returns:
- list of items
-
countPreviousPaths
int countPreviousPaths(@Param("siteId") String siteId, @Param("previousPath") String previousPath, @Param("newMask") long newMask) Count non-new items having previous path property set to given path- Parameters:
siteId- site identifierpreviousPath- path to check- Returns:
- number of items
-
updateCommitId
void updateCommitId(@Param("siteId") String siteId, @Param("path") String path, @Param("commitId") String commitId) Update commit id for item- Parameters:
siteId- site identifierpath- path of the itemcommitId- commit id
-
getChangeSetForSubtree
List<String> getChangeSetForSubtree(@Param("siteId") String siteId, @Param("path") String path, @Param("likePath") String likePath, @Param("nonContentItemTypes") List<String> nonContentItemTypes, @Param("inProgressMask") long inProgressMask) Get change set for subtree- Parameters:
siteId- site identifierpath- path of subtree rootlikePath- like path for querynonContentItemTypes- non content item typesinProgressMask- in progress state mask- Returns:
- list of items
-
updateLastPublishedOn
void updateLastPublishedOn(@Param("siteId") String siteId, @Param("path") String path, @Param("lastPublishedOn") ZonedDateTime lastPublishedOn) Update last published date for item- Parameters:
siteId- site identifierpath- path of the itemlastPublishedOn- published date
-
getContentTypeUsages
List<Item> getContentTypeUsages(@Param("siteId") String siteId, @Param("contentType") String contentType, @Param("scriptPath") String scriptPath) Finds all items related to a given content-type- Parameters:
siteId- the id of the sitecontentType- the id of the content-typescriptPath- the path of the controller script- Returns:
- the list of items
-
lockItemByPath
void lockItemByPath(@Param("siteId") String siteId, @Param("path") String path, @Param("lockOwnerId") long lockOwnerId, @Param("lockedBitOn") long lockedBitOn, @Param("systemTypeFolder") String systemTypeFolder) Lock item- Parameters:
siteId- site identifierpath- path of the itemlockOwnerId- lock ownerlockedBitOn- state bit mask with LOCKED bit onsystemTypeFolder- value for system type folder
-
unlockItemByPath
void unlockItemByPath(@Param("siteId") String siteId, @Param("path") String path, @Param("lockedBitOff") long lockedBitOff) Lock item- Parameters:
siteId- site identifierpath- path of the itemlockedBitOff- state bit mask with LOCKED bit off
-
getItemStatesTotal
int getItemStatesTotal(@Param("siteId") String siteId, @Param("path") String path, @Param("statesBitMap") Long states, @Param("systemTypes") List<String> systemTypes) Get total number of item states records for given filters by path regex and states mask- Parameters:
siteId- site identifierpath- path regex to filter itemsstates- states mask to filter items by statesystemTypes- system types to filter items- Returns:
- number of records
-
getItemStates
List<Item> getItemStates(@Param("siteId") String siteId, @Param("path") String path, @Param("statesBitMap") Long states, @Param("systemTypes") List<String> systemTypes, @Param("sortFields") List<org.craftercms.commons.rest.parameters.SortField> sortFields, @Param("offset") int offset, @Param("limit") int limit) Get item states for given filters by path regex and states mask- Parameters:
siteId- site identifierpath- path regex to filter itemsstates- states mask to filter items by statesystemTypes- system types to filter itemssortFields- list of sort fieldsoffset- offset for the first record in result setlimit- number of item states records to return- Returns:
- list of sandbox items
-
updateStatesByQuery
void updateStatesByQuery(@Param("siteId") String siteId, @Param("path") String path, @Param("statesBitMap") Long states, @Param("onStatesBitMap") long setStatesMask, @Param("offStatesBitMap") long resetStatesMask) Update item state by query- Parameters:
siteId- site identifierpath- path regex to filter items to be updatedstates- states bitmap mask to filter items to be updatedsetStatesMask- states bitmap mask to set states onresetStatesMask- states bitmap mask to set states off
-
getSubtreeForDelete
List<String> getSubtreeForDelete(@Param("siteId") String siteId, @Param("likePath") String likePath) Get subtree for delete- Parameters:
siteId- site identifierlikePath- like path for query- Returns:
- list of items
-
updateNewPageChildren
When creating a new page in an already existing folder, we need to update the children of the folder to become the children of the page. This method will find the direct children of the given folder, and update their parent id to be the id the new page (the item with path = folderPath + /index.xml).- Parameters:
siteId- site identifierfolderPath- path of the folder
-