Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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
Indicates that project creation will result in export of a model in a support

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 creative review channel, the search and ranking of a certain type of project, as well as the development of facets. It does not, by default, trigger any of the following additional processing than a project without mediatype.
The result will be similar to inserting a project without type on the channel creative review.

From a file

type

value = 3.
This type is reserved for a later version of the Wedia application.
It is not used today and is deactivated.

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.
Indicates that creating a project will import all media and content from another project into it.

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 media property in the new project (content as media).

...

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 users fields when making changes.

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.