ItEr41S16ImplantacionAplicacionItEr40S21: Added scripts for order elements service.

This commit is contained in:
Manuel Rego Casasnovas 2009-12-29 18:18:11 +01:00 committed by Javier Moran Rua
parent 6f1d1ebb04
commit ef4bedfab9
8 changed files with 189 additions and 2 deletions

View file

@ -28,6 +28,20 @@
- Check the returned errors are consistent with the comments in
resources-sample.xml.
* Export order elements:
- export-order-element.sh ORDER-ELEMENT-CODE (authenticate with
wsreader/wsreader)
* Import orders:
- import-order.sh order-sample.xml (authenticate with wswriter/wswriter)
* Update orders:
- update-order.sh order-update-sample.xml (authenticate with
wswriter/wswriter)
+ When working with the online demo:
* import-criterions-types.sh --prod criterion-types-sample.xml
@ -37,3 +51,12 @@
* import-resources.sh --prod resources-sample.xml
(authenticate with wswriter/wswriter)
* export-order-element.sh --prod ORDER-ELEMENT-CODE (authenticate with
wsreader/wsreader)
* import-order.sh --prod order-sample.xml (authenticate with
wswriter/wswriter)
* update-order.sh --prod order-update-sample.xml (authenticate with
wswriter/wswriter)

View file

@ -0,0 +1,31 @@
#!/bin/sh
. ./rest-common-env.sh
printf "Login name: "
read loginName
printf "Password: "
read password
baseServiceURL=$DEVELOPMENT_BASE_SERVICE_URL
certificate=$DEVELOPMENT_CERTIFICATE
for i in "$@"
do
if [ "$i" = "--prod" ]; then
baseServiceURL=$PRODUCTION_BASE_SERVICE_URL
certificate=$PRODUCTION_CERTIFICATE
else
orderElementCode=$i
fi
done
if [ "$orderElementCode" = "" ]; then
printf "Missing order element code\n" 1>&2
exit 1
fi
authorization=`./base64.sh $loginName:$password`
curl -sv -X GET $certificate --header "Authorization: Basic $authorization" \
$baseServiceURL/orderelements/$orderElementCode/ | tidy -xml -i -q -utf8

View file

@ -22,7 +22,7 @@ done
if [ "$file" = "" ]; then
printf "Missing file\n" 1>&2
exit -1
exit 1
fi
authorization=`./base64.sh $loginName:$password`

View file

@ -0,0 +1,33 @@
#!/bin/sh
. ./rest-common-env.sh
printf "Login name: "
read loginName
printf "Password: "
read password
baseServiceURL=$DEVELOPMENT_BASE_SERVICE_URL
certificate=$DEVELOPMENT_CERTIFICATE
for i in "$@"
do
if [ "$i" = "--prod" ]; then
baseServiceURL=$PRODUCTION_BASE_SERVICE_URL
certificate=$PRODUCTION_CERTIFICATE
else
file=$i
fi
done
if [ "$file" = "" ]; then
printf "Missing file\n" 1>&2
exit 1
fi
authorization=`./base64.sh $loginName:$password`
curl -sv -X POST $certificate -d @$file \
--header "Content-type: application/xml" \
--header "Authorization: Basic $authorization" \
$baseServiceURL/orderelements/ | tidy -xml -i -q -utf8

View file

@ -22,7 +22,7 @@ done
if [ "$file" = "" ]; then
printf "Missing file\n" 1>&2
exit -1
exit 1
fi
authorization=`./base64.sh $loginName:$password`

View file

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<order xmlns="http://rest.ws.navalplanner.org"
code="ORDER-1" name="Order" init-date="2010-01-01">
<labels>
<label name="low" type="priority" />
</labels>
<children>
<order-line-group code="ORDER-1-OE-1" name="Order element 1">
<children>
<order-line code="ORDER-1-OE-1-1" name="Order element 1.1">
<material-assignments>
<material-assignment material-code="MATERIAL-1" units="100" unit-price="10.5" />
</material-assignments>
<hours-groups>
<hours-group code="HG-1" working-hours="1000" resource-type="WORKER" />
</hours-groups>
</order-line>
<order-line code="ORDER-1-OE-1-2" name="Order element 1.2">
<hours-groups>
<hours-group code="HG-1" working-hours="2000" resource-type="WORKER" />
</hours-groups>
</order-line>
</children>
</order-line-group>
<order-line code="ORDER-1-OE-2" name="Order element 2">
<labels>
<label name="medium" type="risk" />
</labels>
<hours-groups>
<hours-group code="HG-1" working-hours="1500" resource-type="WORKER" />
</hours-groups>
</order-line>
</children>
</order>

View file

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<order xmlns="http://rest.ws.navalplanner.org"
code="ORDER-1" name="Order" init-date="2010-01-01">
<labels>
<label name="medium" type="priority" />
</labels>
<children>
<order-line-group code="ORDER-1-OE-1" name="Order element 1">
<children>
<order-line code="ORDER-1-OE-1-1" name="Order element 1.1">
<hours-groups>
<hours-group code="HG-1" working-hours="1500" resource-type="WORKER" />
</hours-groups>
</order-line>
<order-line code="ORDER-1-OE-1-2" name="Order element 1.2">
<hours-groups>
<hours-group code="HG-1" working-hours="2500" resource-type="WORKER" />
</hours-groups>
</order-line>
</children>
</order-line-group>
<order-line code="ORDER-1-OE-2" name="Order element 2">
<labels>
<label name="high" type="risk" />
</labels>
<hours-groups>
<hours-group code="HG-1" working-hours="1500" resource-type="WORKER" />
</hours-groups>
</order-line>
</children>
</order>

View file

@ -0,0 +1,33 @@
#!/bin/sh
. ./rest-common-env.sh
printf "Login name: "
read loginName
printf "Password: "
read password
baseServiceURL=$DEVELOPMENT_BASE_SERVICE_URL
certificate=$DEVELOPMENT_CERTIFICATE
for i in "$@"
do
if [ "$i" = "--prod" ]; then
baseServiceURL=$PRODUCTION_BASE_SERVICE_URL
certificate=$PRODUCTION_CERTIFICATE
else
file=$i
fi
done
if [ "$file" = "" ]; then
printf "Missing file\n" 1>&2
exit 1
fi
authorization=`./base64.sh $loginName:$password`
curl -sv -X PUT $certificate -d @$file \
--header "Content-type: application/xml" \
--header "Authorization: Basic $authorization" \
$baseServiceURL/orderelements/ | tidy -xml -i -q -utf8