New post

查找

Article
· Dec 5, 2024 3m read

Gateway de Linguagem externa Java

Se vocês gostam de Java e têm um ecossistema Java ativo no trabalho e precisam incorporar IRIS, isso não é um problema. A Gateway de Linguagem Externa de Java fará isso sem complicações, ou quase. Essa gateway serve como ponte entre Java e ObjectScript no IRIS. Vocês podem criar objetos de classes Java no IRIS e chamar seus métodos. Só precisam de um arquivo JAR para fazer isso.

Connection diagram: proxy object <-> Gateway object <-> TCP/IP <-> External server <-> target object

A primeira coisa que vocês devem fazer é configurar o ambiente. Para começar a usar a Gateway de Java, certifiquem-se de ter o seguinte:

  1. InterSystems IRIS: Instalado e funcionando.  
  2. Java Development Kit (JDK): Instalado e configurado

O segundo requisito pode parecer simples, já que vocês já usam Java no trabalho, mas não é. Devido a essa questão, descobriu-se que vocês precisam usar a versão 11 do JDK no máximo. Isso significa que vocês devem mudar a versão no seu IDE, o que pode causar bastante complicações

O próximo passo é verificar se tudo está funcionando e tentar instanciar um objeto de uma classe do sistema Java. Para isso, é necessário iniciar uma conexão, criar um objeto proxy e chamar um método. Embora possa parecer que se requer uma grande quantidade de código, na realidade se resume a uma única linha:

write $system.external.getJavaGateway().new("java.util.Date").toString()

Isso imprimirá a data e hora atual na tela.

Para ir além, podemos criar nossa própria classe em Java:


public class Dish {
	private String name;
	private String description;
	private String category;
	private Float price;
	private String currency;
	private Integer calories;
	
	public void setName(String name) {
		this.name = name;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public void setCategory(String category) {
		this.category = category;
	}

	public void setPrice(Float price) {
		this.price = price;
	}

	public void setCurrency(String currency) {
		this.currency = currency;
	}

	public void setCalories(Integer calories) {
		this.calories = calories;
	}
	
	public String describe() {
		return "The dish "+this.name+" costs "+this.price.toString()+
				this.currency+" and contains "+this.calories+" calories!";
	}
}

e chamar seus métodos do ObjectScript:

 set javaGate = $SYSTEM.external.getJavaGateway()
 do javaGate.addToPath("D:\Temp\GatewayTest.jar")
 set dish = javaGate.new("Dish")
 do dish.setCalories(1000)
 do dish.setCategory("salad")
 do dish.setCurrency("GBP")
 do dish.setDescription("Very tasty greek salad")
 do dish.setName("Greek salad")
 do dish.setPrice(15.2)
 write dish.describe()

Como resultado, obteremos uma string com a descrição do prato criado:

The dish Greek salad costs 15.2GBP and contains 1000 calories!

Em Português: O prato Salada Grega custa 15,2 GBP e contém 1000 calorias!

De qualquer forma, aprendam mais sobre o uso das Gateways na Documentação e boa sorte implementando esse conhecimento em seus projetos!

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

Participate in the InterSystems "Bringing Ideas to Reality" Contest

Dear Community member,

We'd like to invite you to join our next contest dedicated to creating useful tools to make your fellow developers' lives easier: 

🏆 Bringing Ideas to Reality Contest 🏆

Submit an application that implements an idea from the InterSystems Ideas Portal that has statuses Community Opportunity or Future Consideration.

Duration: December 2 - 22, 2024

Prize pool: $14,000

Don't miss this amazing chance to challenge yourself, work alongside other developers, and earn fantastic prizes. Spread the word and invite your friends and colleagues to take part as well!

We’re excited to see your innovative solutions!

>> Full contest details here.

We're looking forward to your entries 😉

Question
· Dec 5, 2024

Creating an Operation to Connect to an OAuth 2.0 Server

I have created an OAuth Client and have created the credentials etc successfully.

I have tested using the curl command and have received the token back from the Server using the terminal.

I now need to create an Operation to use my client credentials to connect to the Server and receive the token back.

What adapter would I use as I am unable to link my client credentials and secret  - currently  I am using the EnsLib.HTTP.OutboundAdapter
 but I am not sure if this is the correct.

2 Comments
Discussion (2)2
Log in or sign up to continue
Question
· Dec 5, 2024

JSON Structure Parsing Issue

Hello All,

I am facing an issue where the vendor seems to be sending two structures of JSON messages, but only one of them seems to work in my code.
I need help in allowing both the JSON structures to parse into the engine.

Working Example:

{
    "data":
        {
            "idNumbers":
            [
                {
                    "type":"322","number":"123456"
                }
            ]
            ,"0":
            {
                "con_type":"210"
            }
        }
    ,"meta":
    {
        "secret_key":"","origin_url":"url.co.uk"
    }
}

Not Working:

Context: Extra Square Brackets causing extra arrays and con type sent inside the same array.
Error: Error in the Json/HL7 conversion/transformation block, Origin URL not authorized!
{
    "data":
    [
        {
            "idNumbers":
                [
                    {
                        "type":"322","number":"123456","id":"4155"
                    }
                ]
        },
        {
            "con_type":"210"
        }
    ],
    "meta":
    {
        "secret_key":"","origin_url":"url.co.uk"
    }
}

 

My current code:

<assign name="Valid URL" property="context.ValidOriginUrl" value="##class(Ens.Util.FunctionSet).Lookup(&quot;CUH.DCIQToEpic.OriginUrl&quot;,$NAMESPACE,&quot;&quot;,3)" action="set" xpos='200' ypos='450' >
</assign>
<assign name="Valid ContactType" property="context.ValidContactType" value="##class(Ens.Util.FunctionSet).Lookup(&quot;CUH.DCIQToEpic.ContactType&quot;,$NAMESPACE,&quot;&quot;,3)" action="set" xpos='200' ypos='550' >
</assign>
<assign name="Valid IDNumberType" property="context.ValidIDNumberType" value="##class(Ens.Util.FunctionSet).Lookup(&quot;CUH.DCIQToEpic.IDNumberType&quot;,$NAMESPACE,&quot;&quot;,3)" action="set" xpos='200' ypos='650' >
</assign>
<if name='Check OriginUrl' condition='context.JsonObjectIn.meta."origin_url"=context.ValidOriginUrl' xpos='200' ypos='850' xend='200' yend='2250' >
<true>
<if name='Check Contact Type' condition='(context.JsonObjectIn.data."0"."con_type"=context.ValidContactType)||(context.JsonObjectIn.data."con_type"=context.ValidContactType)' xpos='470' ypos='1000' xend='470' yend='2150' >
<true>
<if name='Check idNumber Type' condition='(context.JsonObjectIn.data.idNumbers.GetAt(1).type)=context.ValidIDNumberType' xpos='740' ypos='1150' xend='740' yend='2050' >
<true>

I need help/suggestions in getting the code modified to accept both the JSON structures.

6 Comments
Discussion (6)1
Log in or sign up to continue
Article
· Dec 5, 2024 3m read

Celebrating a Journey of Dedication

Today, we take a moment to shine the spotlight on one of the true pillars of the InterSystems Developer Community, @Alberto Fuentes. His commitment, expertise, and enthusiasm have left an indelible mark on the Developer Community, and we couldn’t be more grateful. Alberto has been a part of the InterSystems ecosystem for over 15 years, starting his journey with InterSystems technology back in 2008. Since then, he has worn many hats, from integrating Ensemble at his previous job to officially joining InterSystems in 2011 and now holding the position of Sales Engineer. Over the years, he’s witnessed—and contributed to—some of the most significant milestones in the company’s history.

🤩  Let’s dive into his remarkable journey!

From the birth of InterSystems IRIS to the adoption of FHIR, the expansion of the HealthShare family, and the rise of cloud and container technologies, Alberto has been at the forefront of these transformative changes. “It’s been a long and rewarding journey, filled with countless hours of projects, demos, and customer meetings,” he reflects. His professional growth has been shaped by a variety of memorable projects and challenges. Implementing Health Connect as a corporate integration engine across regions in Spain, aiding partners in optimizing performance for critical scenarios, and collaborating with startups in the Caelestinus program are just a few highlights.

Some of his most impactful contributions have even become invaluable resources for the Developer Community:

  • Healthcare HL7 XML Package: meeting interoperability requirements in Spanish regions by extending InterSystems’ interoperability features.
  • DataPipe Package + UI: enhancing IRIS’s data ingestion capabilities for Data Fabric projects, offering ready-to-use tools for partners.

From the very start, Alberto has been an active and enthusiastic member of the Developer Community, with a particular focus on the Spanish Developer Community. His contributions include publishing articles, developing Open Exchange projects, participating in contests, and hosting webinars—“the Spanish webinars are so much fun!” he exclaims.

He cherishes the connections he’s made within the DC. Meetups stand out as particularly inspiring moments for him—sharing ideas, pizzas, and laughs over a game of Kahoot. It’s these human connections that make the Developer Community feel like a family.

Excited about the future, Alberto is diving into cutting-edge topics like Vector Search and Retrieval Augmented Generation (RAG). Having recently hosted a successful Spanish webinar on the subject, he’s eager to continue learning and sharing his knowledge with the wider Community. To newcomers, he offers this advice: “Explore the incredible collection of articles, run examples, and always post your questions. The Community is filled with amazing people ready to help!”

Outside of work, Alberto has a vibrant array of passions. From cooking and traveling to building models, swimming, and watching sports (Formula 1 and NFL, anyone?), his interests are as diverse as they are inspiring. Recently, he’s taken on the challenge of learning French and improving his sailing skills—all while making time for family adventures.

We sincerely thank @Alberto Fuentes for his tireless dedication, creativity, and generosity. Your contributions have inspired countless developers and enriched the Developer Community beyond measure. Here’s to many more years of innovation and collaboration! 🥂

11 Comments
Discussion (11)3
Log in or sign up to continue