# Modules - Business cards [bsc]

This module will give you the possibility to create business cards for users in IdM. Business card is some pdf document. Data for this document must be saved in IdM. It doesn't matter where the data are saved. You have the option to create business card from basic identity attribute, EAV, contract attribute, etc.

In default implementation which you get out of box when you enable this module you will be able to generate business card in following design:

## Admin guide

### Configuration Before you start using this module you need to configure some properties which is necessary:

Folder where is stored background for card - file named "defaulBck.png"
If path is on Linux you need to use two forward slashes at the beginning e.g //opt/somepath
idm.sec.bsc.configuration.bck.path
C:\somepath\background\

Path to Apache FOP config file
idm.sec.bsc.configuration.fop.config.path
C:\somepath\config\fop.conf

Optional - Folder with user images which are used on business cards. File names inside this folder must be as PERSONALNUMBER.png
Dont use this property if you want to use profile photos from identities.
idm.sec.bsc.configuration.image.path
C:\somepath\images\

File type extension of images which are used
idm.sec.bsc.configuration.image.file.extension
png

Folder where the generated business cards will be saved automatically if you check the options to auto save
idm.sec.bsc.configuration.save.path
C:\somepath\business-cards\

Path to Apache FOP template
idm.sec.bsc.configuration.template.path
C:\somepath\config\fop-businessCard.xml

Folder where IdM will save tmp files for generating
If path is on Linux you need to use two forward slashes at the beginning e.g //opt/somepath
idm.sec.bsc.configuration.tmp.path
C:\somepath\tmp\

Optional - Additional text for business card
idm.sec.bsc.configuration.additional.text
This card is created by Idstory

After that EAV attribute must be created. Go into Settings → Form definitions → IdmTreeNode (default) → Form Attributes → Create new one: Code: businessCardName Name: It can be whatever. E.g. Name of organisation on business card Attribute Type: Text Face Type: TextArea Regular Expression: (?>[^\r\n]*(?>\r\n?|\n)){0,3}[^\r\n]*\z Validation message: Text can have maximum of 4 rows.

### Generate card from user detail If you want to generate business card for one specific user you can just go to the user detail and there you will find tab "Business card" When you click on this tab you will see form as you can see on the picture below.

You can change the information as you want before you generate business card, but if you want to generate business card again you will need to make these changes again. For this reason, we recommend to change the source from the information are pre filled. Business cards using these attributes:

  • Full name - Joined from first name and last name
  • Titles before name - Titles before
  • Titles after name - Titles after
  • Department - EAV attribute businessCardName on tree node where the user has contract - if you want to edit this you can use button "Edit department for all" which forward you to EAV attributes of this specific tree node you can make the change there save it and then go back and the new value will be available
  • Position - Name of contract
  • Personal number - Personal number

### Bulk action If you want to create business card for more then one user, you can use standard bulk action which is available in users agenda. After that you will see modal window where you can select if you want to save business cards automatically to drive. Data which will be used for each user are calculated automatically based on primary contract.

## Developers guide This module is using Apache FOP library for generating pdf files. This module needs some files to be able to generate pdf correctly:

  • fop.conf - configuration file for Apache FOP. As far as you just want different template you probably can use the one which is part of this module. For more info about config follow official documentation
  • fop-businessCard.xml - This is the template which is used for generating the final pdf. By this template you can define how the pdf will look. You can use FO Designer for create or edit template
Path to font files (*.ttf) is set in font-base tag in fop.conf

Whole project can be found on our github page. If you need other attributes then the default ones you can fork this repo or just override DefaultBscBusinessCardService and use annotation @Priority(-10) you can use different number just be sure that the priority is higher then the default one (0).

All methods has javadoc so you should be able the get the idea of the purpose of each method. If you want some different attributes you definitely need to override getFormInstance method where you can define which attributes will shown and which values will be pre filled into it.

For rendering attributes we are using EAV. That means that we will render attributes according to FormInstance which is returned by the above mentioned method getFormInstance Only difference between for example identity EAV is that the EAV are not persisted as the FormInstance is build on runtime. The reason for this is, that we don't persist Business card object to database so we can't use the "Form definitions" tabs in IdM setting to specify these attributes. We have only DTO which is used for data transfer between BE and FE.

All required libraries are stored in libraries.tar for easy use in appliance.
  • by cabelkal