CEPM DotNet Developer Guide
Using New PAP APIs

Table Of Contents

Using New PAP APIs

Customizing the PAP Client

Implementing New APIs

Using the PAP Client

Creating Hierarchical Entities using New APIs

Method createRole

GetRole Method

UpdateRole Method

CreateGroup Method

GetGroup Method

UpdateGroup Method

CreateResource Method

GetResource Method

UpdateResource Method

mapUsersToRole Method

CreatePolicy Method

ImportData Method

ExportData Method


Using New PAP APIs


CEPM Version 3.3.0.0 includes a set of administrative APIs, which will enable enterprise and third-party developers to create entities and mappings based on their requirements. Several new APIs have been added to provide more efficient interaction between CEPM and client applications. These SOAP API are WS-I compliant implementations and are published via a WSDL that can be used by clients who have implemented in DotNet, C, Java, and so on. If you want to create a CEPM entity, you can call CEPM Services or PAP client.

Customizing the PAP Client

One method of creating the entities using the new APIs is by using the PAP client stubs (wrapper classes), which are available in the ServiceLocator. These wrapper classes facilitate the creation of the entities by calling CEPM's own services. Another method to write your own PAP client is by making use of these WSDLs based on your application requirement.

To access the WSDLs for the corresponding entities:


Step 1 Download the WSDLs for the corresponding entities from the following service URLs:

For Application Group services: 
http://<host>:<port>/CEPM/services/AdminApplicationGroupService?wsdl

For Application services: 
http://<host>:<port>/CEPM/services/AdminApplicationService?wsdl

For Resource services: 
http://<host>:<port>/CEPM/services/AdminResourceService?wsdl

For User services: 
http://<host>:<port>/CEPM/services/AdminUserService?wsdl

For Group services: 
http://<host>:<port>/CEPM/services/AdminGroupService?wsdl

For Role services: 
http://<host>:<port>/CEPM/services/AdminRoleService?wsdl

For Context services: 
http://<host>:<port>/CEPM/services/AdminContextService?wsdl

For RoleBundle services: 
http://<host>:<port>/CEPM/services/AdminRoleBundleService?wsdl

you need to replace the host name and port number arguments in the URL with the correct values corresponding to where you have deployed the administration console.

Step 2 Download the common XML Schema Definition (XSD) files from the following service URLs:

http://<host>:<port>/CEPM/services/vo.xsd
http://<host>:<port>/CEPM/services/exception.xsd

These files are common for all the previously mentioned WSDLs.

Step 3 To customize the WSDLs based on your application requirements, generate the required client stubs using the appropriate conversion tools. For example, to use these WSDLs in your Java application, use the Apache - WSDL2Java tool for building stubs, skeletons, and datatypes from WSDL documents. Similarly if your application is developed in DotNet framework, you can generate the required stubs by creating web references for every WSDL.


Implementing New APIs

Using the PAP Client

If you are using the PAP API client, you must invoke the service from the corresponding service locator. For example if you want to create a role, you must invoke the following service:

Com.Cisco.Epm.Pap.Api.Services.IRole RoleMgr= 
ServiceLocator.GetInstance().GetRoleManager(endPoint, userName, password, domainName, 
1000000);

where:

Endpoint refers to the URL of the server machine where the PAP is running.

Username and password refers to the PAP user credentials.

DomainName refers to the Cisco repository under which the objects will be created.

Session expired time must be specified in milliseconds.

For example:

Com.Cisco.Epm.Pap.Api.Services.IRole RoleMgr = 
ServiceLocator.GetInstance().GetRoleManager("http://localhost:9090/cepm", "superuser", 
"admin", "Default Domain", 1000000);

You can also invoke the ServiceLocator without giving the parameters.

For example:

Com.Cisco.Epm.Pap.Api.Services.IRole RoleMgr = 
ServiceLocator.GetInstance().GetRoleManager()

In this case, the required details are retrieved from the the <api> tag of the pep_config.xml file.

Creating Hierarchical Entities using New APIs

Creation of hierarchical entities is made easy through these APIs. You can create multiple entities for each object, that is hierarchical by nature such as, roles, groups, and resources. This is achieved by engaging various WSDLs that will perform a single call on any object and manage the results in creating multiple entities by the specified hierarchical structure.

Figure 4-1 Resource Hierarchy

If you are creating resources, you need to construct a resource graph that includes the parent resource and the child resources up to any level.

All the nodes (levels) and component objects (resources) must be identified and each of them should be linked in a tree structure. The object (Resource L1) must be referenced to the application group and application. (See the example for sample resource creation.)

When the API method createResource() is invoked, it sets the capabilities of the object and all the branches up to the leaf level to match their proposed attributes before compiling the complete hierarchy. The concurrency and serializability is controlled by setting the Transactional and Override parameters. There may be various reasons for failure, such as wrong FQN or entity unique IDs.

Transactional:

This is a Boolean expression. When it is set to False, if any of the objects fail to create due to any reason during compilation, it ignores the failure and completes the task by throwing the following exception:

Creation of following objects are failed and hence skipped at the end of process. 

If it is set to True, it throws an exception immediately after it finds any of the objects has failed to create and rollback the creation of object. By default, the value for this parameter is set to False.

Override:

This is a Boolean expression. When it is set to False, if it finds a duplicate role (containing the same fully qualified name) within the hierarchy during compilation, it throws a DuplicateRole exception and completes the task without updating the existing role. If it is set to True, it will update the existing role with the corresponding inputs of the new role. By default, the value for this parameter is set to False.

Before updating or deleting an object, you must call the GetObject method. This method returns the entire child objects up to the specified level along with a unique object ID (for every object) for updating or deletion of the same.

The following samples are implementation of a few important APIs (mainly for hierarchical objects) with sample codes. These examples describes the procedures to create an object (CreateObject), get the object for updating, and deleting the object (GetObject and UpdateObject).

Method createRole

This method is used to create a parent role and its child roles up to the nth level in a single API call. Consider the following role hierarchy. Using the new createRole API, you can construct the whole hierarchy in a single API call.

Figure 4-2 Role Hierarchy


Step 1 Intitialize the interface object.

Com.Cisco.Epm.Pap.Api.Services.IRole RoleMgr = 
ServiceLocator.GetInstance().GetRoleManager("http://localhost:9090/cepm", "superuser", 
"admin", "Default Domain", 1000000);

Step 2 Initialize the role object.

Role rl = new Role();

Step 3 Define the role type as Global:Default.

RoleType rlType = new RoleType();
rlType.Name="Default";
rlType.ApplicationName="Global";

Step 4 Specify the role name, application name, description, and status.

rl.RoleType=rlType;
rl.RoleName="TestRole";
rl.ParentFQN="Prime group:Prime portal";
rl.RoleDescription="This is a test";
rl.RoleStatus="STATIC";

Step 5 Initialize the object for the first level. Specify the level number (levelOne) and the number of role to be created. (In this example, two roles are created thus the array should be implemented as Role[2].)

Role[] levelOne = new Role[2];

Step 6 Configure the child roles for the first level by specifying the role name, its parent role name, description, role status, and owner as shown here.

levelOne[0] = new Role();
levelOne[0].RoleType=rlType;
levelOne[0].ParentFQN="Prime group:Prime portal:TestRole";
levelOne[0].RoleName="Role_1";
levelOne[0].RoleDescription="This is a test for level 1";
levelOne[0].RoleStatus="STATIC";
levelOne[0].Owner="superuser";

levelOne[1] = new Role();
levelOne[1].RoleType=rlType;
levelOne[1].ParentFQN="Prime group:Prime portal:TestRole";
levelOne[1].RoleName="Role_2";
levelOne[1].RoleDescription="This is a test for level 1";
levelOne[1].RoleStatus="STATIC";
levelOne[1].Owner="superuser";
// Set the child roles of parent role 
rl.Children=levelOne;

Step 7 Initialize the object for the second level role.

Role[] levelTwo = new Role[1];

levelTwo[0] = new Role();
levelTwo[0].RoleType=rlType;
//Parent role FQN for Role_3 will be Prime group:Prime portal:TestRole:Role_2
levelTwo[0].ParentFQN="Prime group:Prime portal:TestRole:Role_2";
levelTwo[0].RoleName="Role_3";
levelTwo[0].RoleDescription="This is a test for level 2";
levelTwo[0].RoleStatus="STATIC";
levelTwo[0].Owner="superuser";
// Set the child roles of Level 1 role i.e. Role_2
levelOne[0].Children=levelTwo;

Step 8 Initialize the object for third level role.

Role[] levelThree = new Role[1];

levelThree[0] = new Role();
levelThree[0].RoleType=rlType;
//Parent role FQN for Role_4 will be 
Prime group:Prime portal:TestRole:Role_2:Role_3
levelThree[0].ParentFQN="Prime group:Prime portal:TestRole:Role_2:Role_3";
levelThree[0].RoleName="Role_3";
levelThree[0].RoleDescription="This is a test for level 3";
levelThree[0].RoleStatus="STATIC";
levelThree[0].Owner="superuser";
// Set the child roles of Level 2 role i.e. Role_3
levelTwo[0].Children=levelThree;

Step 9 Create the role by setting the value for Transactional and Override.

RoleMgr.CreateRole(rl, false, false);

Step 10 Log in to the administration console and verify if the role is created.

Figure 4-3 Roles Page


GetRole Method

When this method is invoked, it displays all the roles present under the specified role up to the specified level. The level value can be 0, -1, or n.

0 refers to the same level of the specified role.

-1 refers up to the leaf level of the specified role in hierarchy.

n can be any number of levels. If you set 1 in the above hierarchy, this method will return all the roles present up to the first level, which is Role1 and Role2.

For example, to get all the roles present in this role hierarchy, you must set the role name and the level.

Role role = RoleMgr.GetRole("Prime group:Prime portal:TestRole",-1);

This method returns all the roles with their fully qualified names and a unique RoleID to be used for further operations (mainly update and delete).

UpdateRole Method

This method is used to update an existing role.

To update an existing role such as, Role3 in the sample hierarchy), you must:


Step 1 Intitialize the interface object.

Com.Cisco.Epm.Pap.Api.Services.IRole RoleMgr = 
ServiceLocator.GetInstance().GetRoleManager("http://localhost:9090/cepm", "superuser", 
"admin", "Default Domain", 1000000);

Step 2 Invoke the GetRole method for Role_3 which will return a RoleId for Role_3. RoleID is 15 in the example.

Step 3 Initialize the Role object:

Role role = new Role();

Step 4 Modify Role3 parameters by adding a new RoleType. In the following sample code, the old RoleType is commented (in green text) which is replaced with `TestRoleType'. You must ensure that the RoleID is not changed.

role.RoleName="Role3";
role.RoleId="15";
role.ParentFQN="Prime group:Prime portal:TestRole:Role2";
role.RoleStatus="STATIC";
role.RoleDescription="This is the updated Role3";
//RoleType rt = iRole.GetRoleType="Prime Group:Prime Portal:Default";
RoleType rt = iRole.GetRoleType="Prime Group:Prime Portal:TestRoleType";
Attribute att1 = new Attribute();
att1.AttributeName="RoleAtt";
att1.AttributeType="String";
Attribute att2 = new Attribute();
att2.AttributeName="MultiAtt";
att2.AttributeType="Enum";
att2.EnumerationValue="r11,r22,r33";
Attribute[] atts = new Attribute[2];
atts[0] = att1;
atts[1] = att2;
restype.Attributes=atts;
role.RoleType=rt;

Step 5 Update the role after evaluating the Transactional and Override parameters.

RoleMgr.UpdateRole(role, false, false);


CreateGroup Method

This method is used to create a user group along with its child group up to nth level. The procedure to create a group hierarchy is similar to the process of creating roles.

To create a group object, you must:


Step 1 Initialize the interface object.

Com.Cisco.Epm.Pap.Api.Services.IGroup GpMgr  = 
ServiceLocator.GetInstance().GetGroupManager("http://localhost:9090/cepm", "superuser", 
"admin", "Default Domain", 1000000);

Step 2 Initialize the group object.

Group gp = new Group();

Step 3 Define the group type as Global:Default.

GroupType gpType = new GroupType();
gpType.Name="Default";
gpType.ApplicationName="Global";

Step 4 Specify the group name, application name, description, and status.

gp.GroupType=gpType;
gp.GroupName="TestGroup";
gp.ParentFQN="Prime group:Prime portal";
gp.GroupDescription="This is a test";
gp.GroupStoreDetails="Local Database";
gp.GroupStatus="STATIC";

Step 5 Initialize the object for the first level. Specify the level number (levelOne) and the number of groups to be created in an array (for example, Group[1]).

Group[] childGp = new Group[1];

Step 6 Configure the child roles for the first level by specifying the role name, its parent role name, description, role status, and owner.

levelOne[0] = new Group();
levelOne[0].GroupType=gpType;
levelOne[0].ParentFQN="Prime group:Prime portal:TestGroup";
levelOne[0].GroupName="Group_1";
levelOne[0].GroupDescription="This is a test for level 1";
childGp[0].GroupStoreDetails="Local Database";
levelOne[0].GroupStatus="STATIC";
levelOne[0].Owner="superuser";

rl.Children=levelOne;

Step 7 Initialize the object for the second level role.

Group[] levelTwo = new Group[1];

levelTwo[0] = new Group();
levelTwo[0].GroupType=rlType;
//Parent role FQN for Group_2 will be Prime group:Prime portal:TestGroup:Group_1
levelTwo[0].ParentFQN="Prime group:Prime portal:TestGroup:Group_1";
levelTwo[0].GroupName="Group_2";
levelTwo[0].GroupDescription="This is a test for level 2";
childGp[0].GroupStoreDetails="Local Database";
levelTwo[0].GroupStatus="STATIC";
levelTwo[0].Owner="superuser";

levelOne[0].Children=levelTwo;

Step 8 Initialize the object for the third level role.


Group[] levelThree = new Group[1];

levelThree[0] = new Group();
levelThree[0].GroupType=gpType;
//Parent group FQN for Group_3 will be 
Prime group:Prime portal:TestGroup:Group_1:Group_2
levelThree[0].ParentFQN="Prime group:Prime portal:TestGroup:Group_1:Group_2";
levelThree[0].GroupName="Group_3";
levelThree[0].GroupDescription="This is a test for level 3";
childGp[0].GroupStoreDetails="Local Database";
levelThree[0].GroupStatus="STATIC";
levelThree[0].Owner="superuser";

levelTwo[0].Children=levelThree;

Step 9 Create the group by setting the value for Transactional and Override.

GpMgr.CreateGroup(rl, false, false);

Step 10 Log in to the administration console and verify if the group is created.

Figure 4-4 Groups Page


GetGroup Method

When this method is invoked, it displays all the groups present under the specified group up to the specified level. The level value can be 0, -1, or n.

0 refers to the same level of the specified group.

-1 refers up to the leaf level of the specified group in the hierarchy.

n can be any number of levels. If you set 1 in the above hierarchy, this method returns all the groups present up to the first level, which is Group_1 and Group_2.

For example, to get all the groups present in this group hierarchy, you must set the group name and the level.

Group grp = GpMgr.GetGroup("Prime group:Prime portal:Group_1",-1);

This method will return all the groups with their fully qualified names and a unique GroupID to be used for further functions, such as update group.

UpdateGroup Method

This method is used to update a group in the hierarchy. All the mandatory parameters such as group name and parent group name must be given correctly.

To modify the group type attributes of a group, you must:


Step 1 Initialize the interface object.

Com.Cisco.Epm.Pap.Api.Services.IGroup GpMgr  = 
ServiceLocator.GetInstance().GetGroupManager("http://localhost:9090/cepm", "superuser", 
"admin", "Default Domain", 1000000);

Step 2 Initialize the group object.

Group group = new Group();

Step 3 Invoke the GetGroup method for Group_2 as mentioned above, which will return a GroupId for Group_2 (GroupID is 2 in the following example).

Step 4 If you have created the group hierarchy, update the Group_2 parameters.

group.GroupName="Group_2";
group.GroupId="2";
group.ParentFQN="Prime group:Prime portal";
GroupType restype = new GroupType();
restype.Name="test group type";
restype.ApplicationName="Prime group:Prime portal";
Attribute att1 = new Attribute();
att1.AttributeName="GroupAtt";
att1.AttributeType="String";
Attribute att2 = new Attribute();
att2.AttributeName="MultiAtt";
att2.AttributeType="Enum";
att2.EnumerationValue="g11,g22,g33";
Attribute[] atts = new Attribute[2];
atts[0] = att1;
atts[1] = att2;
restype.Attributes=atts;
group.GroupType=restype;
GpMgr.UpdateGroup(group, false, false);


CreateResource Method

This method is used to create a resource along with its child resource up to nth level. The procedure to create a resource hierarchy is similar to creating roles.

To create a resource object, you must:


Step 1 Initialize the interface object.

Com.Cisco.Epm.Pap.Api.Services.IResource ResMgr  = 
ServiceLocator.GetInstance().GetResourceManager("http://localhost:9090/cepm", "superuser", 
"admin", "Default Domain", 1000000);

Step 2 Initialize the resource object.

Resource resource = new Resource();

Step 3 Set the parent resource TestRes.

resource.Parent=parentResource;
resource.ResourceType=resourceType;
resource.ResourceName="TestRes";
resource.ResourceDescription="This is a test";
resource.ParentFQN="Prime group:Prime portal";
resource.Owner="superuser";
resource.Status="Active";
resource.Parent=parentResource;

Step 4 Set the first level resources Res1 and Res2.

Resource[] levelOne = new Resource[2];
levelOne[0] = new Resource();
levelOne[0].ResourceName="Res1";
levelOne[0].ResourceDescription="This is a test for level1";
levelOne[0].ParentFQN="Prime group:Prime portal:TestRes";
levelOne[0].Owner="superuser";
levelOne[0].Status="Active";
levelOne[0].ResourceType=resourceType;

levelOne[1] = new Resource();
levelOne[1].ResourceName="Res2";
levelOne[1].ResourceDescription="This is a test for level1";
levelOne[1].ParentFQN="Prime group:Prime portal:TestRes";
levelOne[1].Owner="superuser";
levelOne[1].Status="Active";
levelOne[1].ResourceType=resourceType;

resource.Children=levelOne;

Step 5 Set the second level resources Res3 and Res4 under Res1.

Resource[] levelTwo = new Resource[2];
levelTwo[0] = new Resource();
levelTwo[0].ResourceName="Res3";
levelTwo[0].ResourceDescription="This is a test for level2";
levelTwo[0].ParentFQN="Prime group:Prime portal:TestRes:Res1";
levelTwo[0].Owner="superuser";
levelTwo[0].Status="Active";
levelTwo[0].ResourceType=resourceType;

levelTwo[1] = new Resource();
levelTwo[1].ResourceName="Res4";
levelTwo[1].ResourceDescription="This is a test for level2";
levelTwo[1].ParentFQN="Prime group:Prime portal:TestRes:Res1";
levelTwo[1].Owner="superuser";
levelTwo[1].Status="Active";
levelTwo[1].ResourceType=resourceType;

levelOne[0].Children=levelTwo;

Step 6 Create the resource by setting the value for Transactional and Override.

ResMgr.CreateResource(resource, false, false);

Step 7 Log in to the administration console and verify if the resource is created.

Figure 4-5 Resources Page


GetResource Method

This method is used to get all the child resources of the specified resource up to the specified level. The level of the resources can be 0 for same level, -1 up to leaf level under the specified resource, or n any level, for example, 1, 2, 3 and so on. When this method is invoked, it returns the resources with a unique resource ID to be used while updating the resource. This ID must not be changed in any scenario.

For example, to get all resources present under TestRes, you must pass the resource name and the level.

Resource res = ResMgr.GetResource("Prime group:Prime portal:TestRes", -1);

This method will return all the resources with their fully qualified names and a unique resourceId to be used for further functions, such as update resource.

UpdateResource Method

This method is used to update a resource. Before invoking this method you must invoke the GetResource method, which will return a unique Resource ID to be used for updating the same.

To update a resource:


Step 1 Initialize the interface object.

Com.Cisco.Epm.Pap.Api.Services.IResource ResMgr  = 
ServiceLocator.GetInstance().GetResourceManager("http://localhost:9090/cepm", "superuser", 
"admin", "Default Domain", 1000000);

Step 2 Invoke the GetResource method for Res_1, which returns a ResId for Res_1. (ResId is 5 in the following example.)

Step 3 Initialize the resource object.

resource1.ParentFQN="Prime group:Prime portal:TestRes:Res_1";
//Modifying the Resource Type from `Default' to `ResType'
ResourceType resourceType = ResMgr.GetResourceType("Prime group:ResType";
resourceType.Owner="superuser";

Resource parentResource = new Resource();
parentResource.ResourceName="Prime group:Prime portal:TestRes:Res_1";
parentResource.ResourceDescription="This is a test";
parentResource.ParentFQN="Prime group:Prime portal:TestRes:Res_1";
parentResource.ResourceId="5";
parentResource.ResourceType=resourceType;

Resource resource1 = new Resource();
resource1.Parent=parentResource;
resource1.ResourceType=resourceType;
resource1.ResourceName="Res1";
resource1.ResourceDescription="This is modified Res_1";
resource1.ParentFQN="Prime group:Prime portal:TestRes:Res_1";
resource1.Owner="superuser";
resource1.Status="Active";

Step 4 Upate the group by setting the value for Transactional and Override.

ResMgr.updateResource(resource, false, false);

Step 5 Log in to the administration console and verify if the resource is updated.

mapUsersToRole Method

This method is used to map one or more users to a role. To map users with a role, follow these steps:


Step 1 Initialize the interface object.

Com.Cisco.Epm.Pap.Api.Services.IEntityMapping MapMgr  = 
ServiceLocator.GetInstance().GetEntityMappingManager("http://localhost:7070/CEPM", 
"superuser", "h1BYu+lcwcM=", "Default Domain", 10000);

Step 2 Create the user array object and set the required user properties such as user types.

User[] users = new User[1];
User user = new User();
users[0] = user;
user.userName = "User10122";
user.parentFQN = "Prime group:Prime portal";
UserType userType = new UserType();
userType.name = "UserType3012";
userType.applicationName = "Prime group:Prime portal";
user.userType = userType;
users[0] = user;

Step 3 Create the role object and set the required role properties such as role types

Role role = new Role();
role.roleName = "Internal Dev";
role.parentFQN = "Prime group:Prime portal";
RoleType roleType = new RoleType();
roleType.name ="Default";
roleType.applicationName = "Global";
role.roleType = roleType;

Step 4 Set the rolebundle and context.

string contextFQN = "Global Context:Global Context";
string roleBundleFQN = "Global:Default";

Step 5 Set the values for transaction and override parameters.

boolean transaction=false;
boolean @override=false;

Step 6 Map the users to role by setting the values for Transactional and Override.

MapMgr.MapUsersToRole(users, role, contextFQN, roleBundleFQN, transaction, @override);

Step 7 Log in to the administration console and verify the user role mapping.

CreatePolicy Method

This method is used to create policy on a resource. You can create user or group or role based policies on a specified resource by using this method. In the following example will create an Allow policy for the role Internal Dev on the resource called Send Trades. To create this policy:


Step 1 Initialize the interface object.

Com.Cisco.Epm.Pap.Api.Services.IPolicy PMgr  = 
ServiceLocator.GetInstance().GetPolicyManager("http://localhost:9090/cepm", "superuser", 
"admin", "Default Domain", 1000000);

Step 2 Set the targeted resource for which you want to create a policy.

string targetFQN = "Prime group:Prime portal:Send Trades";

Step 3 Set the targeted entity for which you want to create a policy for the resource given. As the Role based policy is considered in this example, the role FQN is used. For userbased policy, the entityFQN should be the User FQN and for groupbased policy, it should be group FQN. For example, to create a policy for a role, set the role FQN.

string entityFQN = "Prime group:Prime portal:Internal Dev";

Step 4 Define the value object constant for the entity.

string entity = Com.Cisco.Epm.Pap.Api.Vo.Constants.ResourceConstants.ENTITY_TYPE_ROLE;

For userbased policy, the constant should be ENTITY_TYPE_USER and for groupbased policy, it should be ENTITY_TYPE_GROUP.

Step 5 Set the value of rhw permission. For `Allow' policy, set the permission to True and for deny policy set the permission to False.

bool permission = "true";

Step 6 Set the context.

string contextFQN = "Global Context:Global Context";

Step 7 Set the policy status. The status can be either active or inactive. If you set it to inactive, the PDP will not evaluate the policy even though it is configured for the specified resource.

string activeStatus = "Active";

Step 8 Create the policy.

pMgr.CreatePolicy(targetFQN, entityFQN, entity, permission, contextFQN, activeStatus);

Step 9 Log in to the administration console and verify the policy creation.


ImportData Method

This method is used to import data into CEPM. The data may include user, role, resource, and other attributes. To import data:


Step 1 Intitialize the interface object.

Com.Cisco.Epm.Pap.Api.Services.IImport ImpMgr = 
ServiceLocator.GetInstance().GetImportManager("http://localhost:9090/cepm", "superuser", 
"admin", "Default Domain", 1000000);

Step 2 Set the location of the directory from where the data has to be imported.

Com.Cisco.Epm.Pap.Api.Vo.EntityXmlVo dataOb = 
Com.Cisco.Epm.Util.DataConverter.prepareObjectFromFilePath="C:\\temp");

Step 3 Intitialize the Import Object by giving CEPM application details such as Endpoint URL, user ID, password, domain name and timeout (in milliseconds):

Com.Cisco.Epm.Pap.Api.Services.IImport importMgr = 
ServiceLocator.GetInstance().GetImportManager("http://localhost:9090/cepm", "superuser", 
"admin", "Default Domain", 1000000);

Step 4 Invoke the IImportManager.

importMgr.ImportData("Prime group:Prime portal", 
Com.Cisco.Epm.Pap.Api.Vo.Constants.ImportExportConstants.USER,dataOb);

where:

Prime group:Prime portal is the application FQN in which the data is imported.

ImportExportConstants.USER refers to the Users.xml to be imported into the specified application. If you want to import the roles, specify ImportExportConstants.ROLE. For resources, mention ImportExportConstants.RESOURCE. If you want to import the entire entities, mention ImportExportConstants.TOTAL_DATA.

Step 5 Log in to the administration console and verify the imported data.

ExportData Method

This method is used to export data into CEPM. The data may include user, role, resource and other attributes. To export data:


Step 1 Intitalize the Interface object.

Com.Cisco.Epm.Pap.Api.Services.IExport ExpMgr = 
ServiceLocator.GetInstance().GetExportManager("http://localhost:9090/cepm", "superuser", 
"admin", "Default Domain", 1000000);

Step 2 Invoke the IExportManager.

ExpMgr.ExportData("Prime group:Prime portal", 
Com.Cisco.Epm.Pap.Api.Vo.Constants.ImportExportConstants.USER,dataOb);

where:

Prime group:Prime portal is the application FQN from which the data is exported.

ImportExportConstants.USER refers to the Users.xml to be exported from the specified application. If you want to export the roles, mention ImportExportConstants.ROLE. For resources, mention ImportExportConstants.RESOURCE. If you want to export the entire entities, mention ImportExportConstants.TOTAL_DATA

Step 3 Set the directory path to which the data has to be exported:

Com.Cisco.Epm.Pap.Api.Vo.EntityXmlVo dataOb = 
Com.Cisco.Epm.Util.DataConverter.prepareObjectFromFilePath="C:\\temp";

Step 4 Navigate to the specified location and verify the exported data.