Commit c02e8c82 authored by ZZZ[GONE] frebault's avatar ZZZ[GONE] frebault
Browse files

Merge branch '1.1.1' into 'master'

1.1.1

See merge request !1
parents a08b3e0f 4e94902e
......@@ -11,3 +11,8 @@ CHANGELOG
* Fix Interface suffix sor SLI
* Add BeSimple component and replace base soapClient by BeSimple\SoapClient\SoapClient.php
1.1.1
-----
* Add GgusObjectInterface
* Remove functions not used
\ No newline at end of file
......@@ -10,4 +10,4 @@ A simple PHP static library to GGUS Soap service.
## Get Started
Implement GgusObject class
\ No newline at end of file
Implement GgusObject class
{
"name": "ccin2p3/ggushelpdesk",
"description": "GGUS Helpdesk Soap access",
"license" : "Apache-2.0",
"authors": [
{
"name": "FREBAULT",
"email": "pfrebaul@cc.in2p3.fr"
},
{
"name": "Olivier Lequeux",
"email": "olequeux@cc.in2p3.fr"
}
],
"autoload": {
"psr-4": {"": "src/"}
"name": "ccin2p3/ggushelpdesk",
"description": "GGUS Helpdesk Soap access",
"license" : "Apache-2.0",
"authors": [
{
"name": "FREBAULT",
"email": "pfrebaul@cc.in2p3.fr"
},
"require": {
"php": ">=5.3.0",
"besimple/soap-common" : "dev-master",
"besimple/soap-client": "dev-master"
{
"name": "Olivier Lequeux",
"email": "olequeux@cc.in2p3.fr"
}
}
],
"autoload": {
"psr-4": {"": "src/"}
},
"require": {
"php": ">=5.3.0",
"besimple/soap-common" : "~0.2.5",
"besimple/soap-client": "~0.2.5"
}
}
\ No newline at end of file
......@@ -12,4 +12,4 @@ class HelpdeskOperationException extends \Exception
parent::__construct('[HelpdeskOperationException] '.$message, $code, $previous);
}
}
\ No newline at end of file
}
......@@ -12,4 +12,4 @@ class InvalidFieldException extends \Exception
parent::__construct('[InvalidFieldException] '.$message, $code, $previous);
}
}
\ No newline at end of file
}
......@@ -8,7 +8,7 @@
namespace GGUSHelpdesk\ExtendedFields;
class ArrayObjectFactory implements IExtendedFieldsFactory{
class ArrayObjectFactory implements ExtendedFieldsFactoryInterface{
function createInstanceFromFieldsList(array $fieldsList)
{
......@@ -25,4 +25,4 @@ class ArrayObjectFactory implements IExtendedFieldsFactory{
function serializeInstance($object){
return $object->serialize();
}
}
\ No newline at end of file
}
......@@ -8,11 +8,10 @@
namespace GGUSHelpdesk\ExtendedFields;
interface IExtendedFieldsFactory {
interface ExtendedFieldsFactoryInterface {
function createInstanceFromFieldsList(array $fieldsList);
function createInstanceFromSerializedObject($string);
function serializeInstance($object);
}
\ No newline at end of file
}
......@@ -2,7 +2,7 @@
namespace GGUSHelpdesk;
use GGUSHelpdesk\Exceptions\InvalidFieldException;
use GGUSHelpdesk\ExtendedFields\IExtendedFieldsFactory;
use GGUSHelpdesk\ExtendedFields\ExtendedFieldsFactoryInterface;
/**
* provide basic behaviour a GGUS obejct's Fields
......@@ -52,7 +52,7 @@ class Fields extends ArrayFields
return $this[$this->extendedFieldsIndex];
}
public function setExtendedFieldsFactory(IExtendedFieldsFactory $factory)
public function setExtendedFieldsFactory(ExtendedFieldsFactoryInterface $factory)
{
$this->extendedFieldsFactory = $factory;
}
......
......@@ -6,11 +6,13 @@ use GGUSHelpdesk\Exceptions\GgusObjectValidationException;
use GGUSHelpdesk\Exceptions\InvalidFieldException;
class GgusObject
class GgusObject implements GgusObjectInterface
{
protected $fields;
protected $lastValidationError;
const ID_LABEL = "GHD_Request_ID";
const MODIFICATION_DATE_LABEL = "GHD_Modified_Date";
public function __construct(Fields $fields)
{
......@@ -123,17 +125,10 @@ class GgusObject
}
}
//-------- common cMAP fields accessors ---------
public function getLogin()
{
return $this->fields->getValue('Login');
}
public function getId()
{
try {
$id = $this->fields->getValue('Id');
$id = $this->fields[self::ID_LABEL];
} catch (InvalidFieldException $tE) {
$id = null;
}
......@@ -141,30 +136,17 @@ class GgusObject
return $id;
}
public function setId($str)
{
return $this->fields->setValue('Id', $str);
}
public function setModifier($str)
{
$this->fields->setValue('Modifier', $str);
}
public function getModifier()
public function setId($id)
{
return $this->fields->getValue('Modifier');
$this->fields[self::ID_LABEL] = $id;
}
//-------- common xMAP fields accessors ---------
public function setHelpdesk($str)
{
$this->fields->setValue('Helpdesk', $str);
public function getModificationDate(){
return $this->fields[self::MODIFICATION_DATE_LABEL];
}
public function getHelpdesk()
public function setModificationDate($date)
{
return $this->fields->getValue('Helpdesk');
$this->fields[self::MODIFICATION_DATE_LABEL] = $date;
}
}
<?php
/**
* Created by PhpStorm.
* User: Pierre FREBAULT
* Date: 06/11/2014
* Time: 15:26
*/
namespace GGUSHelpdesk;
interface GgusObjectInterface {
function fromHelpdesk($data);
function toHelpdesk();
function getHelpdeskValue($id);
function getModificationDate();
}
\ No newline at end of file
......@@ -10,7 +10,7 @@ use BeSimple\SoapClient\SoapClient;
/**
* provide basic access to ggus soap service
*/
abstract class SoapService
abstract class GgusSoapService
{
const GGUS_OBJECT_NOT_FOUND = "ERROR (302): Entry does not exist in database; ";
......@@ -64,10 +64,10 @@ abstract class SoapService
/**
* Check if ggusObject constants needed by helpdesk are properly set
* @param <GgusObject> ggusObject instance to check
* @param GgusObjectInterface ggusObject instance to check
* @return <bool> true if ggusObject is well formed, false otherwise
*/
protected function isGgusObjectWellformed(GgusObject $ggusobject)
protected function isGgusObjectWellformed(GgusObjectInterface $ggusobject)
{
// check default values
......@@ -88,6 +88,10 @@ abstract class SoapService
return true;
}
/**
* @param bool $setDefaultValues
* @return GgusObjectInterface
*/
abstract function createGgusObjectInstance($setDefaultValues = true);
protected function getGgusFieldInstance()
......@@ -225,7 +229,7 @@ abstract class SoapService
* @return <int> request id of ggusObject created/updated
* @author olivier lequeux
*/
final function __setGgusObject(GgusObject $ggusObject, $method, $idParamName)
final function __setGgusObject(GgusObjectInterface $ggusObject, $method, $idParamName)
{
$id = null;
try {
......
......@@ -3,13 +3,13 @@
namespace GGUSHelpdesk\resources;
use GGUSHelpdesk\GgusObject;
use \GGUSHelpdesk\SoapService;
use \GGUSHelpdesk\GgusSoapService;
/**
*
* @author Pierre FREBAULT
*/
class TestGgusSoapService extends SoapService
class TestGgusSoapService extends GgusSoapService
{
public function __construct(array $config, $name)
......
......@@ -56,8 +56,8 @@ class SoapServiceTest extends PHPUnit_Framework_TestCase {
'maps' =>array('cMap'=>$maps),
'urls'=>array('wsdl'=>'https://train-ars.ggus.eu/arsys/WSDL/public/train-ars'),
'authentication'=> array(
'userName'=>'****',
'password'=>'****')
'userName'=>'*****',
'password'=>'*****')
), 'GGUS_OPS');
var_dump($tss->__getGgusObject('51532','OpGetOps','GHD_Request_ID')->toHelpdesk());
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment