Class CardManager
java.lang.Object
ch.colabproject.colab.api.controller.card.CardManager
Card, card type and card content specific logic
- Author:
- sandra
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionassertAndGetCard(Long cardId) Retrieve the card.voidchangeCardPosition(Long cardId, GridPosition position) Change the position of the card (stay in the same parent, just change position within grid)booleancheckIntegrity(Card card) Check the integrity of the cardvoidcreateCardType(Long cardId) Create a card type for a card which has nonecreateNewCard(Long parentId, Long cardTypeId) Complete and persist a new card into the given card content with the given card type.voidDelete the cards ready to be deletedvoidflagCardAsToDeleteForever(Long cardId) Set the deletion status to TO_DELETE.getActivityFlowLinkAsNext(Long cardId) Get all activity flow links of which the given card is the next onegetActivityFlowLinkAsPrevious(Long cardId) Get all activity flow links of which the given card is the previous onegetAliveSubCards(CardContent parent) getAllCardContents(Card rootCard) Get all cardContentsgetAllCards(Card rootCard) Get a card and all cards within in one set.getAssignments(Long cardId) Retrieve the list of assignments for the given cardgetContentVariants(Long cardId) Get all variants content for the given cardgetStickyNoteLinkAsDest(Long cardId) Get all sticky note links of which the given card is the destinationgetStickyNoteLinkAsSrcCard(Long cardId) Get all sticky note links of which the given card is the sourceInitialize a new root card.voidMove a card to a new parentvoidmoveCardAbove(Long cardId) Move a card to its grandparent card content.voidputCardInBin(Long cardId) Put the given card in the bin.voidremoveCardType(Long cardId) Remove the card type of the card.voidFor the cards which are since a long time in bin, set the deletion status to TO_DELETE.voidrestoreCardFromBin(Long cardId) Restore from the bin.
-
Constructor Details
-
CardManager
public CardManager()
-
-
Method Details
-
assertAndGetCard
Retrieve the card. If not found, throw aHttpErrorMessage.- Parameters:
cardId- the id of the card- Returns:
- the card if found
- Throws:
ch.colabproject.colab.generator.model.exceptions.HttpErrorMessage- if the card was not found
-
getAllCards
Get a card and all cards within in one set.- Parameters:
rootCard- the first card- Returns:
- the rootCard + all cards within
-
getAllCardContents
Get all cardContents- Parameters:
rootCard- the first card- Returns:
- all cardContent in the card hierarchy
-
getAliveSubCards
- Parameters:
parent- the card content parent- Returns:
- All not-deleted cards under the given card content.
-
createNewCard
Complete and persist a new card into the given card content with the given card type.Also create its default resource references.
- Parameters:
parentId- the id of the parent of the new cardcardTypeId- the id of the card type of the new card. Can be null- Returns:
- a new, initialized and persisted card
-
initNewRootCard
Initialize a new root card. This card contains every other cards of a project.No persistence stuff in there
- Returns:
- a new card dedicated to be the root card of a project
-
putCardInBin
Put the given card in the bin. (= set DeletionStatus to BIN + set erasure tracking data)- Parameters:
cardId- the id of the card
-
restoreCardFromBin
Restore from the bin. The object won't contain any deletion or erasure data anymore.It means that the card is back at its place (as much as possible).
If the parent card is deleted, the card is moved at the root of the project.
- Parameters:
cardId- the id of the card
-
flagCardAsToDeleteForever
Set the deletion status to TO_DELETE.It means that the card is no more visible.
- Parameters:
cardId- the id of the card
-
removeOldCardsFromBin
public void removeOldCardsFromBin()For the cards which are since a long time in bin, set the deletion status to TO_DELETE.It means that the cards are no more visible.
-
deleteForeverOldCards
public void deleteForeverOldCards()Delete the cards ready to be deleted -
changeCardPosition
Change the position of the card (stay in the same parent, just change position within grid)Recompute the position of all the sister cards
- Parameters:
cardId- the id of the cardposition- the new position to set
-
moveCard
Move a card to a new parent- Parameters:
cardId- id of the card to movenewParentId- id of the new parent- Throws:
ch.colabproject.colab.generator.model.exceptions.HttpErrorMessage- if card or parent does not exist or if parent is a child of the card
-
moveCardAbove
Move a card to its grandparent card content. (aka move a level up)- Parameters:
cardId- the id of the card to move- Throws:
ch.colabproject.colab.generator.model.exceptions.HttpErrorMessage- if card or parent does not exist
-
getContentVariants
Get all variants content for the given card- Parameters:
cardId- the id of the card- Returns:
- all card contents of the card
-
getStickyNoteLinkAsDest
Get all sticky note links of which the given card is the destination- Parameters:
cardId- the id of the card- Returns:
- all sticky note linked from the card
-
getStickyNoteLinkAsSrcCard
Get all sticky note links of which the given card is the source- Parameters:
cardId- the id of the card- Returns:
- all sticky note linked to the card
-
getActivityFlowLinkAsPrevious
Get all activity flow links of which the given card is the previous one- Parameters:
cardId- the id of the card- Returns:
- all activity flow linked to the card
-
getActivityFlowLinkAsNext
Get all activity flow links of which the given card is the next one- Parameters:
cardId- the id of the card- Returns:
- all activity flow linked from the card
-
getAssignments
Retrieve the list of assignments for the given card- Parameters:
cardId- id of the card- Returns:
- list of assignments
-
checkIntegrity
Check the integrity of the card- Parameters:
card- the card to check- Returns:
- true iff the card is complete and safe
-
createCardType
Create a card type for a card which has none- Parameters:
cardId- the card id
-
removeCardType
Remove the card type of the card.For now, it handles only card types that have no resource
- Parameters:
cardId- the card id
-