Resources with the same "logical" name (code for machines; first name, surnamne, and nif for workers) among the list of resources *being imported* are detected. This detection must be implemented at the service-level (at the entity-level, @AssertTrue annotations in Machine and Worker detect importation of resources with the same logical name as other resources already existing in the *database*). A test case has been added (furthermore, ResourceServiceTest has been refactorized a little bit).
104 lines
3.8 KiB
XML
104 lines
3.8 KiB
XML
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
|
|
<resource-list xmlns="http://rest.ws.navalplanner.org">
|
|
|
|
<!-- *** Machines *** -->
|
|
|
|
<!-- OK -->
|
|
<machine code=" m1 " name="m1-name" description="m1-desc"/>
|
|
|
|
<!-- Missing code and name (description is optional). -->
|
|
<machine code="" description=""/>
|
|
|
|
<!-- Criterion satisfaction of incorrect type. -->
|
|
<machine code="m2" name="m2-name" description="m2-desc">
|
|
<criterion-satisfaction-list>
|
|
<criterion-satisfaction
|
|
criterion-type-name="WORK_RELATIONSHIP"
|
|
criterion-name="hiredResourceWorkingRelationship"
|
|
start-date="2009-01-01"
|
|
finish-date=""/>
|
|
</criterion-satisfaction-list>
|
|
</machine>
|
|
|
|
<!-- Another machine is being imported with the same code. -->
|
|
<machine code="m1" name="m3-name" description="m3-desc"/>
|
|
|
|
<!-- *** Workers *** -->
|
|
|
|
<!-- OK -->
|
|
<worker first-name="w1-firstName" surname="w1-surname" nif=" w1-nif ">
|
|
<criterion-satisfaction-list>
|
|
<criterion-satisfaction
|
|
criterion-type-name=" WORK_RELATIONSHIP "
|
|
criterion-name=" hiredResourceWorkingRelationship "
|
|
start-date="2009-01-01"
|
|
finish-date=""/>
|
|
<criterion-satisfaction
|
|
criterion-type-name="LEAVE"
|
|
criterion-name="paternityLeave"
|
|
start-date="2009-12-24"
|
|
finish-date="2009-12-25"/>
|
|
</criterion-satisfaction-list>
|
|
</worker>
|
|
|
|
<!-- Missing first name, surname, and nif. -->
|
|
<worker first-name="" nif=""/>
|
|
|
|
<!-- Missing start date in criterion satisfaction. -->
|
|
<worker first-name="w2-firstName" surname="w2-surname" nif=" w2-nif ">
|
|
<criterion-satisfaction-list>
|
|
<criterion-satisfaction
|
|
criterion-type-name="LEAVE"
|
|
criterion-name="paternityLeave"
|
|
finish-date="2009-12-25"/>
|
|
</criterion-satisfaction-list>
|
|
</worker>
|
|
|
|
<!-- Non-existent criterion type. -->
|
|
<worker first-name="w3-firstName" surname="w3-surname" nif=" w3-nif ">
|
|
<criterion-satisfaction-list>
|
|
<criterion-satisfaction
|
|
criterion-type-name="WORK_RELATIONSHIP_XXX"
|
|
criterion-name="hiredResourceWorkingRelationship"
|
|
start-date="2009-01-01"
|
|
finish-date=""/>
|
|
</criterion-satisfaction-list>
|
|
</worker>
|
|
|
|
<!-- Non-existent criterion. -->
|
|
<worker first-name="w4-firstName" surname="w4-surname" nif=" w4-nif ">
|
|
<criterion-satisfaction-list>
|
|
<criterion-satisfaction
|
|
criterion-type-name="WORK_RELATIONSHIP"
|
|
criterion-name="hiredResourceWorkingRelationshipXXX"
|
|
start-date="2009-01-01"
|
|
finish-date=""/>
|
|
</criterion-satisfaction-list>
|
|
</worker>
|
|
|
|
<!-- Criterion not specified. -->
|
|
<worker first-name="w5-firstName" surname="w5-surname" nif=" w5-nif ">
|
|
<criterion-satisfaction-list>
|
|
<criterion-satisfaction
|
|
criterion-type-name="WORK_RELATIONSHIP"
|
|
start-date="2009-01-01"
|
|
finish-date=""/>
|
|
</criterion-satisfaction-list>
|
|
</worker>
|
|
|
|
<!-- Criterion type not specified. -->
|
|
<worker first-name="w6-firstName" surname="w6-surname" nif=" w6-nif ">
|
|
<criterion-satisfaction-list>
|
|
<criterion-satisfaction
|
|
criterion-name="hiredResourceWorkingRelationship"
|
|
start-date="2009-01-01"
|
|
finish-date=""/>
|
|
</criterion-satisfaction-list>
|
|
</worker>
|
|
|
|
<!-- Another worker is being imported with the same first name, surname,
|
|
and nif. -->
|
|
<worker first-name="w1-firstName" surname="w1-surname" nif="w1-nif"/>
|
|
|
|
</resource-list>
|