On my project I have publication and page metadata which is being consumed in the view. For example, my page metadata looks something like this in the view:
#model DD4T.ContentModel.IPage
....
#if (Model.MetadataFields.ContainsKey("browserTitle")) {
<title>#Model.MetadataFields["browserTitle"].Value</title>
}
Is there a corresponding way to access the page's publication metadata?
I do see that the IPage model has Publication.Id available but I'm unsure of how to use it to retrieve publication metadata?
Thanks
Publication metadata is not available in the DD4T object model. The work-around is to create a DD4T template class in .NET which reads the metadata from the publication and stores it in the page. In the web app you can retrieve the information from the page metadata.
There is a template class in DD4T called 'Add inherited metadata to page', which does the same for structure group metadata (not publication metadata). You can check out the source and use this as a starting point.
Related
I have below PostDetail Model defined
from wagtail.core.models import Page
class PostDetail(Page):
template = "Post_Detail.html"
body = RichTextField(blank=True)
After python manage.py migrate, when I examine the database table of PostDetail, I only see 2 columns (attributes) and did not see all those attributes (title / owner / first_published_at etc according to the source code here.) which are supposed to be inherited from Page model.
Anything I missed out or did wrong ?
Wagtail's Page model uses multi-table inheritance - the shared fields from the base class are stored in a record on the wagtailcore_page table, while the fields specific to a subclass are in a separate table with a link back to the base wagtailcore_page record.
Having all of the 'core' fields in a single table makes it possible to retrieve (for example) the child pages of a given page, without having to search in every table for every possible page type.
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 ...
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
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.
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.