cancel
Showing results for 
Search instead for 
Did you mean: 

Namespace Alias to retrieve property name

Former Member
0 Kudos

Hi guys

I need to create an IPropertyName object, in order to do that i need the property ID and the Namespace url related to the property, the problem is that right now i have the Namespace alias but i can't find a way to retrieve the Namespace the Url.

Any suggestions?

thanks in advance!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Luis,

navigate to following path in KM config:

Content Management -> Global Services -> Property Metadata -> Properties

Now search your Property and open it for view.

Klick on the Namespace Alias and in this part you can get the "URL" for this Namespace.

Regards,

Gerhard

Former Member
0 Kudos

Hi Gerhard,

Thanks for your reply but i know how to get that info using the portal, my problem is that i have to do it using KM APIs to obtain that data dinamically.

Any ideas?

Former Member
0 Kudos

Hi,

I don't think you can do much with the alias, what else have you got? How did you obtain the alias?

Former Member
0 Kudos

Hi Rui

This is the complete method i'm using to retrieve some of the property data, i get the namespace alias, but i actually need is the URL.

This is part of a Webservices that allows a Webdynpro Iview to access the KM property list.


	public WSIMetaNameArray getFullPropertyList(String localeName) {
		String method = "getFullPropertyList(String localeName)";
		logger.entering(method);
		ArrayList propertyList = new ArrayList();
		String description = "";
		String id = "";
		String label = "";
		String name = "";
		String namespace = "";
		String arrayData = "";
		boolean docPatterns = false;
		WSIMetaNameArray metanameArray = new WSIMetaNameArray();
		try {
			Class locatorClass =
				Class.forName(
					"com.sapportals.config.fwk.data.ConfigurationLocator");
			IConfigurationLocator icl =
				(IConfigurationLocator) locatorClass.newInstance();
			locatorClass =
				Class.forName(
					"com.sapportals.portal.prt.service.config.PortalConfigurationLocator");
			icl = (IConfigurationLocator) locatorClass.newInstance();
			IConfigClientContext confContext =
				IConfigClientContext.createContext(
					ConfigCrutch.getConfigServiceUser());
			IConfigurationAccess icAccess = Configuration.getInstance();
			IConfigManager icManager = icAccess.getConfigManager(confContext);
			IConfigPlugin icPlugin =
				icManager.getConfigPlugin("/cm/services/properties_metadata");
			IMutableConfigurable[] imc = icPlugin.getConfigurables();
			for (int x = 0; x < imc.length; x++) {
				WSIMetaName propertyData = new WSIMetaName();
				IConfigProperty[] configProp = imc[x].getProperties();
				description = imc[x].getProperty("description").getValueAsString();
				if (description == null)
					description = "";
				id = imc[x].getIdValue();
				if (id == null)
					id = "";
				label = imc[x].getProperty("bundlekey").getValueAsString();
				if (label == null)
					label = "";
				name = imc[x].getProperty("property_id").getValueAsString();
				if (name == null)
					name = "";
				namespace =	imc[x].getProperty("namespace_alias").getUri().getPath();
				if (namespace == null)
					namespace = "";
				if (imc[x].getProperty("document_patterns").getValueAsString() != null)
					docPatterns = true;
				else
					docPatterns = false;
				propertyData.setDescription(description);
				propertyData.setId(id);
				propertyData.setLabel(label);
				propertyData.setName(name);
				propertyData.setNamespace(namespace);
				propertyData.setDocumentPatterns(docPatterns);
				propertyList.add(propertyData);
			}
		} catch (InitialConfigException e) {
			logger.fatalT("initialconfigexception");
			logger.fatalT(method, e.getMessage());
		} catch (CannotAccessConfigException e) {
			logger.fatalT("CannotAccessConfigException");
			logger.fatalT(method, e.getMessage());
		} catch (Throwable e) {
			logger.fatalT("Throwable");
			logger.fatalT(method, e.getMessage());
		}
		metanameArray.setPropertyList(propertyList);
		logger.exiting(method);
		return metanameArray;
	}

Any ideas of how can i get the namespace url?

Thanks in advance

Former Member
0 Kudos

Hi,

first of all, you do realize you're using non-public APIs that are not guaranteed to function in next releases, right?

If you do realize that, this is what you can try:


namespace = imc[x].getProperty("namespace_alias").getValueAsString();
if (namespace == null)
  namespace = "";
else {
  IConfigPlugin icPluginNamespaces = icManager.getConfigPlugin("/cm/services/properties_metadata/namespaces");
  IMutableConfigurable[] imcNamespaces = icPluginNamespaces.getConfigurables();
  for (int y = 0; y < imcNamespaces.length; y++) {
    IConfigProperty[] configProp = imcNamespaces[y].getProperties();
    String namespaceURI = imcNamespaces[y].getProperty("namespace").getValueAsString();
  }
}

Former Member
0 Kudos

Hi

Thanks for your quickly response, i haven't test but if it works you'll get the point!

I actually got this part of this code from another post, i didn't realize that this APIs are going to be out in next releases, this is the only option i got, so i never thought about changing it, do you have another suggestion?

Also could you please tell me which APIs are going to be out, in order to not to use them again.

Former Member
0 Kudos

Hi,

I think you misunderstood me. I don't know if they are going to be out in next releases, I really don't think that will happen at least for some time.

It was just to alert you that it <b>might</b> happen. Anyway, that is the only way I know of accessing the KM configuration, so just take notice in the next upgrade to test if everything works.

Answers (0)