Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bingo
BusinessModel
Commits
4188922a
Commit
4188922a
authored
2 years ago
by
Антон Новиков
Browse files
Options
Download
Email Patches
Plain Diff
feat: Реализована модель вида сведений AfforestationProject
parent
76673b4b
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
335 additions
and
0 deletions
+335
-0
src/AfforestationProject/Impl/AfforestationProjectModelConstants.php
...tationProject/Impl/AfforestationProjectModelConstants.php
+12
-0
src/AfforestationProject/Impl/AfforestationProjectModelInstanceImpl.php
...ionProject/Impl/AfforestationProjectModelInstanceImpl.php
+36
-0
src/AfforestationProject/Impl/AfforestationProjectParser.php
src/AfforestationProject/Impl/AfforestationProjectParser.php
+37
-0
src/AfforestationProject/Impl/Instance/RequestImpl.php
src/AfforestationProject/Impl/Instance/RequestImpl.php
+61
-0
src/AfforestationProject/Instance/.gitkeep
src/AfforestationProject/Instance/.gitkeep
+0
-0
src/Types/Impl/TypesModelInstanceImpl.php
src/Types/Impl/TypesModelInstanceImpl.php
+2
-0
tests/AfforestationProject/AfforestationProjectTest.php
tests/AfforestationProject/AfforestationProjectTest.php
+52
-0
tests/AfforestationProject/Resources/Request0.xml
tests/AfforestationProject/Resources/Request0.xml
+59
-0
tests/Types/Resources/NoMetadataAfforestationProject.xml
tests/Types/Resources/NoMetadataAfforestationProject.xml
+59
-0
tests/Types/TypesTest.php
tests/Types/TypesTest.php
+17
-0
No files found.
src/AfforestationProject/Impl/AfforestationProjectModelConstants.php
0 → 100644
View file @
4188922a
<?php
namespace
BusinessModel\AfforestationProject\Impl
;
class
AfforestationProjectModelConstants
{
public
const
XSI_NS
=
"http://www.w3.org/2001/XMLSchema-instance"
;
public
const
MODEL_NAME
=
"request"
;
public
const
MODEL_NAMESPACE
=
"urn://rostelekom.ru/AfforestationProject/1.0.1"
;
public
const
ELEMENT_NAME_REQUEST
=
"request"
;
}
This diff is collapsed.
Click to expand it.
src/AfforestationProject/Impl/AfforestationProjectModelInstanceImpl.php
0 → 100644
View file @
4188922a
<?php
namespace
BusinessModel\AfforestationProject\Impl
;
use
Xml\
{
ModelBuilder
,
ModelInterface
};
use
BusinessModel\AfforestationProject\Impl\Instance\RequestImpl
;
use
BusinessModel\Core\Impl\Instance\MetaImpl
;
class
AfforestationProjectModelInstanceImpl
{
private
static
$model
;
private
static
$modelBuilder
;
public
static
function
getModel
():
ModelInterface
{
if
(
self
::
$model
===
null
)
{
$modelBuilder
=
self
::
getModelBuilder
();
RequestImpl
::
registerType
(
$modelBuilder
);
MetaImpl
::
registerType
(
$modelBuilder
);
self
::
$model
=
$modelBuilder
->
build
();
}
return
self
::
$model
;
}
public
static
function
getModelBuilder
():
ModelBuilder
{
if
(
self
::
$modelBuilder
===
null
)
{
self
::
$modelBuilder
=
ModelBuilder
::
createInstance
(
AfforestationProjectModelConstants
::
MODEL_NAME
);
}
return
self
::
$modelBuilder
;
}
}
This diff is collapsed.
Click to expand it.
src/AfforestationProject/Impl/AfforestationProjectParser.php
0 → 100644
View file @
4188922a
<?php
namespace
BusinessModel\AfforestationProject\Impl
;
use
Xml\ModelInstanceInterface
;
use
Xml\Impl\ModelInstanceImpl
;
use
Xml\Impl\Parser\AbstractModelParser
;
use
Xml\Instance\DomDocumentInterface
;
class
AfforestationProjectParser
extends
AbstractModelParser
{
private
const
SCHEMA_LOCATION
=
"src/Model/Knd/AfforestationProject/Resources/AfforestationProject.xsd"
;
private
const
KND_NS
=
"urn://rostelekom.ru/AfforestationProject/1.0.1"
;
public
function
__construct
()
{
//$this->addSchema(self::KND_NS, self::SCHEMA_LOCATION);
}
public
function
parseModelFromText
(
string
$text
):
?ModelInstanceInterface
{
$path
=
tempnam
(
sys_get_temp_dir
(),
'model'
);
file_put_contents
(
$path
,
$text
);
$fd
=
fopen
(
$path
,
'r+'
);
return
$this
->
parseModelFromStream
(
$fd
);
}
protected
function
createModelInstance
(
DomDocumentInterface
$document
):
ModelInstanceInterface
{
return
new
ModelInstanceImpl
(
AfforestationProjectInstanceImpl
::
getModel
(),
AfforestationProjectModelInstanceImpl
::
getModelBuilder
(),
$document
);
}
}
This diff is collapsed.
Click to expand it.
src/AfforestationProject/Impl/Instance/RequestImpl.php
0 → 100644
View file @
4188922a
<?php
namespace
BusinessModel\AfforestationProject\Impl\Instance
;
use
Xml\ModelBuilder
;
use
Xml\Instance\ModelElementInstanceInterface
;
use
Xml\Impl\Instance\ModelElementInstanceImpl
;
use
Xml\Impl\Instance\ModelTypeInstanceContext
;
use
Xml\Type\ModelTypeInstanceProviderInterface
;
use
BusinessModel\AfforestationProject\Impl\AfforestationProjectModelConstants
;
use
BusinessModel\Core\Instance\
{
RequestInterface
as
CoreRequestInterface
,
MetaInterface
as
CoreMetaInterfaceInterface
};
use
BusinessModel\Core\Impl\Instance\MetaImpl
;
class
RequestImpl
extends
ModelElementInstanceImpl
implements
CoreRequestInterface
{
private
static
$meta
;
public
static
function
registerType
(
ModelBuilder
$modelBuilder
):
void
{
$typeBuilder
=
$modelBuilder
->
defineType
(
CoreRequestInterface
::
class
,
AfforestationProjectModelConstants
::
ELEMENT_NAME_REQUEST
)
->
namespaceUri
(
AfforestationProjectModelConstants
::
MODEL_NAMESPACE
)
->
instanceProvider
(
new
class
implements
ModelTypeInstanceProviderInterface
{
public
function
newInstance
(
ModelTypeInstanceContext
$instanceContext
):
CoreRequestInterface
{
return
new
RequestImpl
(
$instanceContext
);
}
}
);
$sequenceBuilder
=
$typeBuilder
->
sequence
();
self
::
$meta
=
$sequenceBuilder
->
element
(
CoreMetaInterfaceInterface
::
class
)
->
build
();
$typeBuilder
->
build
();
}
public
function
__construct
(
ModelTypeInstanceContext
$instanceContext
)
{
parent
::
__construct
(
$instanceContext
);
}
public
function
addChildElement
(
ModelElementInstanceInterface
$extraElement
):
void
{
$this
->
getDomElement
()
->
appendChild
(
$extraElement
->
getDomElement
());
}
public
function
getRequest
():
CoreRequestInterface
{
return
$this
;
}
}
This diff is collapsed.
Click to expand it.
src/AfforestationProject/Instance/.gitkeep
0 → 100644
View file @
4188922a
This diff is collapsed.
Click to expand it.
src/Types/Impl/TypesModelInstanceImpl.php
View file @
4188922a
...
...
@@ -14,6 +14,7 @@ use BusinessModel\Types\Impl\Instance\{
SenderProvidedRequestDataImpl
};
use
BusinessModel\Core\Impl\Instance\MetaImpl
;
use
BusinessModel\AfforestationProject\Impl\Instance\RequestImpl
as
AfforestationProjectRequestImpl
;
use
BusinessModel\ConstructionPermits\Impl\Instance\RequestImpl
as
ConstructionPermitsRequestImpl
;
use
BusinessModel\ConstructionSupervision\Impl\Instance\RequestImpl
as
ConstructionSupervisionRequestImpl
;
use
BusinessModel\DeviationParameters\Impl\Instance\RequestImpl
as
DeviationParametersRequestImpl
;
...
...
@@ -49,6 +50,7 @@ class TypesModelInstanceImpl
SenderProvidedRequestDataImpl
::
registerType
(
$modelBuilder
);
MetaImpl
::
registerType
(
$modelBuilder
);
AfforestationProjectRequestImpl
::
registerType
(
$modelBuilder
);
ConstructionPermitsRequestImpl
::
registerType
(
$modelBuilder
);
ConstructionSupervisionRequestImpl
::
registerType
(
$modelBuilder
);
DeviationParametersRequestImpl
::
registerType
(
$modelBuilder
);
...
...
This diff is collapsed.
Click to expand it.
tests/AfforestationProject/AfforestationProjectTest.php
0 → 100644
View file @
4188922a
<?php
namespace
Tests\AfforestationProject
;
use
PHPUnit\Framework\TestCase
;
use
Xml\ModelInstanceInterface
;
use
Xml\Impl\Instance\ModelTypeInstanceContext
;
use
BusinessModel\AfforestationProject\Impl\AfforestationProjectParser
;
use
BusinessModel\Core\Instance\MetaInterface
;
class
NotificationDemolitionTest
extends
TestCase
{
protected
$modelParser
;
protected
$modelInstance
;
/**
* @param string $test
*/
protected
function
parseModel
(
string
$test
)
{
$this
->
modelParser
=
new
AfforestationProjectParser
();
$xml
=
fopen
(
'tests/AfforestationProject/Resources/'
.
$test
.
'.xml'
,
'r+'
);
$this
->
modelInstance
=
$this
->
modelParser
->
parseModelFromStream
(
$xml
);
}
/**
* @param string $text
*/
protected
function
parseModelFromText
(
string
$text
)
{
$this
->
modelParser
=
new
AfforestationProjectParser
();
$this
->
modelInstance
=
$this
->
modelParser
->
parseModelFromText
(
$text
);
}
public
function
testRequest0Meta
():
void
{
$this
->
parseModel
(
"Request0"
);
$meta
=
$this
->
modelInstance
->
newInstance
(
MetaInterface
::
class
);
$meta
->
setId
(
"1"
);
$meta
->
setNodeId
(
"2"
);
$meta
->
setReferenceMessageId
(
"3"
);
$meta
->
setTransactionCode
(
"4"
);
$meta
->
setSenderId
(
"5"
);
$meta
->
setRecipientId
(
"6"
);
$request
=
$this
->
modelInstance
->
getDocumentElement
();
$request
->
addChildElement
(
$meta
);
$doc
=
$this
->
modelInstance
->
getDocument
()
->
getDomSource
();
$this
->
assertTrue
(
true
);
}
}
This diff is collapsed.
Click to expand it.
tests/AfforestationProject/Resources/Request0.xml
0 → 100644
View file @
4188922a
<tns:request
xmlns:tns=
"urn://rostelekom.ru/AfforestationProject/1.0.1"
oktmo=
"MNSV75_3T"
>
<tns:Service>
<tns:currentDate>
21.02.2022
</tns:currentDate>
<tns:userType>
PERSON_RF
</tns:userType>
<tns:orderId>
764310274
</tns:orderId>
<tns:orderStatusCode>
draft
</tns:orderStatusCode>
<tns:TargetId>
-10000000282
</tns:TargetId>
<tns:TargetName>
Предоставление проекта лесоразведения и внесения в него изменений
</tns:TargetName>
<tns:DepartmentId>
-10003772917
</tns:DepartmentId>
<tns:DepartmentName>
Уполномоченный орган субъекта Российской Федерации
</tns:DepartmentName>
<tns:okato>
14000000000
</tns:okato>
</tns:Service>
<tns:DelegateInfo>
1
</tns:DelegateInfo>
<tns:RecipientPersonalData>
<tns:fullfio>
Сидоренко Петр Иванович
</tns:fullfio>
<tns:lastname>
Сидоренко
</tns:lastname>
<tns:firstname>
Петр
</tns:firstname>
<tns:middlename>
Иванович
</tns:middlename>
<tns:gender>
1
</tns:gender>
<tns:dateBirth>
26.03.1973
</tns:dateBirth>
<tns:citizenship>
РОССИЯ
</tns:citizenship>
<tns:Phone>
+7(918)7594086
</tns:Phone>
<tns:Email>
inikitin@it-one.ru
</tns:Email>
<tns:regAddress>
127018, г. Москва, ул. 2-я Ямская, д. 56, кв. 78
</tns:regAddress>
<tns:factAddress>
468321, г. Байконур, ул. Ленина, д. 10, кв. 11
</tns:factAddress>
<tns:DocumentPersonal>
<tns:typeDoc>
1
</tns:typeDoc>
<tns:nameDoc>
Паспорт гражданина РФ
</tns:nameDoc>
<tns:docseries>
8670
</tns:docseries>
<tns:docnumber>
391957
</tns:docnumber>
<tns:issuedate>
26.03.1993
</tns:issuedate>
<tns:issueorg>
РУВД
</tns:issueorg>
<tns:issueidPassportRF>
550550
</tns:issueidPassportRF>
</tns:DocumentPersonal>
</tns:RecipientPersonalData>
<tns:AfforestationDate>
22.03.2022
</tns:AfforestationDate>
<tns:ForestPlotData>
<tns:Forestry>
Ноябрьское лесничество
</tns:Forestry>
<tns:RegionalForest>
Ноябрьское участковое лесничество
</tns:RegionalForest>
<tns:QuarterNumber>
1174
</tns:QuarterNumber>
<tns:SectionNumber>
81
</tns:SectionNumber>
</tns:ForestPlotData>
<tns:CompetentOrganization>
<tns:OrganizationID>
1033107000728
</tns:OrganizationID>
<tns:Name>
Администрация городского округа город Белгород (управление административной технической инспекции)
</tns:Name>
</tns:CompetentOrganization>
<tns:MethodGettingResults>
<tns:IsPaperDocumentRequired>
true
</tns:IsPaperDocumentRequired>
<tns:MethodGettingResults>
1
</tns:MethodGettingResults>
</tns:MethodGettingResults>
<tns:Documents>
<tns:AfforestationProjectDocument>
<tns:CodeDocument>
AfforestationProjectDocument
</tns:CodeDocument>
<tns:Name>
Проект лесоразведения.pdf
</tns:Name>
<tns:URL>
AfforestationProject.FileUploadComponent.AfforestationProject.764310274
</tns:URL>
<tns:type>
application/pdf
</tns:type>
</tns:AfforestationProjectDocument>
</tns:Documents>
</tns:request>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
tests/Types/Resources/NoMetadataAfforestationProject.xml
0 → 100644
View file @
4188922a
<tns:request
xmlns:tns=
"urn://rostelekom.ru/AfforestationProject/1.0.1"
oktmo=
"MNSV75_3T"
>
<tns:Service>
<tns:currentDate>
21.02.2022
</tns:currentDate>
<tns:userType>
PERSON_RF
</tns:userType>
<tns:orderId>
764310274
</tns:orderId>
<tns:orderStatusCode>
draft
</tns:orderStatusCode>
<tns:TargetId>
-10000000282
</tns:TargetId>
<tns:TargetName>
Предоставление проекта лесоразведения и внесения в него изменений
</tns:TargetName>
<tns:DepartmentId>
-10003772917
</tns:DepartmentId>
<tns:DepartmentName>
Уполномоченный орган субъекта Российской Федерации
</tns:DepartmentName>
<tns:okato>
14000000000
</tns:okato>
</tns:Service>
<tns:DelegateInfo>
1
</tns:DelegateInfo>
<tns:RecipientPersonalData>
<tns:fullfio>
Сидоренко Петр Иванович
</tns:fullfio>
<tns:lastname>
Сидоренко
</tns:lastname>
<tns:firstname>
Петр
</tns:firstname>
<tns:middlename>
Иванович
</tns:middlename>
<tns:gender>
1
</tns:gender>
<tns:dateBirth>
26.03.1973
</tns:dateBirth>
<tns:citizenship>
РОССИЯ
</tns:citizenship>
<tns:Phone>
+7(918)7594086
</tns:Phone>
<tns:Email>
inikitin@it-one.ru
</tns:Email>
<tns:regAddress>
127018, г. Москва, ул. 2-я Ямская, д. 56, кв. 78
</tns:regAddress>
<tns:factAddress>
468321, г. Байконур, ул. Ленина, д. 10, кв. 11
</tns:factAddress>
<tns:DocumentPersonal>
<tns:typeDoc>
1
</tns:typeDoc>
<tns:nameDoc>
Паспорт гражданина РФ
</tns:nameDoc>
<tns:docseries>
8670
</tns:docseries>
<tns:docnumber>
391957
</tns:docnumber>
<tns:issuedate>
26.03.1993
</tns:issuedate>
<tns:issueorg>
РУВД
</tns:issueorg>
<tns:issueidPassportRF>
550550
</tns:issueidPassportRF>
</tns:DocumentPersonal>
</tns:RecipientPersonalData>
<tns:AfforestationDate>
22.03.2022
</tns:AfforestationDate>
<tns:ForestPlotData>
<tns:Forestry>
Ноябрьское лесничество
</tns:Forestry>
<tns:RegionalForest>
Ноябрьское участковое лесничество
</tns:RegionalForest>
<tns:QuarterNumber>
1174
</tns:QuarterNumber>
<tns:SectionNumber>
81
</tns:SectionNumber>
</tns:ForestPlotData>
<tns:CompetentOrganization>
<tns:OrganizationID>
1033107000728
</tns:OrganizationID>
<tns:Name>
Администрация городского округа город Белгород (управление административной технической инспекции)
</tns:Name>
</tns:CompetentOrganization>
<tns:MethodGettingResults>
<tns:IsPaperDocumentRequired>
true
</tns:IsPaperDocumentRequired>
<tns:MethodGettingResults>
1
</tns:MethodGettingResults>
</tns:MethodGettingResults>
<tns:Documents>
<tns:AfforestationProjectDocument>
<tns:CodeDocument>
AfforestationProjectDocument
</tns:CodeDocument>
<tns:Name>
Проект лесоразведения.pdf
</tns:Name>
<tns:URL>
AfforestationProject.FileUploadComponent.AfforestationProject.764310274
</tns:URL>
<tns:type>
application/pdf
</tns:type>
</tns:AfforestationProjectDocument>
</tns:Documents>
</tns:request>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
tests/Types/TypesTest.php
View file @
4188922a
...
...
@@ -86,6 +86,23 @@ class TypesTest extends TestCase
$this
->
assertEquals
(
3251
,
strpos
(
$doc
->
saveXml
(),
'<ns0:meta id="1" nodeId="2" referenceMessageId="3" transactionCode="4" senderId="5" recipientId="6"/>'
));
}
public
function
testAfforestationProjectWithNoMetadata
():
void
{
$this
->
parseModel
(
"NoMetadataAfforestationProject"
);
$meta
=
$this
->
modelInstance
->
newInstance
(
MetaInterface
::
class
);
$meta
->
setId
(
"1"
);
$meta
->
setNodeId
(
"2"
);
$meta
->
setReferenceMessageId
(
"3"
);
$meta
->
setTransactionCode
(
"4"
);
$meta
->
setSenderId
(
"5"
);
$meta
->
setRecipientId
(
"6"
);
$root
=
$this
->
modelInstance
->
getDocumentElement
();
$request
=
$root
->
getRequest
();
$request
->
addChildElement
(
$meta
);
$doc
=
$this
->
modelInstance
->
getDocument
()
->
getDomSource
();
$this
->
assertEquals
(
5368
,
strpos
(
$doc
->
saveXml
(),
'<ns0:meta id="1" nodeId="2" referenceMessageId="3" transactionCode="4" senderId="5" recipientId="6"/>'
));
}
public
function
testConstructionPermitsWithNoMetadata
():
void
{
$this
->
parseModel
(
"NoMetadataConstructionPermits"
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment