Pesquisar

Article
· Dec 14, 2024 4m read

第五十章 File 输入 输出

第五十章 File 输入 输出

本页介绍在 IRIS 数据平台中使用顺序文件。

重要:在大多数情况下,可以使用 %Library.File 类提供的 API,而不需要此页面上的详细信息。请参阅使用 %Library.File

介绍

所有操作系统都将磁盘 I/O 文件视为顺序文件。 Windows 系统将打印机视为顺序文件 I/O 设备(除非打印机通过串行通信端口连接)。 UNIX® 系统将打印机视为终端 I/O` 设备。有关打印机的更多详细信息,请参阅打印机。

本节讨论 IRIS 如何处理顺序文件。它提供了顺序文件 I/O 的介绍以及相关命令的说明。

Discussion (0)1
Log in or sign up to continue
Article
· Dec 13, 2024 3m read

第四十九章 终端输入 输出 - 转义序列编程

第四十九章 终端输入 输出 - 转义序列编程

转义序列编程

转义序列的 ANSI 标准使智能终端的编程变得实用。字符串中转义字符及其后面的所有字符不会显示在屏幕上,但会更新$X$Y 。使用WRITE *语句将转义序列发送到终端,并通过直接设置$X和$Y来保持它们最新。

ANSI 标准建立了转义序列的标准语法。特定转义序列的效果取决于使用的终端类型。

每次READ之后在$ZB中查找传入的转义序列。 IRISANSI 标准转义序列和任何其他使用 ANSI 形式的转义序列放入$ZB中。 IRIS 可识别两种形式的转义序列:

Discussion (0)1
Log in or sign up to continue
Job
· Dec 13, 2024

Remote: Strong InterSystems HL7, ADT, CCDA to FHIR + IRIS + GCP

Urgently Looking for the following InterSystems Technology Skills:
(Must have Strong InterSystems (ISC) technology background and some Google cloud skills experience along with InterSystems IRIS).

1. Has 5+ years using InterSystems Object oriented scripting skills with FHIR experience on IRIS. HL7 and/or ADT and/or CCDA to FHIR.
2. 5+ years working experience on InterSystems IRIS
3. 5+ years having an Understanding on different Data standards including FHIR, HL7.
4. Different healthcare Data formats to be converted to FHIR using IRIS-InterSystems Platform.
5. 5+ years To Build ADT, custom Object script, etc...
6. Experience with Google Cloud technologies.

Fully Remote Position for 2 positions.
Job Rate: $45-55/hour DOE

Direct US Citizens only and can be employed as an W2 employee.

Willing to work any US timezone from West Coast to East Coast.

If interested email to Preston Brown with your best contact phone number and your updated resume:       pbrown@cybercodemasters.com

1 Comment
Discussion (1)2
Log in or sign up to continue
Announcement
· Dec 13, 2024

[Video] Security In the Cloud - Assuring a Secure InterSystems IRIS Cloud Overlay

Hi Community,

Enjoy the new video on InterSystems Developers YouTube:

⏯ Security In the Cloud - Assuring a Secure InterSystems IRIS Cloud Overlay @ Global Summit 2024

Much of what makes the cloud unparalleled as a business enabler gives rise to unique security challenges. While embracing self-managed resource stewardship at a mass scale and global reach with looser allowances and greater freedoms, the cloud can quickly become the Wild West. In this session, we’ll review the challenges and provide guidance on taming that landscape. We’ll consider aspects such as governances, guardrails, defenses in depth, cloud well-architected principles, identity and privilege management, observability, and data protection.

🗣 Presenter: Scott Abrutyn, Cloud Security Architect, InterSystems

Enjoy watching, and look out for more videos! 👍

Discussion (0)1
Log in or sign up to continue
Article
· Dec 13, 2024 5m read

SharePoint/ SPO API with intersystems

As part of the Open Exchange competition Salford Royal (Dean White and Mark O'Reilly) developed a REST API for sharepoint as a template that works but can also be a starting point to your own Rest Applications 

Prerequisites

This is using the v1 REST sharepoint API you need a tennant id, client id, client secret and tennant name 

Setup 

Configure an OAuth server

 

The code in the middle is the tennant ID 

Create a client config name as whatever you want 

Set up the oauth client replacing your server ip with the ip of the server you are on (not the VIP address- if not part of a VIP localhost may work) 

Add in client credentials 

 

change over the settings on SharepointRESTConnector like HTTPSERVER,SHAREPOINT-SITENAME- SHAREPOINT FILEPATH- SSL (blank up to 1.3) params replace the tennant name and tennant id. 

Code 

SharePointOnlineRESTOperation

OAuth Scope isn't user in this example  but left here as a template if you need it for other rest implementation 

It uses and builds on default rest   Set tSC=..AddAccessToken(.tHttpRequest) which manages the token and will pass through any additional properties required for the API. For sharepoint API it requires a resource and this gets added in the settings in the comment notes 

/// For SPO the Params should be {"resource":"00000003-0000-0ff1-ce00-000000000000/{TennantName}.sharepoint.com@{TennantID}"} <p>
/// 00000003-0000-0ff1-ce00-000000000000 is the ResourceID asigned to SPO by Microsoft, and should not change <p>
/// {TennantName} should be changed to the same as the HTTP server e.g.intersystems.sharepoint.com <p>
/// {TennantID} is the ID for your server name tennancy 

Get File list 

Will call list of files in the folder you have. It can run the time since you last downloaded or all files It queries ens header.

It calls the GetFolderByServerRealativeURL

 Set ..Adapter.URL="/sites/"_$$$URLENCODE(..SharepointSitename)_"/_api/web/GetFolderByServerRelativeUrl('"_$$$URLENCODE(..SharepointFilePath)_"')/Files"_filter Set ..Adapter.URL="/sites/"_$$$URLENCODE(..SharepointSitename)_"/_api/web/GetFolderByServerRelativeUrl('"_$$$URLENCODE(..SharepointFilePath)_"')/Files"_filter

 The response gets read by the processer. 

It all sends http messages like POSTMAN would 

A Constuct response method was taken from the generic operation intersystems had written to return http responses 

DeleteFile

Calls a delete send request to getfolderbyserverrelativeurl/files 

key lines below 

 Set ..Adapter.URL="/sites/"_$$$URLENCODE(..SharepointSitename)_"/_api/web/GetFolderByServerRelativeUrl('"_$$$URLENCODE(..SharepointFilePath)_"')/Files('"_$$$URLENCODE(pRequest.FileName)_"')"
  Set tSC=..AddAccessToken(.tHttpRequest)
  	s tSC = ..SendRequest(.tHttpResponse,send,tHttpRequest, .pResponse)
    Quit ..constructResponse(.tHttpResponse,.pResponse)

DownloadFile

if it is a Ens.StringContainer (you could make this a bespoke message extending this of like Messages.DownloadSharpointFile) it reads the name and then sends the name in the api url. it reads the response pack and will add to a steamcontainer the binary stream. As always we create the stream and then package it up into the streamcontainer. 

Key code below (changed some s to set for display here) 

  set binaryStream =##Class(%Stream.FileBinary).%New()
  Set tSC=..AddAccessToken(.tHttpRequest)
  Set ..Adapter.URL="/sites/"_$$$URLENCODE(..SharepointSitename)_"/_api/web/GetFolderByServerRelativeUrl('"_$$$URLENCODE(..SharepointFilePath)_"')/Files('"_$$$URLENCODE(pRequest.StringValue)_"')/OpenBinaryStream()"
  Set tHttpResponse = ##class(%Net.HttpResponse).%New()
  set send="GET"
  set tSC = ..SendRequest(.tHttpResponse,send,tHttpRequest, .pResponse)
  set pDownloadResponse =##Class(Ens.StreamContainer).%New(binaryStream)
  set pDownloadResponse.OriginalFilename=pRequest.StringValue
	

Add File

GetFolderByServerRelativeUrl/filepath/Files/add(url=filename,overwrite?)

Key lines 

Set ..Adapter.URL="/sites/"_$$$URLENCODE(..SharepointSitename)_"/_api/web/GetFolderByServerRelativeUrl('"_$$$URLENCODE(..SharepointFilePath)_"')/Files/add(url='"_fn_"',overwrite="_$$$URLENCODE(..OverwriteExistingFile)_")"
Set tSC=..AddAccessToken(.tHttpRequest)
  s tHttpRequest.EntityBody=##Class(%Stream.FileBinary).%New()
	s sc=tHttpRequest.EntityBody.CopyFromAndSave(pFileToUpload.Stream)
	Set tHttpResponse = ##class(%Net.HttpResponse).%New()
	S send="POST"
	s tSC = ..SendRequest(.tHttpResponse,send,tHttpRequest, .pResponse)

Send Request 

This does the sending of any request expecting a http response. 

Does the handing of responses and reuns a ENSLIB.HTTP.GenericMessage. A lot of headers come back and there is a check box to simplify the response back to just be error code and data. 

Construct Response

Used from elsewhere in TIE not original code in this method

AddAccessToken

This was the real learning. this is default type code to use the intersystems OAuth settings and not hardcode this each time we need to use it. 

It's all built around three calls 

is authorised and 

  Set isAuthorised = ##class(%SYS.OAuth2.AccessToken).IsAuthorized(..OAuthClientApplicationName,sessionId,..OAuthScope,.accessToken,,.responseProperties,.error)

 Get access token


Set tSC = ##class(%SYS.OAuth2.Authorization).GetAccessTokenClient(..OAuthClientApplicationName,..OAuthScope,.properties,.error,.sessionId)

and a Add token which adds it to the header - unfortunetly it doesn't look like it could add to the body if credential is required there by other apis


        ;The default for sslConfiguration comes from the OAuth2.Client instance.        
        Set tSC  = ##class(%SYS.OAuth2.AccessToken).AddAccessToken(pHttpRequest,sendType,,..OAuthClientApplicationName,sessionId)

The additional bit is the Sharepoint API requires a resource. Now we have generalised this to use JSON so if you need any other parameters we thought lets add it as JSON so we can reuse the template in the future.

it adds it to the string object that the properties used. its like an array serialised string or something 

  s paramsarr = [].%FromJSON(..Params)
            s iterator = paramsarr.%GetIterator()
            s properties=""
            While iterator.%GetNext(.key,.value)
            {
                s properties(key)=value
            }

Example traces

 

Getting file list

Downloading files

deleting files

is if you tick this box 

Adding files

Thanks to @Dean White 
 

https://youtu.be/485dTXYp2BU

Update - add YouTube link and fix open exchange link 

2 Comments
Discussion (2)1
Log in or sign up to continue