Skip to content

Commit

Permalink
[guihttp] add service to access guihttp endpoints from workflow 957 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasFey-GIP authored Oct 29, 2024
1 parent 8ae41dc commit d1f9e52
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 9 deletions.
2 changes: 1 addition & 1 deletion blackedition/blackedition_lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ ALL_DATAMODELTYPES=("mib","tr069","xsd");
#ACHTUNG: Version auch bei addRequirement zu default workspace berücksichtigen
ALL_APPLICATIONS="Base Processing"; #Default-Applications, die immer installiert sein sollten
APPMGMTVERSION=1.0.10
GUIHTTPVERSION=1.3.0
GUIHTTPVERSION=1.3.1
SNMPSTATVERSION=1.0.3
PROCESSINGVERSION=1.0.22
ALL_REPOSITORYACCESSES=("svn");
Expand Down
2 changes: 1 addition & 1 deletion modules/xdev/yang/application.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</RuntimeContextRequirement>
<RuntimeContextRequirement>
<ApplicationName>GuiHttp</ApplicationName>
<VersionName>1.3.0</VersionName>
<VersionName>1.3.1</VersionName>
</RuntimeContextRequirement>
</RuntimeContextRequirements>
</ApplicationInfo>
Expand Down
2 changes: 1 addition & 1 deletion modules/xmcp/gitIntegration/application.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<RuntimeContextRequirements>
<RuntimeContextRequirement>
<ApplicationName>GuiHttp</ApplicationName>
<VersionName>1.3.0</VersionName>
<VersionName>1.3.1</VersionName>
</RuntimeContextRequirement>
</RuntimeContextRequirements>
</ApplicationInfo>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* Copyright 2022 Xyna GmbH, Germany
* Copyright 2024 Xyna GmbH, Germany
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,8 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-->
<DataType xmlns="http://www.gip.com/xyna/xdev/xfractmod" IsAbstract="false" Label="Filter and Trigger Manager Services" TypeName="FilterAndTriggerManagerServices" TypePath="xmcp.factorymanager" Version="1.8">
--><DataType xmlns="http://www.gip.com/xyna/xdev/xfractmod" IsAbstract="false" Label="Filter and Trigger Manager Services" TypeName="FilterAndTriggerManagerServices" TypePath="xmcp.factorymanager" Version="1.8">
<Meta>
<IsServiceGroupOnly>true</IsServiceGroupOnly>
</Meta>
Expand Down Expand Up @@ -190,5 +189,25 @@
<CodeSnippet Type="Java">return xmcp.factorymanager.FilterAndTriggerManagerServicesImpl.getPossibleTriggerInstanceForFilterDeployment(filter37, runtimeContext36);</CodeSnippet>
</SourceCode>
</Operation>
<Operation IsStatic="true" Label="Invoke GuiHttp Endpoint" Name="invokeGuiHttpEndpoint" RequiresXynaOrder="true">
<Input>
<Data ID="38" Label="URL-path" ReferenceName="URLPath" ReferencePath="xact.http" VariableName="uRLPath38"/>
<Data ID="39" Label="HTTP Method" ReferenceName="HTTPMethod" ReferencePath="xact.http.enums.httpmethods" VariableName="hTTPMethod39"/>
<Data ID="40" Label="Payload - Document" ReferenceName="Document" ReferencePath="xact.templates" VariableName="document40"/>
</Input>
<Output>
<Data ID="41" Label="AnyType" ReferenceName="AnyType" ReferencePath="base" VariableName="anyType41">
<Meta>
<Type>GeneralXynaObject</Type>
</Meta>
</Data>
</Output>
<Meta>
<Documentation>Requires the calling workflow to be started using the startorder endpoint of GuiHttp. Invokes an endpoint of GuiHttp in the version responsible for starting the workflow.</Documentation>
</Meta>
<SourceCode>
<CodeSnippet Type="Java">return xmcp.factorymanager.FilterAndTriggerManagerServicesImpl.invokeGuiHttpEndpoint(correlatedXynaOrder, uRLPath38, hTTPMethod39, document40);</CodeSnippet>
</SourceCode>
</Operation>
</Service>
</DataType>
2 changes: 1 addition & 1 deletion modules/xmcp/guihttp/application.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-->
<!-- ################# Version auch in blackedition_lib.sh updaten ########### -->
<Application applicationName="GuiHttp" comment="" factoryVersion="" versionName="1.3.0" xmlVersion="1.1">
<Application applicationName="GuiHttp" comment="" factoryVersion="" versionName="1.3.1" xmlVersion="1.1">
<ApplicationInfo>
<Description Lang="DE">GuiHTTPFilter</Description>
<Description Lang="EN">GuiHTTPFilter</Description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@



import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -53,7 +54,10 @@ public Object execute(Object... parameters) throws XynaException {
HTTPMethod tmpMethod = (xact.http.enums.httpmethods.HTTPMethod) parameters[1];
String payload = parameters.length > 2 ? (String)parameters[2] : null;
Method method = Method.valueOf(tmpMethod.getClass().getSimpleName());
List<URLPathQuery> query = tmpUrl.getQuery().stream().map(x -> new URLPathQuery(x.getAttribute(), x.getValue())).collect(Collectors.toList());
List<URLPathQuery> query = new ArrayList<>();
if (tmpUrl.getQuery() != null) {
query = tmpUrl.getQuery().stream().map(x -> new URLPathQuery(x.getAttribute(), x.getValue())).collect(Collectors.toList());
}
URLPath url = new URLPath(tmpUrl.getPath(), query, null);
for(Endpoint endpoint : endpoints) {
if(endpoint.match(url, method)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,22 @@
import com.gip.xyna.xact.trigger.DeployFilterParameter;
import com.gip.xyna.xact.trigger.FilterInformation;
import com.gip.xyna.xact.trigger.FilterInformation.FilterInstanceInformation;
import com.gip.xyna.xact.trigger.RunnableForFilterAccess;
import com.gip.xyna.xact.trigger.TriggerInformation;
import com.gip.xyna.xact.trigger.TriggerInformation.TriggerInstanceInformation;
import com.gip.xyna.xact.trigger.XynaActivationTrigger;
import com.gip.xyna.xdev.xfractmod.xmdm.GeneralXynaObject;
import com.gip.xyna.xdev.xfractmod.xmdm.XynaObject.BehaviorAfterOnUnDeploymentTimeout;
import com.gip.xyna.xdev.xfractmod.xmdm.XynaObject.ExtendedDeploymentTask;
import com.gip.xyna.xfmg.xfctrl.revisionmgmt.Application;
import com.gip.xyna.xfmg.xfctrl.revisionmgmt.RuntimeDependencyContext.RuntimeDependencyContextType;
import com.gip.xyna.xnwh.exceptions.XNWH_OBJECT_NOT_FOUND_FOR_PRIMARY_KEY;
import com.gip.xyna.xnwh.persistence.PersistenceLayerException;
import com.gip.xyna.xprc.XynaOrderServerExtension;

import xact.http.URLPath;
import xact.http.enums.httpmethods.HTTPMethod;
import xact.templates.Document;

import java.util.HashSet;
import java.util.List;
Expand Down Expand Up @@ -329,6 +336,24 @@ public List<? extends TriggerInstance> getPossibleTriggerInstanceForFilterDeploy
collect(Collectors.toList());
}

@Override
public GeneralXynaObject invokeGuiHttpEndpoint(XynaOrderServerExtension order, URLPath url, HTTPMethod method, Document payload) {
try {
RunnableForFilterAccess runnable = order.getRunnableForFilterAccess("H5XdevFilter");
Object result = runnable.execute(url, method, payload.getText());
if(result != null) {
if(result instanceof GeneralXynaObject) {
return (GeneralXynaObject) result;
} else {
return new Document.Builder().text(result.toString()).instance();
}
}
} catch (Exception e) {
return null;
}
return null;
}

private Trigger convertToXMOM(TriggerInformation info) {
return new Trigger.Builder().
name(info.getTriggerName()).
Expand Down
2 changes: 1 addition & 1 deletion modules/xmcp/xypilot/application.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<RuntimeContextRequirements>
<RuntimeContextRequirement>
<ApplicationName>GuiHttp</ApplicationName>
<VersionName>1.3.0</VersionName>
<VersionName>1.3.1</VersionName>
</RuntimeContextRequirement>
<RuntimeContextRequirement>
<ApplicationName>XyPilotMetricsDefaults</ApplicationName>
Expand Down

0 comments on commit d1f9e52

Please sign in to comment.