ENTAXY-634 release version 1.9.0
This commit is contained in:
@ -0,0 +1,78 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* plugin
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.ui.hawtio.communication.demo;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.ServletContextEvent;
|
||||
import javax.servlet.ServletContextListener;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import io.hawt.web.plugin.HawtioPlugin;
|
||||
|
||||
public class PluginContextListener implements ServletContextListener {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(PluginContextListener.class);
|
||||
|
||||
HawtioPlugin plugin = null;
|
||||
|
||||
|
||||
@Override
|
||||
public void contextInitialized(ServletContextEvent sce) {
|
||||
ServletContext context = sce.getServletContext();
|
||||
|
||||
plugin = new HawtioPlugin();
|
||||
plugin.setContext(context.getContextPath());
|
||||
plugin.setName(context.getInitParameter("plugin-name"));
|
||||
plugin.setScripts(context.getInitParameter("plugin-scripts"));
|
||||
plugin.setDomain(null);
|
||||
|
||||
try {
|
||||
plugin.init();
|
||||
} catch (Exception e) {
|
||||
throw createServletException(e);
|
||||
}
|
||||
|
||||
log.info("Initialized {} plugin", plugin.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void contextDestroyed(ServletContextEvent sce) {
|
||||
try {
|
||||
plugin.destroy();
|
||||
} catch (Exception e) {
|
||||
throw createServletException(e);
|
||||
}
|
||||
|
||||
log.info("Destroyed {} plugin", plugin.getName());
|
||||
}
|
||||
|
||||
protected RuntimeException createServletException(Exception e) {
|
||||
return new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~~~~~~licensing~~~~~~
|
||||
entaxy-management-plugin
|
||||
==========
|
||||
Copyright (C) 2020 - 2023 EmDev LLC
|
||||
==========
|
||||
You may not use this file except in accordance with the License Terms of the Copyright
|
||||
Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
Software for commercial purposes to provide services to third parties.
|
||||
|
||||
The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
Software provided by him will be suitable or not suitable for the specific purposes
|
||||
of the User, that the Software will meet all commercial and personal subjective
|
||||
expectations of the User, that the Software will work properly, without technical
|
||||
errors, quickly and uninterruptedly.
|
||||
|
||||
Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
or damage to data, property, etc.
|
||||
~~~~~~/licensing~~~~~~
|
||||
-->
|
||||
|
||||
|
||||
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
|
||||
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
|
||||
version="2.4">
|
||||
|
||||
<description>Entaxy HawtIO management plugin</description>
|
||||
<display-name>entaxy hawt.io management plugin</display-name>
|
||||
|
||||
<context-param>
|
||||
<description>Plugin's path on the server</description>
|
||||
<param-name>plugin-context</param-name>
|
||||
<param-value>${plugin-context}</param-value>
|
||||
</context-param>
|
||||
|
||||
<context-param>
|
||||
<description>Plugin's path on the server</description>
|
||||
<param-name>plugin-name</param-name>
|
||||
<param-value>${plugin-name}</param-value>
|
||||
</context-param>
|
||||
|
||||
<context-param>
|
||||
<description>Plugin's path on the server</description>
|
||||
<param-name>plugin-domain</param-name>
|
||||
<param-value>${plugin-domain}</param-value>
|
||||
</context-param>
|
||||
|
||||
<context-param>
|
||||
<description>Plugin's path on the server</description>
|
||||
<param-name>plugin-scripts</param-name>
|
||||
<param-value>${plugin-scripts}</param-value>
|
||||
</context-param>
|
||||
|
||||
<context-param>
|
||||
<description>Disable listing of directories and files</description>
|
||||
<param-name>org.eclipse.jetty.servlet.Default.dirAllowed</param-name>
|
||||
<param-value>false</param-value>
|
||||
</context-param>
|
||||
|
||||
<listener>
|
||||
<listener-class>ru.entaxy.ui.hawtio.communication.demo.PluginContextListener</listener-class>
|
||||
</listener>
|
||||
|
||||
|
||||
</web-app>
|
@ -0,0 +1,37 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
~~~~~~licensing~~~~~~
|
||||
entaxy-management-plugin
|
||||
==========
|
||||
Copyright (C) 2020 - 2023 EmDev LLC
|
||||
==========
|
||||
You may not use this file except in accordance with the License Terms of the Copyright
|
||||
Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
Software for commercial purposes to provide services to third parties.
|
||||
|
||||
The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
Software provided by him will be suitable or not suitable for the specific purposes
|
||||
of the User, that the Software will meet all commercial and personal subjective
|
||||
expectations of the User, that the Software will work properly, without technical
|
||||
errors, quickly and uninterruptedly.
|
||||
|
||||
Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
or damage to data, property, etc.
|
||||
~~~~~~/licensing~~~~~~
|
||||
-->
|
||||
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Entaxy 1C Communication plugin</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hawtio :: Entaxy 1C Communication plugin</h1>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,212 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* plugin
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
var Entaxy1CCommunication;
|
||||
(function (Entaxy1CCommunication) {
|
||||
Entaxy1CCommunication._module
|
||||
.component('entaxy1cCommunicationDemo', {
|
||||
template:
|
||||
`
|
||||
<!-- // fixme style -->
|
||||
<div style="padding: 0 20px;">
|
||||
<!-- // fixme style -->
|
||||
<div style="display: flex; justify-content: space-between; align-items: center;">
|
||||
<h2>
|
||||
Тестовое Приложение для 1С
|
||||
</h2>
|
||||
|
||||
<div>
|
||||
<!-- // fixme style -->
|
||||
<button type="button" ng-if="!$ctrl.isStopped" ng-click="$ctrl.stop()" style="width: 90px; height: 25px; margin-top: 5px;">Остановить</button>
|
||||
<!-- // fixme style -->
|
||||
<button type="button" ng-if="$ctrl.isStopped" ng-click="$ctrl.start()" style="width: 90px; height: 25px; margin-top: 5px;">Запустить</button>
|
||||
<button type="button" ng-click="$ctrl.showSettingsModal()" style="width: 90px; height: 25px; margin-top: 5px;">Настройки</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<pf-table-view config="$ctrl.tableConfig"
|
||||
columns="$ctrl.tableColumns"
|
||||
action-buttons="$ctrl.tableActionButtons"
|
||||
page-config="$ctrl.pageConfig"
|
||||
items="$ctrl.viewedItems"
|
||||
empty-state-config="$ctrl.emptyStateConfig">
|
||||
</pf-table-view>
|
||||
|
||||
</div>
|
||||
`,
|
||||
controller: Entaxy1CCommunicationScopesController
|
||||
})
|
||||
.name;
|
||||
|
||||
function Entaxy1CCommunicationScopesController(workspace, $scope, $interval, $q, soapService, xml2JsonService, $uibModal) {
|
||||
'ngInject';
|
||||
|
||||
var ctrl = this;
|
||||
ctrl.workspace = workspace;
|
||||
|
||||
ctrl.tableConfig = {
|
||||
selectionMatchProp: 'name',
|
||||
showCheckboxes: false
|
||||
};
|
||||
|
||||
ctrl.emptyStateConfig = {
|
||||
title: 'Сообщения Отсутствуют'
|
||||
};
|
||||
|
||||
ctrl.tableColumns = [
|
||||
{ header: 'UUID Сообщения', itemField: 'uuid' },
|
||||
{ header: 'Наименование', itemField: 'name' }
|
||||
];
|
||||
|
||||
ctrl.pageConfig = {
|
||||
pageNumber: 1,
|
||||
pageSize: 10,
|
||||
pageSizeIncrements: [5, 10, 20, 50, 100]
|
||||
};
|
||||
|
||||
let readMessages;
|
||||
|
||||
$scope.startReading = function() {
|
||||
if (angular.isDefined(readMessages)) return;
|
||||
|
||||
readMessages = $interval(populateTable, 15000);
|
||||
}
|
||||
|
||||
$scope.stopReading = function() {
|
||||
if (angular.isDefined(readMessages)) {
|
||||
$interval.cancel(readMessages);
|
||||
readMessages = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
$scope.$on('$destroy', function() {
|
||||
$scope.stopReading();
|
||||
});
|
||||
|
||||
ctrl.items = [];
|
||||
ctrl.viewedItems = [];
|
||||
|
||||
ctrl.$onInit = function() {
|
||||
ctrl.profileName = 'system-crm';
|
||||
ctrl.forwardedUser = 'system-crm';
|
||||
populateTable();
|
||||
$scope.startReading();
|
||||
}
|
||||
|
||||
function populateTable() {
|
||||
getItem().then((item) => {
|
||||
if (item) {
|
||||
ctrl.items.push(item);
|
||||
ctrl.viewedItems = ctrl.items;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ctrl.stop = function () {
|
||||
ctrl.isStopped = true;
|
||||
$scope.stopReading();
|
||||
}
|
||||
|
||||
ctrl.start = function () {
|
||||
ctrl.isStopped = false;
|
||||
populateTable();
|
||||
$scope.startReading();
|
||||
}
|
||||
|
||||
function getItem () {
|
||||
let deferred = $q.defer();
|
||||
|
||||
let bodyGet = getBodyForGetMethod(ctrl.profileName);
|
||||
|
||||
soapService.execute(bodyGet, ctrl.forwardedUser, '/uniform-exchange')
|
||||
.then((bodyResponse) => {
|
||||
|
||||
if (bodyResponse != null) {
|
||||
|
||||
let packet = bodyResponse.packets[0].packet[0];
|
||||
|
||||
let messageUuid = packet.header[0].transportUUID[0]['#text'];
|
||||
|
||||
let bodyAck = getBodyForAckMethod(messageUuid);
|
||||
soapService.execute(bodyAck, ctrl.forwardedUser, '/uniform-exchange');
|
||||
|
||||
let messageContent = packet.message[0].content[0];
|
||||
let messageContentParsed = xml2JsonService.xml2json(messageContent['#text']);
|
||||
let name = messageContentParsed.classData[0]['Наименование'][0]['#text'];
|
||||
|
||||
deferred.resolve({ uuid: messageUuid, name: name });
|
||||
|
||||
}
|
||||
|
||||
deferred.resolve(null);
|
||||
|
||||
}).catch(error => {
|
||||
Core.notification('danger', error, 5000);
|
||||
Entaxy1CCommunication.log.error(error);
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function getBodyForGetMethod(destinationId) {
|
||||
return '<ns:getPacketsRequest>' +
|
||||
'<ns:destination>' +
|
||||
'<ns:id>' + destinationId + '</ns:id>' +
|
||||
'<ns:type>system.name</ns:type>' +
|
||||
'</ns:destination>' +
|
||||
'<ns:limitCount>1</ns:limitCount>' +
|
||||
'<ns:limitSize>0</ns:limitSize>' +
|
||||
'</ns:getPacketsRequest>';
|
||||
}
|
||||
|
||||
function getBodyForAckMethod(messageUuid) {
|
||||
return '<ns:uuids><ns:uuid>' + messageUuid + '</ns:uuid></ns:uuids>';
|
||||
}
|
||||
|
||||
ctrl.showSettingsModal = function () {
|
||||
$uibModal.open({
|
||||
component: 'entaxy1cCommunicationDemoSettingsModal',
|
||||
resolve: {
|
||||
forwardedUser: () => ctrl.forwardedUser,
|
||||
destinationId: () => ctrl.profileName
|
||||
},
|
||||
backdrop: 'static'
|
||||
})
|
||||
.result.then(fields => {
|
||||
let args = fields.reduce((obj, cur) => ({ ...obj, [cur.name] : cur.value }), {});
|
||||
ctrl.forwardedUser = args['forwardedUser'];
|
||||
ctrl.profileName = args['destinationId'];
|
||||
},
|
||||
reason => {
|
||||
if (reason) {
|
||||
Core.notification('danger', reason, 5000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Entaxy1CCommunicationScopesController.$inject = ['workspace', '$scope', '$interval', '$q', 'soapService', 'xml2JsonService', '$uibModal'];
|
||||
|
||||
})(Entaxy1CCommunication || (Entaxy1CCommunication = {}));
|
@ -0,0 +1,125 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* plugin
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
var Entaxy1CCommunication;
|
||||
(function (Entaxy1CCommunication) {
|
||||
Entaxy1CCommunication._module.component('entaxy1cCommunicationDemoSettingsModal', {
|
||||
bindings: {
|
||||
modalInstance: '<',
|
||||
resolve: '<'
|
||||
},
|
||||
template:
|
||||
`
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" aria-label="Close" ng-click="$ctrl.cancel()">
|
||||
<span class="pficon pficon-close" aria-hidden="true"></span>
|
||||
</button>
|
||||
<h4 class="modal-title">Настройки</h4>
|
||||
</div>
|
||||
|
||||
<!-- // fixme style -->
|
||||
<div class="modal-body" style="height: 200px;">
|
||||
<form name="connectorForm" class="form-horizontal"> <!-- //fixme class -->
|
||||
<div class="form-group" ng-class="{'has-error': $ctrl.errors[formField.name]}"
|
||||
ng-repeat="formField in $ctrl.formFields">
|
||||
<div class="col-sm-4 label-col">
|
||||
<label class="control-label" ng-class="{'required-pf': formField.required}" for="{{formField.name}}">{{formField.label}}</label>
|
||||
<button type="button" class="btn btn-link label-description-popover" popover-placement="auto top-left" popover-trigger="'outsideClick'"
|
||||
uib-popover="{{formField.description}}" ng-if="formField.description">
|
||||
<span class="pficon pficon-help"></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-sm-7">
|
||||
<input type="{{formField.type}}" id="{{formField.name}}" ng-class="{'form-control': formField.type !== 'checkbox'}" ng-model="formField.value">
|
||||
<span class="help-block" ng-show="$ctrl.errors[formField.name]">{{$ctrl.errors[formField.name]}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary" ng-click="$ctrl.save()">Сохранить</button>
|
||||
</div>
|
||||
`,
|
||||
controller: Entaxy1cCommunicationDemoSettingsModalController
|
||||
})
|
||||
.name;
|
||||
|
||||
function Entaxy1cCommunicationDemoSettingsModalController(operationsService, entaxyService) {
|
||||
'ngInject';
|
||||
|
||||
var ctrl = this;
|
||||
|
||||
ctrl.$onInit = function () {
|
||||
|
||||
let forwardedUser = ctrl.resolve.forwardedUser;
|
||||
let destinationId = ctrl.resolve.destinationId;
|
||||
|
||||
ctrl.formFields = [];
|
||||
|
||||
ctrl.formFields.push({
|
||||
label: 'Forwarded User',
|
||||
name: 'forwardedUser',
|
||||
type: 'java.lang.String',
|
||||
value: forwardedUser,
|
||||
required: true
|
||||
});
|
||||
|
||||
ctrl.formFields.push({
|
||||
label: 'Destination Id',
|
||||
name: 'destinationId',
|
||||
type: 'java.lang.String',
|
||||
value: destinationId,
|
||||
required: true
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
ctrl.cancel = function (reason) {
|
||||
ctrl.modalInstance.dismiss(reason);
|
||||
}
|
||||
|
||||
ctrl.save = function () {
|
||||
ctrl.errors = validate();
|
||||
|
||||
if (Object.keys(ctrl.errors).length === 0) {
|
||||
ctrl.modalInstance.close(ctrl.formFields.map((field) => { return { name: field.name, value: field.value }; }));
|
||||
}
|
||||
}
|
||||
|
||||
function validate () {
|
||||
let errors = {};
|
||||
|
||||
ctrl.formFields.forEach((field) => {
|
||||
if (field.required && (field.value === undefined || field.value.trim().length === 0)) {
|
||||
errors[field.name] = 'Please fill out this field';
|
||||
}
|
||||
});
|
||||
|
||||
return errors;
|
||||
}
|
||||
}
|
||||
Entaxy1cCommunicationDemoSettingsModalController.$inject = ['operationsService', 'entaxyService'];
|
||||
|
||||
})(Entaxy1CCommunication || (Entaxy1CCommunication = {}));
|
@ -0,0 +1,81 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* entaxy-management-plugin
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
/**
|
||||
* The main entry point for the Simple module
|
||||
*/
|
||||
var Entaxy1CCommunication = (function (Entaxy1CCommunication) {
|
||||
|
||||
/**
|
||||
* The name of this plugin
|
||||
*/
|
||||
Entaxy1CCommunication.pluginName = 'entaxy-1c-communication';
|
||||
|
||||
/**
|
||||
* This plugin's logger instance
|
||||
*/
|
||||
Entaxy1CCommunication.log = Logger.get('entaxy-1c-communication');
|
||||
|
||||
/**
|
||||
* The top level path of this plugin on the server
|
||||
*/
|
||||
Entaxy1CCommunication.contextPath = "/entaxy-1c-communication/";
|
||||
|
||||
Entaxy1CCommunication.log.info("loading entaxy 1c communication plugin")
|
||||
Entaxy1CCommunication._module = angular.module(Entaxy1CCommunication.pluginName, [
|
||||
'angularResizable'
|
||||
])
|
||||
.component('entaxy1cCommunication', {
|
||||
template:
|
||||
`
|
||||
<entaxy-1c-communication-demo></entaxy-1c-communication-demo>
|
||||
`
|
||||
})
|
||||
.run(configurePlugin);
|
||||
|
||||
function configurePlugin(mainNavService, workspace, helpRegistry, preferencesRegistry, localStorage, preLogoutTasks, documentBase, $templateCache) {
|
||||
var entaxy1CCommunicationJmxDomain = localStorage['entaxy1CCommunicationJmxDomain'] || "ru.entaxy.1c.communication";
|
||||
mainNavService.addItem({
|
||||
title: 'Тестовое Приложение',
|
||||
basePath: '/1c-communication',
|
||||
template: '<entaxy-1c-communication></entaxy-1c-communication>',
|
||||
isValid: function () { return workspace.treeContainsDomainAndProperties(entaxy1CCommunicationJmxDomain); }
|
||||
});
|
||||
// clean up local storage upon logout
|
||||
/*preLogoutTasks.addTask('CleanupArtemisCredentials', function () {
|
||||
Artemis.log.debug("Clean up Artemis credentials in local storage");
|
||||
localStorage.removeItem('artemisUserName');
|
||||
localStorage.removeItem('artemisPassword');
|
||||
});*/
|
||||
}
|
||||
configurePlugin.$inject = ['mainNavService', 'workspace', 'helpRegistry', 'preferencesRegistry', 'localStorage', 'preLogoutTasks', 'documentBase', '$templateCache'];
|
||||
|
||||
return Entaxy1CCommunication;
|
||||
|
||||
})(Entaxy1CCommunication || {});
|
||||
|
||||
// tell the Hawtio plugin loader about our plugin so it can be
|
||||
// bootstrapped with the rest of AngularJS
|
||||
hawtioPluginLoader.addModule(Entaxy1CCommunication.pluginName);
|
@ -0,0 +1,90 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* plugin
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
var Entaxy1CCommunication;
|
||||
(function (Entaxy1CCommunication) {
|
||||
Entaxy1CCommunication._module.factory('soapService', ['$q', '$http', '$location', 'xml2JsonService',
|
||||
function($q, $http, $location, xml2JsonService) {
|
||||
return {
|
||||
execute: function (body, forwardedUser, context) {
|
||||
return execute(body, forwardedUser, context);
|
||||
}
|
||||
};
|
||||
|
||||
function execute(body, forwardedUser, context) {
|
||||
|
||||
let deferred = $q.defer();
|
||||
let cxfContext = '/cxf';
|
||||
let url = getBaseLocation() + cxfContext + context;
|
||||
|
||||
$http.defaults.headers.common.Authorization = 'Basic c3lzNDpzeXM0';
|
||||
$http({
|
||||
'url': url,
|
||||
'method': 'POST',
|
||||
'headers': {
|
||||
'X-ForwardedUser' : forwardedUser
|
||||
},
|
||||
'data': '<?xml version="1.0" encoding="UTF-8"?>'+
|
||||
'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.entaxy.ru/ExchangeTypes/1.0">' +
|
||||
'<soapenv:Header/>' +
|
||||
'<soapenv:Body>' + body + '</soapenv:Body>' +
|
||||
'</soapenv:Envelope>'
|
||||
})
|
||||
.then(function(response) {
|
||||
|
||||
Entaxy1CCommunication.log.info('response data ' + response.data);
|
||||
|
||||
let jsonResponse = xml2JsonService.xml2json(response.data);
|
||||
|
||||
Entaxy1CCommunication.log.info('parsed response data ' + JSON.stringify(jsonResponse));
|
||||
|
||||
let body = jsonResponse['soap:Envelope'][0]['soap:Body'][0];
|
||||
let bodyResponse = body.response[0];
|
||||
|
||||
let status = bodyResponse.status[0]['#text'];
|
||||
|
||||
if (status === '200') {
|
||||
deferred.resolve(bodyResponse);
|
||||
} else if (status === '204') {
|
||||
deferred.resolve(null);
|
||||
} else {
|
||||
deferred.reject('Error status: ' + status);
|
||||
}
|
||||
}, function(response) {
|
||||
deferred.reject(response);
|
||||
}).catch(function(fallback) {
|
||||
Entaxy1CCommunication.log.error(fallback);
|
||||
});
|
||||
return deferred.promise;
|
||||
};
|
||||
|
||||
function getBaseLocation() {
|
||||
let port = $location.port();
|
||||
return $location.protocol() + '://' + $location.host() + (port ? (':' + port) : '');
|
||||
}
|
||||
|
||||
}
|
||||
]);
|
||||
})(Entaxy1CCommunication || (Entaxy1CCommunication = {}));
|
@ -0,0 +1,81 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* plugin
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
var Entaxy1CCommunication;
|
||||
(function (Entaxy1CCommunication) {
|
||||
Entaxy1CCommunication._module.factory('xml2JsonService', [
|
||||
function() {
|
||||
return {
|
||||
xml2json: function (xml) {
|
||||
return xml2json(xml);
|
||||
}
|
||||
};
|
||||
|
||||
function xml2json(xml) {
|
||||
let result = {};
|
||||
let parser = new DOMParser();
|
||||
let xmlDoc = parser.parseFromString(xml, "text/xml");
|
||||
|
||||
xmlDoc.childNodes.forEach((node) => {
|
||||
parseNode(node, result);
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function parseNode(xmlNode, result) {
|
||||
if (xmlNode.nodeName == "#text") {
|
||||
let value = xmlNode.nodeValue;
|
||||
if (value.trim()) {
|
||||
result['#text'] = value;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
let jsonNode = {};
|
||||
let existing = result[xmlNode.nodeName];
|
||||
if (existing) {
|
||||
if (!Array.isArray(existing)) {
|
||||
result[xmlNode.nodeName] = [existing, jsonNode];
|
||||
} else {
|
||||
result[xmlNode.nodeName].push(jsonNode);
|
||||
}
|
||||
} else {
|
||||
result[xmlNode.nodeName] = [jsonNode];
|
||||
}
|
||||
|
||||
if (xmlNode.attributes) {
|
||||
angular.forEach(xmlNode.attributes, (attribute) => {
|
||||
jsonNode[attribute.nodeName] = attribute.nodeValue;
|
||||
});
|
||||
}
|
||||
|
||||
xmlNode.childNodes.forEach((node) => {
|
||||
parseNode(node, jsonNode);
|
||||
});
|
||||
}
|
||||
}
|
||||
]);
|
||||
})(Entaxy1CCommunication || (Entaxy1CCommunication = {}));
|
Reference in New Issue
Block a user