Creating a new plugin

23 views
Skip to first unread message

Tim Flinders

unread,
May 8, 2012, 5:56:50 AM5/8/12
to DevTargetProcess
I'm creating a new plugin to join Target Process to our CRM system, so
the functionality will be as a user story is updated or a comment is
added to a user story this will update our CRM system based on an ID
held in a custom field.

I have a basic prototype working which is good but I wanted some
advice on a slight difficultly I'm having getting User Story
information in the new comment handler. Looking through the
documentation and the API I can't see a way to obtain the user story
DTO from the classes directly only through the REST interface. The
documentation talks about the following config

<setting name="TargetProcessPath" serializeAs="String">
<value>http://localhost/TargetProcess</value>
</setting>
<setting name="AdminLogin" serializeAs="String">
<value>admin</value>
</setting>
<setting name="AdminPassword" serializeAs="String">
<value>admin</value>
</setting>

I can't see a way to access this configuration so it can be used in
the REST call.

Please advise whether I'm on the right lines or should I just create
custom settings for the REST call assuming I'm right you can't access
the data in any other way.

thanks
Tim

Alex Fomin

unread,
May 8, 2012, 6:29:56 AM5/8/12
to devtarge...@googlegroups.com
Hi Tim,

Unfortunately, at the moment these settings are used internally for configuring SOAP web services only. We will fix this in the nearest future.

The only way to get these settings at the moment is to use reflection:

  public RestServiceSettingsProvider()
  {
   var settingsType = typeof(Integration.Plugin.Common.AssemblyScanner).Assembly.GetType(
    "Tp.Integration.Plugin.Common.Properties.Settings");
   if (settingsType == null) return;

   var defaultInstance = settingsType.GetProperty("Default").GetValue(null, null);
   if (defaultInstance == null) return;
   
   var uri = settingsType.GetProperty("TargetProcessPath").GetValue(defaultInstance, null) as string;
   if (!string.IsNullOrEmpty(uri))
   {
    _uri = string.Format("{0}/", uri.TrimEnd(new[] { '/', '\\' }));
   }
   var login = settingsType.GetProperty("AdminLogin").GetValue(defaultInstance, null) as string;
   if (!string.IsNullOrEmpty(login))
   {
    _login = login;
   }
   var password = settingsType.GetProperty("AdminPassword").GetValue(defaultInstance, null) as string;
   if (!string.IsNullOrEmpty(password))
   {
    _password = password;
   }
  }

Another way is to duplicate login/password/path as appSettings.

Thanks,
Alex
Reply all
Reply to author
Forward
0 new messages