Introduction
Wedia is distributed with a set of APIs that allow you to create and handle projects directly.
...
In this section we will describe the different processes called by the class and the triggers. For more information, please refer to the javadoc documentation of these classes.
Project management
Creating a project consists in inserting an object of the media
type in the application. When this is saved with the method IObjectWritable#JSPSave(CTSurfer)
triggers are executed by the class com.wedia.wxm.database.trigger.ProjectManager
.
...
project assignment management
specific actions will be carried out
Triggering specific actions
When creating a project object instance (media), you can define a project type in the mediatype
property. This type is used to inform the API that actions must be taken based on information also positioned on the media
object.
If you do not specify any type, no support will be created and only generic actions will be executed.
From a template
The definition of support creation from a model requires to specify the following information:
...
Any specific behaviour in the case of creation at the same time that a project from a template
will have to be implemented in an TriggerBusinessService
of the media object.
From a brief
type | value = 2 |
channel | (not obligatory) the application will assign by default the channel of this type if you don’t mention it. This type is present to simplify the use of the |
From a file
type | value = 3. |
Note |
---|
It is therefore strongly recommended that you do not exploit it or make any kind of developments with this type. |
From a project
type | value = 4. |
channel | Must match the source project channel. |
project | Identifying the source project. After the insertion of the project, the system will decline all the objects with the |
...
Code Block |
---|
final CTSurfer surfer = ... ; .... final IObjectReadOnly sourceProject = .... ; ... final CTObjects factory = new CTObjects(); factory.JSPLoad("media", true); final IObjectWritable newProject = factory.create(); newProject.setProperty("name", "test"); newProject.setProperty("type", "4"); // from model; newProject.setProperty("channel", "8"); // print / brochure; newProject.setProperty("project", sourceProject.getIdentifiant().toString()); newProject.setProperty("mediagroup", "1"); .... final String newProjectId = newProject.JSPSave(surfer); |
Info |
The duplicate
button in the back-office and JSP clone.jsp
have been customized for the media
object in order to redirect to a project creation form of this type.
IWxmFactory and IWxmProjectManager
The IWxmFactory
interface allows to get rid of the CTObject
API for creating projects.
...
Code Block |
---|
final CTSurfer surfer = ... ; final IWxmFactory wxmFactory = new WxmFactory(surfer); .... final IObjectReadOnly modelObject = .... ; ... final IWxmProjectManager newProject = wxmFactory.createNewProjectFromModel("test", "2,1", // langs "1", // default lang modelObject.getObjectType().toString(), // type de modèle modelObject.getIdentifiant().toString(), // id du modèle "1", // groupe Collections.emptyMap(), // pas de valeurs forcées sur le projet null, // pas d'assignations spécifiques Collections.emptyMap()); // pas de valeurs forcées sur le support |
Assignments
When creating a project, by default, the user who creates the project sees itself as the only user assigned to its project. In concrete terms, a summons is expressed by the insertion of an object usermedia
in the database.
...
Users 3 and 54 will be assigned to the project with their default roles.
user 5 will have role 10 on this project (regardless of its default role)
User 10 will have role 4 on this project (regardless of its default role)
previously assigned users will have their rights revoked
Tipinfo |
---|
If you don’t want to touch the subpoenas, you can leave the empty |
Manage rights finely
The standard API distributed in the IWxmProjectManager
interface allows you to manipulate assignments more finely. You can add, modify or delete the right of a single user in the following ways or manipulate assignments in mass:
Code Block |
---|
IWxmFactory wxmFactory = new WxmFactory(surfer); IWxmProjectManager projectManager = wxmFactory.getProjectManager("42"); // project id 42 // Add the user 3 to the project projectManager.registerUser("3"); // revoke user 10; projectManager.unregisterUser("10"); Map<String, String> users = new HashMap<String, String>(); users.put("4", null); // add user 4 with its default role users.put("56", "2"); // add user 56 with role 2 projectManager.registerUsers(users); |
Cleaning assignments
When deleting a project, the API will delete automatically the referenced rights for each user.
Project Role Management
For each project, a user can be assigned a specific role.
...
The WXM_MediaCore
plugin compiles, on the other hand, all user rights in a surfer property named wxm_roleByMedia
in the following form: <id_role>_<id_media>
separated by commas.
You will be able to use this information in security rules.
...
, for instance :
Code Block |
---|
NBCOMMONELEMENTS(surfer.wxm_roleByMedia, CONCAT(',31_',object.media,',')) > 0 |
For performance reasons this denormalization is not automatic and must be activated by the securityDenormalizeUserRightsInSurfer
property in the configuration of the WXM_MediaCore
plugin.