cancel
Showing results for 
Search instead for 
Did you mean: 

Samplecode in Webdynpro to connect to MDM Repository

Former Member
0 Kudos

Hi

Can anybody please send the sample code on how to connect to MDM and retrieve the record from the repository?

Regards

Suresh babu

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Suresh

check the following sample code what ever u asked to connect to MDM system repository.

public String session;

public SimpleConnection connection = null;

private RepositoryIdentifier repId;

private Settings settings;

public void create()

throws ConnectionException, CommandException {

connection = SimpleConnectionFactory.getInstance(

settings.server,

settings.connectionSource);

repId = new RepositoryIdentifier(

settings.repository,

settings.dbServer,

settings.dbmsType);

RegionProperties dataRegion = getRegion();

CreateUserSessionCommand createUserSessionCommand =

new CreateUserSessionCommand(connection);

createUserSessionCommand.setRepositoryIdentifier(repId);

createUserSessionCommand.setDataRegion(dataRegion);

createUserSessionCommand.execute();

session = createUserSessionCommand.getUserSession();

AuthenticateUserSessionCommand authenticateUserSessionCommand =

new AuthenticateUserSessionCommand(connection);

authenticateUserSessionCommand.setSession(session);

authenticateUserSessionCommand.setUserName(settings.username);

authenticateUserSessionCommand.setUserPassword(settings.password);

authenticateUserSessionCommand.execute();

}

public void destroy() throws CommandException {

DestroySessionCommand destroySessionCommand =

new DestroySessionCommand(connection);

destroySessionCommand.setSession(session);

destroySessionCommand.execute();

session = null;

}

}

Regards

Sunil

Former Member
0 Kudos

Hello Suresh/Prasad,

I wanted to know, how to proceed for any work on EP MDM integration without using the MDM Business Package.

I understand that using the BP we can work on only standard components, if anything has to be customized how to go about it??What are the different ways in which we can proceed??

Also what are the steps that needs to be carried out before starting the work??

I know that it can be done using Java APIs, Webdynpro and Guided Procedures, but which will be better and more easy to work on??

Thanks in advance,

Becky.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Suresh,

Please find the below code to connect to MDM Respository.

public class ConnectionManager

{

private static ConnectionManager cm;

public CatalogData cd ;

public String error_message="";

public ConnectionPool connection;

public String sessionId;

public RepositoryIdentifier repID;

String error = "";

boolean is_connection = false;

private ConnectionManager() {

// TODO Auto-generated constructor stub

}

/**

  • Unique Instance Singleton Pattern

*/

public static ConnectionManager getInstance()

{

if (cm == null )

cm = new ConnectionManager();

return cm;

}

/**

  • To set the Session reqired paramters

  • @author namrat

*

  • To change the template for this generated type comment go to

  • Window>Preferences>Java>Code Generation>Code and Comments

*/

public static class SetConsoleParamters

{

public static String ServerIP = "IPAddress";

public static String RepositoryName = "Vendor";

public static String DBMSName =

"IP Address
SQLEXPRESS";

public static String UserName = "Admin";

public static String UserPassword = "password";

}

public void setConnection(ConnectionPool connectionpool)

{

connection = connectionpool;

}

public void setSessionID(String SessionID)

{

sessionId = SessionID;

}

public ConnectionPool getConnection()

{

return connection;

}

public String getSessionID()

{

return sessionId;

}

public RepositoryIdentifier getRepositoryIdentifier()

{

return repID;

}

public void setRepositoryIdentifier(RepositoryIdentifier repoID)

{

repID = repoID;

}

public void DestroySession(ConnectionPool connection,String sessionID)

{

// finally destroy the session

DestroySessionCommand destroySessionCommand = new DestroySessionCommand(connection);

destroySessionCommand.setSession(sessionID);

try {

destroySessionCommand.execute();

} catch (Exception e) {

error = ("Session not destroyed"e.toString());

return;

}

}

/**

  • To create user session with the repository

*

*/

public boolean CreateUserSession()

{

is_connection = false;

String serverName = SetConsoleParamters.ServerIP;

ConnectionPool connections = null;

try {

connections = ConnectionPoolFactory.getInstance(serverName);

setConnection(connections);

} catch (ConnectionException e) {

e.printStackTrace();

is_connection = true;

return true;

}

// specify the repository to use

// alternatively, a repository identifier can be obtain

//from the GetMountedRepositoryListCommand

String repositoryName = SetConsoleParamters.RepositoryName;

String dbmsName = SetConsoleParamters.DBMSName;

RepositoryIdentifier reposId = new RepositoryIdentifier(repositoryName, dbmsName, DBMSType.MS_SQL);

setRepositoryIdentifier(reposId);

// get list of available regions for the repository

GetRepositoryRegionListCommand regionListCommand = new GetRepositoryRegionListCommand(connections);

regionListCommand.setRepositoryIdentifier(reposId);

try {

regionListCommand.execute();

} catch (CommandException e) {

e.printStackTrace();

is_connection = true;

return true;

}

String region_selected = "";

RegionProperties[] regions = regionListCommand.getRegions();

// create a user session

CreateUserSessionCommand sessionCommand = new CreateUserSessionCommand(connections);

sessionCommand.setRepositoryIdentifier(reposId);

sessionCommand.setDataRegion(regions[0]); // use the first region

try {

sessionCommand.execute();

} catch (CommandException e) {

e.printStackTrace();

is_connection = true;

return true;

}

String sessionId = sessionCommand.getUserSession();

setSessionID(sessionId);

// authenticate the user session

String userName = SetConsoleParamters.UserName;//LDS_MAT

String userPassword = SetConsoleParamters.UserPassword;

AuthenticateUserSessionCommand authCommand = new AuthenticateUserSessionCommand(connections);

authCommand.setSession(sessionId);

authCommand.setUserName(userName);

authCommand.setUserPassword(userPassword);

try {

authCommand.execute();

} catch (CommandException e) {

e.printStackTrace();

is_connection = true;

return true;

}

return false;

}

Hope it will helps you.

Reagrds,

RDNPrasad.

Edited by: RDNPrasad on Mar 11, 2008 5:36 AM

Edited by: RDNPrasad on Mar 11, 2008 5:37 AM

Former Member
0 Kudos

Hi Prasad

I have the requirement as following.

There are already some Standard iviews which are build thru MDM Business Packages. client want to discard those standard iviews and want to implement those screens in the webdynpro thru MDM JAVA API.

can u explain what is the impact in the development in webdynpro for developing those screens?

Is this process easy or more development required in webdynpo? pls explain me in this way and let me know some sample code in this regard.

Regards

Suresh babu

Former Member
0 Kudos

Hi Suresh,

Standard Iviews of MDM business package will provide the following functionalities:

1. Picklist search - for selecting values from flat or hierarchical lookup tables

2.Hierarchy search - for selecting nodes in hierarchical or taxonomy lookup tables

3.Attribute search - for selecting attribute values connected taxonomy nodes

4.Text search - for performing a free-form keyword search

apart from this the following capabilities also possible:

1.Search state - show the content search state

2. Result set - show the current result list.

3. Item details - show record details based on a selected record in the result list.

The Iview library provides a set of Iviews to search an MDM Repository in multiple dimensions.

now coming to development of these screens in Webdynpro using MDM Java API will take much effort.

Because portal Iviews will provide more functionalities of extending existing Iview functionality like

1. Qualified field search

2. repository status display

3.Comparison view of records.

definitely it will take more effort to develop the above functionalities using MDM Java API's.

Hope it will helps you to understand.

Regards,

RDNPrasad.

Edited by: RDNPrasad on Mar 11, 2008 6:27 AM

Former Member
0 Kudos

Hi Prasad

what is the puporse and what is the meaning of lookup tables in MDM.

here in MDM i came to know abt hierarchial and taxnomy lookup tables.

what is the meaning of lookup tables?

Regards

Suresh

Former Member
0 Kudos

Hi Suresh,

A lookup table used to define the set of legal values to which a corresponding lookup field in the main table can be assigned.

lookup tables hold the lookup information.

for example, the main table(products) may include a field called Manufacturer,

The actual list of manufacturer names would be contained in a subtable(lookup table).Only values that exist in sub-table records can be assigned to the value of the corresponding lookup field in the main table(products).

Hope it helps you to understand.

Regards,

RDNPrasad.

Former Member
0 Kudos

Hi Suresh

check the following sample code what ever u asked to connect to MDM system repository.

public String session;

public SimpleConnection connection = null;

private RepositoryIdentifier repId;

private Settings settings;

public void create()

throws ConnectionException, CommandException {

connection = SimpleConnectionFactory.getInstance(

settings.server,

settings.connectionSource);

repId = new RepositoryIdentifier(

settings.repository,

settings.dbServer,

settings.dbmsType);

RegionProperties dataRegion = getRegion();

CreateUserSessionCommand createUserSessionCommand =

new CreateUserSessionCommand(connection);

createUserSessionCommand.setRepositoryIdentifier(repId);

createUserSessionCommand.setDataRegion(dataRegion);

createUserSessionCommand.execute();

session = createUserSessionCommand.getUserSession();

AuthenticateUserSessionCommand authenticateUserSessionCommand =

new AuthenticateUserSessionCommand(connection);

authenticateUserSessionCommand.setSession(session);

authenticateUserSessionCommand.setUserName(settings.username);

authenticateUserSessionCommand.setUserPassword(settings.password);

authenticateUserSessionCommand.execute();

}

public void destroy() throws CommandException {

DestroySessionCommand destroySessionCommand =

new DestroySessionCommand(connection);

destroySessionCommand.setSession(session);

destroySessionCommand.execute();

session = null;

}

}

Regards

Sunil