Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue IMCMS-554: Model for copying document
- Prepare to stable version
- Loading branch information
Victor
authored and
Victor
committed
Nov 12, 2020
1 parent
5fcdeb2
commit 4f843c6
Showing
106 changed files
with
2,904 additions
and
673 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
DocumentCache | ||
============= | ||
|
||
|
||
Description | ||
""""""""""" | ||
DocumentCache bean allow easy manipulation caches for the document/page and also global cache. | ||
|
||
Use API | ||
------- | ||
Init DocumentCache - ``Imcms.getServices().getManagedBean(DocumentCache.class)`` | ||
|
||
.. code-block:: jsp | ||
String calculateKey(HttpServletRequest request); | ||
String calculateKey(final String documentIdString, final String langCode); | ||
void setCache(Ehcache cache); | ||
PageInfo getPageInfoFromCache(String key); | ||
void invalidateDoc(Integer id, String alias); | ||
void invalidateItem(String key); | ||
void invalidateCache(); | ||
void invalidateDoc(HttpServletRequest request); | ||
boolean isDocumentAlreadyCached(String cacheKey); | ||
void setDisableCachesByProperty(); | ||
long getAmountOfCachedDocuments(); | ||
void setAmountOfCachedDocuments(Integer number); // using only in scope imcms | ||
String getDisabledCacheValue(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
ImcmsLanguages | ||
============== | ||
|
||
|
||
In order to get the current ``IMCMS`` language need to use code like below | ||
|
||
Example usages current lang imcms | ||
""""""""""""""""""""""""""""""""" | ||
|
||
.. code-block:: jsp | ||
Language language = Imcms.getLanguage(); | ||
String codeLanguage = language.getCode(); | ||
String nativeLanguage = language.getNativeName(); | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
ImcmsUserLanguage | ||
================= | ||
|
||
In this scope we have possibles make different manipulation with current user imcms. You have to | ||
get instance ``UserDomainObject`` from global Imcms class, and then we can check everything. | ||
|
||
.. warning:: | ||
Use global Imcms.getUser() only for work with current user! Otherwise, use :doc:`UserService</API-documentation/service-beans/userService>` | ||
|
||
Example usages imcms user | ||
""""""""""""""""""""""""" | ||
|
||
.. code-block:: jsp | ||
UserDomainObject user = Imcms.getUser(); | ||
Example usages get current lang user | ||
"""""""""""""""""""""""""""""""""""" | ||
|
||
.. code-block:: jsp | ||
String language = Imcms.getUser().getLanguage(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Core | ||
==== | ||
|
||
|
||
.. toctree:: | ||
:titlesonly: | ||
|
||
managerBean | ||
documentCache | ||
imcmsLanguages | ||
imcmsUserLanguage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
ManagerBean | ||
=========== | ||
|
||
|
||
In this article: | ||
- `Introduction`_ | ||
- `Init ManagerBean`_ | ||
|
||
|
||
Introduction | ||
------------ | ||
Imcms has support any service beans in different files over - ManagerBean. | ||
With the help of ManagerBean we can easy call different implementation current service bean, which will be inject | ||
to this the ManagerBean. | ||
|
||
|
||
.. note:: | ||
In the first step must be check exits getters current bean in `Imcms.getService()` if don't - | ||
we can use ManagerBean with inject need type service bean! | ||
|
||
|
||
Init ManagerBean | ||
---------------- | ||
.. code-block:: jsp | ||
<T> T currentServiceBean = Imcms.getServices().getManagedBean(Class<T> requiredType); | ||
Block parameters: | ||
""""""""""""""""" | ||
|
||
+---------------------+--------------+--------------------------------------------------+ | ||
| Parameter | Type | Description | | ||
+=====================+==============+==================================================+ | ||
| requiredType | Class<T> | Service bean which was injected | | ||
+---------------------+--------------+--------------------------------------------------+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
API-Documentation | ||
================= | ||
|
||
Imcms has the main interface for call API is - ImcmsService; | ||
Init ImcmsService - Imcms.getServices(); | ||
|
||
.. toctree:: | ||
:titlesonly: | ||
|
||
service-beans/index | ||
core/index | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
MailService | ||
=========== | ||
|
||
In this article: | ||
- `Use API`_ | ||
|
||
Use API | ||
------- | ||
|
||
Init or get instance MailService over global Imcms.getServices ``Imcms.getServices().getMailService();`` | ||
|
||
.. code-block:: jsp | ||
Imcms.getServices().getMailService().sendMail(Mail mail); | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
AccessService | ||
============= | ||
|
||
In this article: | ||
- `Introduction`_ | ||
- `Use API`_ | ||
- `Description AccessType`_ | ||
|
||
|
||
Introduction | ||
------------ | ||
To know do the user have access to do something with some document or not. | ||
Imcms provides feature check permission and access for anybody user. Need to use just AccessService, which easy initialize. | ||
Init AccessService - ``Imcms.getServices().getAccessService()``; | ||
|
||
|
||
Use API | ||
------- | ||
|
||
.. code-block:: jsp | ||
AccessService accessService = Imcms.getServices().getAccessService(); | ||
boolean hasUserEditAccess = accessService.hasUserEditAccess(UserDomainObject user, Integer documentId, AccessType accessType); | ||
//Check, does the user have for access for edit document - ``documentId`` | ||
RestrictedPermission getEditPermission = accessService.getEditPermission(UserDomainObject user, int documentId); | ||
//Get all permission for user on the current document ``documentId`` | ||
Description AccessType | ||
---------------------- | ||
|
||
``AccessType`` has values like: | ||
* IMAGE - access only for images | ||
* TEXT - access only for texts | ||
* MENU - access only for menu | ||
* LOOP - access only for loop | ||
* DOC_INFO - access only for doc_info | ||
* ALL - access only for all content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CategoryMapper | ||
============== | ||
|
||
|
||
CategoryMapper serves to maintain old code RB-4 in the project RB-6 with using new API. | ||
Therefore we can easy this somewhere. However, recommendation use only new API, because of all stuff | ||
covered tests and have better structure for productivity. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
CategoryService | ||
=============== | ||
|
||
In this article: | ||
- `Introduction`_ | ||
- `Use API`_ | ||
- `Description about Category`_ | ||
|
||
|
||
Introduction | ||
------------ | ||
|
||
Imcms has single interface support and different manipulation with categories for documents. | ||
We can easy, create/update/delete/get all categories over this bean CategoryService. | ||
Of course you can use old version category service with oldest API objects - you have to use CategoryMapper, | ||
more information about it :doc:`CategoryMapper</API-documentation/service-beans/categoryMapper>` | ||
That be init new bean CategoryService and work with methods need to look at the code below: | ||
|
||
Use API | ||
------- | ||
|
||
.. code-block:: jsp | ||
CategoryService categoryService = Imcms.getServices().getManagedBean(CategoryService.class); | ||
List<Category> getAll(); | ||
Optional<Category> getById(int id); | ||
Category save(Category saveMe); //create new Category | ||
Category update(Category updateMe); | ||
void delete(int id); | ||
List<CategoryJPA> getCategoriesByCategoryType(Integer id); | ||
Description about Category | ||
-------------------------- | ||
Category object has any fields: | ||
|
||
#. Integer ``id`` - identifier category object | ||
#. String ``name`` - name category object | ||
#. String ``description`` - something description about category | ||
#. CategoryTypeDTO ``type`` - type category which relation current the category |
28 changes: 28 additions & 0 deletions
28
docs/API-documentation/service-beans/categoryTypeService.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
CategoryTypeService | ||
=================== | ||
|
||
|
||
|
||
Use API | ||
------- | ||
|
||
.. code-block:: jsp | ||
CategoryTypeService categoryTypeService = Imcms.getServices().getManagedBean(CategoryTypeService.class); | ||
Optional<CategoryType> get(int id); | ||
List<CategoryType> getAll(); | ||
CategoryType create(CategoryType saveMe); | ||
CategoryType update(CategoryType updateMe); | ||
void delete(int id); | ||
.. note:: | ||
About type Optional<T> can read `here <https://docs.oracle.com/javase/8/docs/api/java/util/Optional.html>`_. | ||
|
||
|
||
|
||
|
92 changes: 92 additions & 0 deletions
92
docs/API-documentation/service-beans/commonContentService.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
CommonContentService | ||
==================== | ||
|
||
In this article: | ||
- `Introduction`_ | ||
- `Use API`_ | ||
|
||
.. warning:: This init instance over Imcms.getServices().getCommonContentService() working from 10 version | ||
|
||
Introduction | ||
------------ | ||
|
||
Each documents page have common content with enable/disable languages, which store itself data about document. | ||
We can easy get all info about it , just use ``CommonContentService``. | ||
Init CommonContentService bean service - Imcms.getServices().getCommonContentService(); | ||
Look at the code below how use API. | ||
|
||
Use API | ||
------- | ||
.. code-block:: jsp | ||
List<CommonContent> getOrCreateCommonContents(int docId, int versionNo); | ||
//Get document's common contents for all languages | ||
//If common content of non working version is null it creates new common content based on working. | ||
CommonContent getOrCreate(int docId, int versionNo, Language language); | ||
//Gets common content for working or published versions. | ||
//If common content of non working version is null it creates new common content based on working. | ||
<T extends CommonContent> void save(int docId, Collection<T> saveUs); | ||
Set<CommonContent> getByVersion(Version version); | ||
deleteByDocId(Integer docId); | ||
Block parameters: | ||
""""""""""""""""" | ||
+----------------------+--------------+--------------------------------------------------+ | ||
| Parameters | Type | Description | | ||
+======================+==============+==================================================+ | ||
| versionNo | Integer | number version document | | ||
+----------------------+--------------+--------------------------------------------------+ | ||
| docId | Integer | Identify the linked document | | ||
| | | | | ||
+----------------------+--------------+--------------------------------------------------+ | ||
| saveUs | Collection<T>| List common contents which need to save | | ||
+----------------------+--------------+--------------------------------------------------+ | ||
|
||
|
||
|
||
|
||
|
||
How to use ``getOrCreate`` method simple example: | ||
""""""""""""""""""""""""""""""""""""""""""""""""" | ||
How to init languageService see to languageService-documentation | ||
.. code-block:: jsp | ||
Language language = languageService.findByCode(String code); | ||
int versionNo = 0; //working version | ||
int docId = 1001; | ||
CommonContentService commonContentService = Imcms.getServices().getCommonContentService(); | ||
commonContentService.getOrCreate(int docId, int versionNo, Language language); | ||
Checking what languages the document is active in, example: | ||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | ||
Using lambda and stream API java8+ | ||
|
||
.. code-block:: jsp | ||
List<Language> listEnableLang = Imcms.getServices().getCommonContentService().getOrCreateCommonContents(int docId, int versionNo) | ||
.stream() | ||
.filter(CommonContent::isEnabled) | ||
.map(CommonContent::getLanguage) | ||
.collect(Collectors.toList()); | ||
Using simple code without stream API: | ||
|
||
.. code-block:: jsp | ||
List<CommonContent> contents = Imcms.getServices().getCommonContentService().getOrCreateCommonContents(int docId, int versionNo); | ||
List<Language> languages = new ArrayList<>(); | ||
for (CommonContent commonContent: contents) { | ||
if (commonContent.isEnabled()) { | ||
languages.add(commonContent.getLanguage()); | ||
} | ||
} | ||
Oops, something went wrong.