Versions Compared

Key

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

...

Update your atlassian-plugin.xml

to To import the services provided by our API as components, using Atlassian Spring Scanner as an example:

Code Block
languagejava
<component-import key="uppProfileElementManager" interface="import com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport;
import de.communardo.atlassian.plugins.userprofile.external.api.service.UppProfileElementManager" />
<component-import key="uppProfileElementDataManager" interface="UppProfileElementDataManager;
import de.communardo.atlassian.plugins.userprofile.external.api.service.UppProfileElementDataManager" />UppProfileElementManager;
import org.springframework.stereotype.Component;

@Component
public class MyComponent {
    public MyComponent(@ComponentImport UppProfileElementManager uppProfileElementManager,
                       @ComponentImport UppProfileElementDataManager uppProfileElementDataManager) {
        // do stuff with uppProfileElementManager and/or uppProfileElementDataManager
    }
}

Make sure the User Profiles for Confluence Add-on is already installed on your Confluence system.

Check Installation and Licensing (v 3.45) for further information.

...

The UPC Java API consists out of two basic elements: the profile element and the profile element data. Profile elements can be added and removed in the UPC administration (check Configure User Profile Elements (v 3.45) for further information). Values may afterwards be added for every user via an LDAP sync or by manually editing user profiles (in the administration or the user does it on his own) or even by using our new Java API.

To interact with profile elements, just inject and use the provided UppProfileElementManager. With this manager you will be able to load the available profile elements. Afterwards you may want to access some data which is related to a user. To achieve that, just inject and use the provided UppProfileElementDataManager.

Profile element and data types

There are several profile element and data types which are used to work with the API. To provide you a better start, we are going to list all currently available profile elements and their matching data models in the following table:

Profile Element Models
(package de.communardo.atlassian.plugins.userprofile.external.api.model.elements)

Profile Element Data Models
(package de.communardo.atlassian.plugins.userprofile.external.api.model.data)

AutocompleteProfileElement

AutocompleteProfileElementData

MultiSelectProfileElement

MultiSelectProfileElementData

SingleSelectProfileElement

SingleSelectProfileElementData

TextBasedProfileElement

TextBasedProfileElementData

UserProfileElement

UserProfileElementData

You have to use matching profile element and data types to be able to interact with the API. Furthermore, the specialized data objects make an interaction with a specific data type more easy.

...

ProfileElementDataChangedEvent

The User Profiles for Jira App Confluence publishes events every minute, which contain all changes that are taken happened since the last publication. One event contains a maximum of 1000 changes as a collection of updates. Each update contains a user key of an user, a profile element and the new data. The following table shows the models of the change sets:

Profile Element Change Set Models
(package de.communardo.atlassian.plugins.userprofile.external.api.events.changes)

Profile Element Models
(package de.communardo.atlassian.plugins.userprofile.external.api.model.elements)

Data Models

AutocompleteProfileElementDataUpdate

AutocompleteProfileElement

Set<String>

MultiSelectProfileElementDataUpdate

MultiSelectProfileElement

Set<OptionedProfileElement.Option>

SingleSelectProfileElementDataUpdate

SingleSelectProfileElement

OptionedProfileElement.Option

TextBasedProfileElementDataUpdate

TextBasedProfileElement

String

UserProfileElementDataUpdate

UserProfileElement

UserKey

...

Code Block
Collection<ProfileElement> profileElements =  uppProfileElementManager.getProfileElements();

...

UppProfileElementDataManager

Loading profile element data for a profile element and

...

a user

Code Block
languagejava
ProfileElementData data = uppProfileElementDataManager.getProfileElementData(userKey, profileElement);
//or if you know the type of the profileElement or the data (in this example it is a TextBasedProfileElementData)
TextBasedProfileElementData data = uppProfileElementDataManager.getProfileElementData(userKey, profileElement);

Loading all profile elements for

...

a user

Code Block
languagejava
Map<ProfileElement, ProfileElementData> data = uppProfileElementDataManager.getProfileElementData(userKey);

Storing profile element data for a profile element and

...

a user

Code Block
languagejava
uppProfileElementDataManager.storeProfileElementData(userKey, profileElement, data);

...