Can I reference an external database as the properties of a model in viewer? - database

I'm attempting to create an instance of the Forge-viewer API to reference an outside database (Homemade, not bim360 or Fusion) as the Properties of an object selected. (i.e. the database parameters fill-in the properties window) However, I'm unable to find a method. What do you recommend?

The best place to start would be the below code samples:
https://forge.autodesk.com/blog/adding-custom-properties-property-panel
https://github.com/yiskang/forge-au-sample/tree/master/properties
https://github.com/Autodesk-Forge/forge-rcdb.nodejs //interaction with custom data source and many data centric plugins
Basically you will need to customize the model property panel and feed in your own data source by extending Autodesk.Viewing.Extensions.ViewerPropertyPanel and setProperties/setNodeProperties ...

Related

Difference between DataControl.cpx and Datacontrol.dcx in Oracle ADF

In Oracle ADF what is the difference between DataControl.dcx and DataControl.cpx ? What goes where ?
Check out the doc at A.7 DataBindings.cpx
Databindings.cpx- Data Binding Registry
Jdeveloper Creates this first time when you data bind a UI Component
It has
pageMap maps all user interface URLs and the corresponding page definition usage name. This map is used at runtime to map a URL to its page definition.
pageDefinitionUsages maps a page definition usage (BindingContainer instance) name to the corresponding page definition. The id attribute represents the usage ID. The path attribute represents the full path to the pagedefinition.
dataControlUsages declares a list of data control usages (shortnames)corresponding path to the data control definition entries is available in datacontrols.dcx file
Datacontrols.dcx -Data Controls Registry
Lists ADF Data control available in a project
It Contains Information needed to initialize the data control to work with. a particular service (Java bean web service ,EJB) J developer Creates this file when you create a data control . This file is not generated for Oracle ADF Business Components

How to get the name of the DataSource referenced by my shared DataSet?

I would like to display the name of the data source used in my report, as a way to quickly identify the origin of the data.
I know I can display the name of an embedded datasource like this :
=DataSource("name").DataSourceReferenceString
However my report does not embed a datasource as I am using shared datasets.
Any ideas ? Am I "doing it wrong" ?
EDIT : The answers so far involve using the DataSources collection. The thing is... my report does not reference any data source whatsoever. It does reference a shared dataset, which itself references a data source.
This approach allows me to change the data source of all my reports by editing the shared dataset. But I'm always open to better ideas.
This might help u .It Represents the collection of data sources referenced from within the body of a report
DataSources("name").Type
For detail explanation you can go through the link Using Global Collections in Expressions (Reporting Services)
An expression like =DataSources!DataSource1.DataSourceReference returns a string value representing the name of a shared data source when applicable. If the data source in the expression is an embedded data source, the expression returns an empty string.

Lazy-loading large/complex model properties in Google App Engine

Let's say I'm modeling a website where a web page would be represented by a PageModel, like so:
class PageModel(db.Model):
name = db.StringProperty()
parentPage = db.SelfReferenceProperty()
content = db.TextProperty()
I'd like to be able to pull a list of all my page objects, in order to render menus, etc., but without having to pull in the content for all the items. How would you model this object so that you could pull in the content only when you needed it? Would it require a 1-to-1 reference relationship with a separate 'content' model? And if so, would you make the reference on the page object or on the content object?
You could move the content property into a new model (PageContentModel). I would implement the reference by having the parent of the PageContentModel be the PageModel (using the parent property of db.Model). This allows you to modify both of them in a single transaction (as they are in a single entity group).
One benefit of modeling things with the PageContentModel having a reference to the PageModel (as opposed to the PageModel having a reference to the PageContentModel) is that if you ever need content to be larger than 1MB you can do so by allowing each PageModel to have 1 or more PageContentModel objects and you would just split your content into 1MB chunks and write each chunk to a different PageContentModel instance. To be able to get the content back you would need the PageContentModel objects to have an "order" property associated with them so you can re-build your content in the correct order.
To query for the PageContentModel instances related to a PageModel you would use the ancestor filter like this:
PageContentModel.all().ancestor(page_model_instance)
As suggested by #Nick another way to do this would be to use the files api to write the content to a blob in the blobstore and then link that blob to the PageModel by having a BlobReferenceProperty on the PageModel. I have now had a chance to try this and it is working pretty well (despite it being an experimental feature). This would allow your content to be very large and, under the new pricing model, is actually cheaper than storing your content inside the datastore model.
Updated Feb 7, 2012 to include suggestion from #Nick about the blobstore.

yii framework models database access object

I want to use the database access objects to access a table in my database instead of doing active record since that takes a long time to load. if I use database access objets instead (calling createCommand, query, execute, etc), do i still need to create a model class for the table? if so what would be the parent class of this model class? My goal is to access/edit the table values using yii database access objects. I'm using YII FRAMEWORK. Or is it best to use a component? If so, when do you usually have to use components? I don't understand what components are for....
No, you can create a generic class which has a member property of a CDbConnection. For that matter, you can just use CDbConnection, but you might end up creating a lot of connections that way.
class Foo
{
private $conn;
function __construct(){ $this->conn =
new CDbConnection($dsn,$username,$password); }
function runQuery($sql) {
$command=$connection->createCommand($sqlStatement);
return $command->query();
}
}
If you have your database settings in your config/main.php file, you can also do:
$command = Yii::app()->db->createCommand($sql);
$result = $command->queryAll();
and if you need to reset the command:
$command = false;
If you create a custom class, you don't need to reference a Model or extend an existing class, your connection will use CDbConnection (by using the method above or calling it directly in your connection statement).
this page has pretty clear info on Yii's DAO.
As far as components go, they can mean different things - there are Yii's "core components", which are things like urlManager, user, db, etc. and can have their default properties set in the config/main.php file. Then there is the "components" directory which can be configured to autoload classes and "contains components (e.g. helpers, widgets) that are only used by this application." So you can put custom classes in there that you want available throughout your app.
Components are used to make widgets.which is available through out the app.

Silverlight / .NET RIA Services - Exposing a custom property to the client

I have a table in my database called "Task". Task has the following fields:
- ID
- Description
- AssignedUserID
- TaskTypeID
I am accessing this table through a class that was created automatically after I used an ADO.NET Entity Data Model. I can load and show the fields mentioned above in a DataGrid in my Silverlight application. However, AssignedUserID and TaskTypeID are not very descriptive. So I decided to create a stored procedure that gets the tasks and the user and task type names through their respective lookup tables. This is where the problem lies.
I want to create some custom properties in the automatically generated "Task" class. The custom properties would be named "AssignedUserName" and "TaskType". I then want to make these properties available to my Silverlight client. However, I cannot seem to figure out how to get them exposed to my Silverlight client.
Can someone help?
Thank you
If your EDM is in the same project as the DomainService you can do this:
create a partial class on the Entity type, and add your calculated property in there.
name the file **.shared.cs
it will then be auto-shared with the client/Silverlight code.
Edit:
I was assuming that you could do this calculation in app logic rather than use an sp, which seems more straightforward to me.
If you do use an SP, you'll need to use the Function Import feature in the designer to map the SP to a function in the EDM. This function can then return entities, with properties mapped however you like.
An easier way would be to just use the object model: Have Task.AssignedUser and Task.TaskType objects off of your Task class. Map these to lookup tables in your db. This will work out-of-the box (assuming the Id's are FK's to those lookup tables).
So, a couple options:
use app-logic--properties in a partial class to return the descriptions
use the object model driven by FKs to lookup tables, then just access Task.AssignedUser.Name or Task.TaskType.Description
use a function import to access the SP and map the returned values to entity properties
1 or 2 being the best options IMHO.
Another approach might be to update your EF model to include the lookup tables, add Associations between the tables, add [Include]s in the (auto-gen'd) metadata class and let EF and RIA do it for you. Maybe.

Resources