User bio
404 bio not found
Member since Aug 16, 2016
Replies:

Unfortunately, you're probably going to have to convert the patterns by hand, and the regex syntax is slightly different from the traditional pattern match syntax, starting with the fact that repetition count comes after the item being matched. For example the pattern 1.6N becomes the regex \d{1,6}.

Fortunately, once you've got your patterns converted to regexes, you can use the regexes from Caché code thanks to the $Locate and $Match functions, as well as the %Regex.Matcher class which provides a richer interface to regex functionality.

The other answers point to some good resources that you should definitely look at. That said, the answer to your question is to build a REST API. You will need to create a new class that is a subclass of the %CSP.REST class. You can then add a UrlMap block that maps URLs to ClassMethods. Here's a simple example of such a dispatch class: 

Class REST.Handler Extends %CSP.REST
{

Parameter UseSession As Integer = 1;

/// The UrlMap determines how a Url should map to a HTTP Method and a Target ClassMethod
/// indicated by the 'call' attribute. The call attribute is either the name of a method
/// or the name of a class and method seperated by a ':'.
/// parameters within the URL preceeded by a ':' will be extracted from the supplied URL
/// and passed as arguments to the named method.
XData UrlMap
{
<Routes>
<Route Url="/HelloWorld" Method="GET" Call="HelloWorld" />
</Routes>
}


/// A simple test method to ensure that the REST infrastructure is working
ClassMethod HelloWorld()
{
Set obj = "message""Hello from REST" }
Write obj.%ToJSON()
Quit $$$OK
}

}

Finally, you need to create a new web application in the System Management portal and set your class as the Dispatch Class.  Once you have the dispatch class and web application set up, you can point your Angular app to the corresponding URL and use it like you would any other REST API.

This is exactly what we do. We have an APP-CODE database, and the CI build process is basically:

  • pull the latest source from source control.
  • load the build script (which is an ObjectScript class that does the rest of the steps).
  • the build script then deletes the APP-CODE database and creates a fresh one.
  • populate the fresh APP-CODE database the source code checkout from the first step.
  • Run tests, collect results, etc
This way we can be sure that what is being tested in CI always matches what is in source control.
Certifications & Credly badges:
Arcady has no Certifications & Credly badges yet.
Global Masters badges:
Arcady has no Global Masters badges yet.
Followers:
Arcady has no followers yet.
Following:
Arcady has not followed anybody yet.