/** * The constructor for NorthwindEntities accepting service URI */ public function __construct($uri = "") { if (strlen($uri) == 0) { $uri = DEFAULT_ODATA_SERVICE_URL; } if (Utility::reverseFind($uri, '/') != strlen($uri) - 1) { $uri = $uri . '/'; } $this->_baseURI = $uri; parent::__construct($this->_baseURI); $this->_entities = array("Categories", "CustomerDemographics", "Customers", "Employees", "Order_Details", "Orders", "Products", "Region", "Shippers", "Suppliers", "Territories"); $this->_entitySet2Type = array("categories" => "Categories", "customerdemographics" => "CustomerDemographics", "customers" => "Customers", "employees" => "Employees", "order_details" => "Order_Details", "orders" => "Orders", "products" => "Products", "region" => "Region", "shippers" => "Shippers", "suppliers" => "Suppliers", "territories" => "Territories"); $this->_entityType2Set = array("categories" => "Categories", "customerdemographics" => "CustomerDemographics", "customers" => "Customers", "employees" => "Employees", "order_details" => "Order_Details", "orders" => "Orders", "products" => "Products", "region" => "Region", "shippers" => "Shippers", "suppliers" => "Suppliers", "territories" => "Territories"); $this->_association = array("FK_Products_Categories" => array("Categories" => "0..1", "Products" => "*"), "FK_Orders_Customers" => array("Customers" => "0..1", "Orders" => "*"), "FK_Employees_Employees" => array("Employees" => "0..1", "Employees1" => "*"), "FK_Orders_Employees" => array("Employees" => "0..1", "Orders" => "*"), "FK_Order_Details_Orders" => array("Orders" => "1", "Order_Details" => "*"), "FK_Order_Details_Products" => array("Products" => "1", "Order_Details" => "*"), "FK_Orders_Shippers" => array("Shippers" => "0..1", "Orders" => "*"), "FK_Products_Suppliers" => array("Suppliers" => "0..1", "Products" => "*"), "FK_Territories_Region" => array("Region" => "1", "Territories" => "*"), "CustomerCustomerDemo" => array("CustomerDemographics" => "*", "Customers" => "*"), "EmployeeTerritories" => array("Employees" => "*", "Territories" => "*")); $this->_Categories = new DataServiceQuery('/' . 'Categories', $this); $this->_CustomerDemographics = new DataServiceQuery('/' . 'CustomerDemographics', $this); $this->_Customers = new DataServiceQuery('/' . 'Customers', $this); $this->_Employees = new DataServiceQuery('/' . 'Employees', $this); $this->_Order_Details = new DataServiceQuery('/' . 'Order_Details', $this); $this->_Orders = new DataServiceQuery('/' . 'Orders', $this); $this->_Products = new DataServiceQuery('/' . 'Products', $this); $this->_Region = new DataServiceQuery('/' . 'Region', $this); $this->_Shippers = new DataServiceQuery('/' . 'Shippers', $this); $this->_Suppliers = new DataServiceQuery('/' . 'Suppliers', $this); $this->_Territories = new DataServiceQuery('/' . 'Territories', $this); }
/** * Function to display addlink button, and to * generate form to handle addlink. * @param string $type The entitiy name. * @param string $attachedTo The navigation path */ public function displayAddLink($type, $attachedTo = '') { $pagingAllowed = null; if ($this->_enablePaging && isset($_REQUEST['pagingAllowed'])) { $pagingAllowed = "<input type=\"hidden\" name=\"pagingAllowed\" value=\"" . $_REQUEST['pagingAllowed'] . "\">"; } $skip = null; if (isset($_REQUEST['skip'])) { $skip = "<input type=\"hidden\" name=\"skip\" value=\"" . $_REQUEST['skip'] . "\">"; } echo $attachedTo . "<br>"; $pos = Utility::reverseFind($attachedTo, '/'); if ($pos != FALSE) { $attachedTo = substr($attachedTo, 0, $pos); } $object = $this->getObject($type); echo "<table style=\"border: thin solid #C0C0C0;\" border=\"1\">"; echo "<form action=\"" . $this->_containerScriptName . "?query=" . $this->_query . "&serviceUri=" . $this->_uri . "&Type=" . $type . "&AttachQuery=" . $attachedTo . "\" method=\"post\">" . $pagingAllowed . $skip; echo "<tr align=\"center\" style=\"font-family: Calibri; " . "background-color: #97CC00\">" . "<td Colspan =\"2\">" . get_class($object) . "</td></tr>"; echo "<tr style=\"font-family: Calibri; " . "background-color: #99CCFF\">" . "<td>Field</td>" . "<td>Value</td></tr>"; foreach ($object->getEntityKeys() as $key) { echo "<tr style=\"font-family: Calibri; " . "background-color: #CCFFFF\">"; echo "<td style=\"width=175pt\">" . $key . "*</td>"; echo "<td ><input size = \"125\" name=\"" . $key . "\" type=\"text\" /></td>"; echo "</tr>"; } echo "<tr>"; echo "<td colspan=\"2\" style=\"width=70\"><input id=\"btnAddLink\"" . " type=\"submit\" name=\"btnAddLink\" value=\"Save\"/></td>"; echo "</tr>"; echo "</form>"; echo "</table>"; }
/** * The constructor for VideoGameStoreEntities accepting service URI */ public function __construct($uri = "") { if (strlen($uri) == 0) { $uri = DEFAULT_ODATA_SERVICE_URL; } if (Utility::reverseFind($uri, '/') != strlen($uri) - 1) { $uri = $uri . '/'; } $this->_baseURI = $uri; parent::__construct($this->_baseURI); $this->_entities = array("Accessory", "Console", "Customer", "Game", "Product", "ProductType", "Purchase", "PurchaseItem", "Supplier", "sysdiagrams"); $this->_entitySet2Type = array("accessory" => "Accessory", "console" => "Console", "customer" => "Customer", "game" => "Game", "product" => "Product", "producttype" => "ProductType", "purchase" => "Purchase", "purchaseitem" => "PurchaseItem", "supplier" => "Supplier", "sysdiagrams" => "sysdiagrams"); $this->_entityType2Set = array("accessory" => "Accessory", "console" => "Console", "customer" => "Customer", "game" => "Game", "product" => "Product", "producttype" => "ProductType", "purchase" => "Purchase", "purchaseitem" => "PurchaseItem", "supplier" => "Supplier", "sysdiagrams" => "sysdiagrams"); $this->_association = array("FK_Accessory_Product" => array("Product" => "1", "Accessory" => "0..1"), "FK_Console_Product" => array("Product" => "1", "Console" => "0..1"), "FK_Purchase_Customer" => array("Customer" => "1", "Purchase" => "*"), "FK_Game_Product" => array("Product" => "1", "Game" => "0..1"), "FK_Product_ProductType" => array("ProductType" => "1", "Product" => "*"), "FK_Product_Supplier" => array("Supplier" => "0..1", "Product" => "*"), "FK_PurchaseItem_Product" => array("Product" => "1", "PurchaseItem" => "*"), "FK_PurchaseItem_Purchase" => array("Purchase" => "1", "PurchaseItem" => "*")); $this->_Accessory = new DataServiceQuery('/' . 'Accessory', $this); $this->_Console = new DataServiceQuery('/' . 'Console', $this); $this->_Customer = new DataServiceQuery('/' . 'Customer', $this); $this->_Game = new DataServiceQuery('/' . 'Game', $this); $this->_Product = new DataServiceQuery('/' . 'Product', $this); $this->_ProductType = new DataServiceQuery('/' . 'ProductType', $this); $this->_Purchase = new DataServiceQuery('/' . 'Purchase', $this); $this->_PurchaseItem = new DataServiceQuery('/' . 'PurchaseItem', $this); $this->_Supplier = new DataServiceQuery('/' . 'Supplier', $this); $this->_sysdiagrams = new DataServiceQuery('/' . 'sysdiagrams', $this); }
protected function GetRelatedLinks($links) { $relLinks = array(); foreach ($links as $link) { $feedNode = $link->getElementsByTagNameNS(self::$namespaces['default'], 'feed'); if ($feedNode->item(0) === NULL) { $relUri = self::GetAttribute($link, "href"); $index = Utility::reverseFind($relUri, '/'); $entityName = substr($relUri, $index + 1, strlen($relUri) - $index); $relLinks[$entityName] = $relUri; } } return $relLinks; }
/** * To update the EditLink and Identity of ResourceBox representing the $entity * using $location, Also update the IdentityToResource Dictionary. * [Note: Do not call this function from your application, it is used internally] * * @param EntityObject $entity * @param Uri $location * @throws InternalError */ public function AttachLocation($entity, $location) { if (array_key_exists($location, $this->IdentityToResource)) { unset($this->IdentityToResource[$location]); } $resourceBox = null; if (!$this->ObjectToResource->TryGetValue($entity, $resourceBox)) { throw new InternalError(Resource::AttachLocationFailedDescRetrieval); } $index = Utility::reverseFind($location, '/'); $editLink = substr($location, $index + 1, strlen($location) - $index); $resourceBox->Identity = $location; $resourceBox->EditLink = $editLink; $this->IdentityToResource[$location] = $resourceBox; }
/** * The constructor for NetflixCatalog accepting service URI */ public function __construct($uri = "") { if (strlen($uri) == 0) { $uri = DEFAULT_ODATA_SERVICE_URL; } if (Utility::reverseFind($uri, '/') != strlen($uri) - 1) { $uri = $uri . '/'; } $this->_baseURI = $uri; parent::__construct($this->_baseURI); $this->_entities = array("TitleAudioFormats", "TitleAwards", "Titles", "TitleScreenFormats", "Genres", "Languages", "People"); $this->_entitySet2Type = array("titleaudioformats" => "TitleAudioFormat", "titleawards" => "TitleAward", "titles" => "Title", "titlescreenformats" => "TitleScreenFormat", "genres" => "Genre", "languages" => "Language", "people" => "Person"); $this->_entityType2Set = array("titleaudioformat" => "TitleAudioFormats", "titleaward" => "TitleAwards", "title" => "Titles", "titlescreenformat" => "TitleScreenFormats", "genre" => "Genres", "language" => "Languages", "person" => "People"); $this->_association = array("FK_TitleAudioFormat_Title" => array("Titles" => "1", "TitleAudioFormats" => "*"), "FK_TitleAward_Title" => array("Titles" => "1", "TitleAwards" => "*"), "FK_TitleAward_Person" => array("People" => "0..1", "TitleAwards" => "*"), "FK_Title_Disc" => array("Titles" => "0..1", "Titles1" => "*"), "FK_Title_Movie" => array("Titles" => "0..1", "Titles1" => "*"), "FK_Title_Season" => array("Titles" => "0..1", "Titles1" => "*"), "FK_Title_Series" => array("Titles" => "0..1", "Titles1" => "*"), "FK_TitleScreenFormat_Title" => array("Titles" => "1", "TitleScreenFormats" => "*"), "TitleActors" => array("Titles" => "*", "People" => "*"), "TitleLanguages" => array("Titles" => "*", "Language" => "*"), "TitleDirectors" => array("Titles" => "*", "People" => "*"), "TitleGenres" => array("Titles" => "*", "Genres" => "*")); $this->_TitleAudioFormats = new DataServiceQuery('/' . 'TitleAudioFormats', $this); $this->_TitleAwards = new DataServiceQuery('/' . 'TitleAwards', $this); $this->_Titles = new DataServiceQuery('/' . 'Titles', $this); $this->_TitleScreenFormats = new DataServiceQuery('/' . 'TitleScreenFormats', $this); $this->_Genres = new DataServiceQuery('/' . 'Genres', $this); $this->_Languages = new DataServiceQuery('/' . 'Languages', $this); $this->_People = new DataServiceQuery('/' . 'People', $this); }