Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This server-side class allows collecting attachments from a remote instance when performing a migration from some third-party system to Этот серверный класс позволяет собирать вложения с удаленного экземпляра при выполнении миграции из какой-либо сторонней системы в SimpleOne.

SimpleAttachmentService()


Instantiates a new empty SimpleAttachmentService objectДанный метод предназначен для создания нового пустого объекта SimpleAttachmentService.


Code Block
languagejs
themeEclipse
titleSimpleAttachment
linenumberstrue
const attach = new SimpleAttachmentService();

createAttachmentByUrl(url, SimpleRecordId, fileName)

Use this method to get a file from a remote instance by a URL provided.

Parameter(s):


Используйте этот метод, чтобы получить файл из удаленного экземпляра по указанному URL-адресу.



Параметры:

Название

Тип

Обязательный

Значение по умолчанию

Name

Type

Mandatory

Default Value

urlStringYДаNНет
SimpleRecordIdStringYДаNНет
fileNameStringYДаNНет



ReturnВозвращаемое значение:

TypeТип

DescriptionОписание

String or или NULL
  • Success: returns the attachment ID in the cloud storage;
  • Failure:
    returns

    При успешном выполнении метод возвращает ID вложения в облачном хранилище; при ошибке метод возвращает NULL.



    ExampleПример:

    Code Block
    languagejs
    themeEclipse
    titlecreateAttachmentByUrl
    linenumberstrue
    const attach = new SimpleAttachmentService();
    attach.setUsername('john.doe'); // Put up a real username before using this method.
    attach.setPassword('123456'); // Put up a real password before using this method.
    const docID = ss.getDocIdByIds('155931135900000084', '155931135900000001');
    const attachId = attach.createAttachmentByUrl('http://simple.instance.com/v1/attachments/download/159229954513242397', docID, 'test.sop');

    setUrl(url)

    This method sets a URL of the remote instance to access when calling the getAttachmentSN method.

    Parameter(s):


    Используйте этот метод, чтобы указать URL-адрес удаленного экземпляра для доступа при вызове метода getAttachmentSN 


    Параметры:

    НазваниеТипОбязательныйЗначение по умолчаниюNameTypeMandatoryDefault Value
    urlStringYДаNНет



    ReturnВозвращаемое значение:

    TypeТипDescriptionОписание
    VoidThis method does not return a valueДанный метод не возвращает значение.



    ExampleПример:

    Code Block
    languagejs
    themeEclipse
    titlesetUrl
    linenumberstrue
    attach.setUrl('https://simple.instance.com:8443');

    setUsername(username)

    This method sets a user of a remote instance whose security context is used when establishing a connection.

    Info
    The user whose username is passed to the method must have sufficient access rights to the source file.

    Parameter(s):


    Этот метод предназначен для назначения пользователя удаленного экземпляра, контекст безопасности которого используется при установлении соединения.

    Info
    Пользователь, чье имя передается в метод, должен иметь необходимые правда для доступа в исходный файл. 



    Параметры:

    НазваниеТипОбязательныйЗначение по умолчаниюNameTypeMandatoryDefault Value
    usernameStringYДаNНет



    Return Возвращаемое значение:

    TypeТипDescriptionОписание
    VoidThis method does not return a valueДанный метод не возвращает значение.



    ExampleПример:

    Code Block
    languagejs
    themeEclipse
    titlesetUsername
    linenumberstrue
    attach.setUsername('john.doe');

    setPassword(password)

    This method allows setting a password for a user whose security context is used when establishing a connection to a remote instance.

    Parameter(s):


    Этот метод позволяет установить пароль для пользователя, чей контекст безопасности используется при установлении соединения с удаленным экземпляром.



    Параметры:

    НазваниеТипОбязательныйЗначение по умолчаниюNameTypeMandatoryDefault Value
    passwordStringYДаNНет



    ReturnВозвращаемое значение:

    TypeТипDescriptionОписание
    VoidThis method does not return a valueДанный метод не возвращает значение.



    ExampleПример:

    Code Block
    languagejs
    themeEclipse
    titlesetPassword
    linenumberstrue
    attach.setPassword('123456');

    getAttachmentSN(SourceSysId, SimpleRecordId)


    This method allows getting a file from a remote instance by the ID of the record on that instance.



    Parameter(s)Параметры:

    NameНазваниеTypeТипMandatoryОбязательныйЗначение по умолчаниюDefault value
    SourceSysIdStringYДаNНет

    SimpleRecordId

    StringYДаNНет



    ReturnВозвращаемое значение:

    TypeТип

    DescriptionОписание

    String or или NULL
  • Success: returns the attachment ID in the cloud storage;
  • Failure:
    returns

    При успешном выполнении метод возвращает ID вложения в облачном хранилище; при ошибке метод возвращает NULL.



    ExampleПример:

    Code Block
    languagejs
    themeEclipse
    titlegetAttachmentSN
    linenumberstrue
    const attach = new SimpleAttachmentService();
    attach.setUrl('https://source-now.instance.com:8443'); // A target instance. Place a real URL there before using this method.
    attach.setUsername('john.doe'); // Put up a real username before using this method.
    attach.setPassword('123456'); // Put up a real password before using this method.
    const docID = ss.getDocIdByIds('155931135900000084', '155931135900000001');
    const attachId = attach.getAttachmentSN('f91d84fe7cff58d4db91f2e9c2dc02fb', docID);


    Table of Contents
    absoluteUrltrue
    classfixedPosition