GW2GetIdInfo
Glasswall engine에서 식별되고 보고되는 모든 이슈에는 고유한 이슈 ID가 연결되어 있습니다. 이 API는 지정된 Issue ID 번호에 대한 설명을 제공합니다.
- C++
- C#
- Java
- Python
- JavaScript
개요
세션 session에 대해 GW2GetIdInfo는 outputBuffer가 가리키는 객체에 Glasswall Issue ID issueId에 대한 설명을 가리키는 포인터를 저장합니다. 설명의 길이(바이트 단위)는 bufferLength가 가리키는 size_t 객체에 저장됩니다.
#include "glasswall.core2.api.h"
int GW2GetIdInfo(
Session session,
size_t issueId,
size_t *bufferLength,
char **outputBuffer);
반환값
정수 GW2_RetStatus enum 값을 반환합니다. 음수는 실패를 나타냅니다. 성공하면 출력 버퍼가 Issue Description으로 채워집니다.
예제
#include "glasswall.core2.api.h"
char *outbuf = NULL;
size_t buflen = 0;
if (GW2OpenSession() < 0)
/* error opening session */
else
{
int status = GW2GetIdInfo(session, issueId, &buflen, &outbuf);
/* outbuf points to a buffer containing the XML file.
* Either process the data pointed to, or copy the data and process it
* after GW2CloseSession is called
*/
if (GW2CloseSession() < 0)
/* error closing session */
}
개요
public int GetIdInfo(
int session,
uint IssueID,
ref UIntPtr bufferLength,
out IntPtr outputBuffer)
반환값
정수 GW2_RetStatus enum 값을 반환합니다. 음수는 실패를 나타냅니다. 성공하면 출력 버퍼가 Issue Description으로 채워집니다.
예제
using glasswall_core2;
...
Glasswall glasswall = new Glasswall(); // Instance of the Glasswall wrapper
int session = glasswall.OpenSession();
int returnStatus = glasswall.GetIdInfo(session, 96, ref bufferLength, out buffer);
if (bufferLength >= 0)
{
byte[] msgArray = glasswall.CreateArrayFromBuffer(buffer, bufferLength);
// Error description for issue ID 96 now stored in a byte array
}
if (glasswall.CloseSession(session))
{
// Error Handling
}
개요
import com.glasswall.core2javabridge.*;
public String GW2GetIdInfoString(int session, int issueId) throws GlasswallException
설명
이 기능은 이전에는 ID 데이터를 가져오기 위해 두 번의 별도 함수 호출이 필요했습니다. 이제는 설정을 String으로 반환하도록 간소화되었습니다. 기존의 두 함수는 더 이상 사용되지 않습니다.
반환값
The GW2GetIdInfoString function returns a String containing a description of the given issueId
GlasswallException 예외는 session이 유효하지 않거나 issueId 설명을 가져올 수 없는 경우 발생합니다.
개요 - 지원 중단된 함수
import com.glasswall.core2javabridge.*;
(Deprecated)
public int GW2GetIdInfo(int session, int issueId) throws GlasswallException
public byte[] GetIDBuffer(int session) throws GlasswallException
설명 - 더 이상 사용되지 않는 함수
The GW2GetIdInfo function outputs the description of a given issueId for a given session to the internal ID Buffer. Retrieve this data through use of GetIDBuffer function.
반환값 - 지원 중단된 함수
GW2GetIdInfo 함수는 GW2_RetStatus 열거형을 int로 변환한 값을 반환합니다. 오류가 발생하면 값은 음수가 됩니다. 0은 성공을 나타냅니다. 자세한 내용은 API Overview/Return types를 참조하십시오.
GetIDBuffer는 ID 설명이 포함된 byte[]를 반환합니다. GetIDBuffer가 호출되지 않은 경우 이는 null입니다.
GlasswallException 예외는 session이 유효하지 않거나 문제 설명을 가져올 수 없는 경우 발생합니다.
개요
지정된 Issue ID에 대한 그룹 설명을 검색합니다.
def get_id_info(self, issue_id: int, raise_unsupported: bool = True):
""" Retrieves the group description for the given Issue ID. e.g. issue_id 96 returns "Document Processing Instances"
Args:
issue_id (int): The issue id.
raise_unsupported (bool, optional): Default True. Raise exceptions when Glasswall encounters an error. Fail silently if False.
Returns:
id_info (str): The group description for the given Issue ID.
"""
반환값
문자열로, 지정된 Issue ID에 대한 그룹 설명입니다.
개요
이 함수는 지정된 위치에 지정된 IssueID의 설명에 대한 포인터를 배치합니다.
/**
*
* @param {number} session The ID of the session.
* @param {number} issueId The ID of the issue.
* @param {number} bufferLength The length of the buffer.
* @param {string} outputBuffer The location of the output buffer.
*/
GW2GetIdInfo(
session,
issueId,
bufferLength,
outputBuffer)
반환값
정수 GW2_RetStatus enum 값을 반환합니다. 음수는 실패를 나타냅니다. 성공하면 출력 버퍼가 Issue Description으로 채워집니다.
예제
const ref = require('ref-napi');
...
function buffer_to_string(buffer, buffer_size) {
if (!buffer.isNull() && ref.deref(buffer_size) > 0) {
return Buffer.from(ref.reinterpret(ref.deref(buffer), ref.deref(buffer_size), 0)).toString();
}
else {
return "";
}
}
...
output_file_buffer = ref.alloc(ref.refType(ref.types.CString));
output_buffer_size = ref.alloc(ref.types.size_t, 0);
return_status = gw.GW2GetIdInfo(session_id, 96, output_buffer_size, output_file_buffer);
let error_description = buffer_to_string(output_file_buffer, output_buffer_size);
...