How to extract Markup relation with Teamcenter C++ API? - c++

In Teamcenter I have a dataset that contains two inner datasets:
A "Good ds" dataset with an External Proxy relation.
A "Bad ds" dataset with Markup(s) relation
I'm trying to enumerate server content using the Teamcenter C++ API. The object for the "Good ds" dataset is returned as expected by call to get_IMAN_external_object_link() from the Teamcenter::Soa::Client::Model::Dataset class.
How could I get an object for the "Bad ds" dataset with Markup relation?
Documentation for the API is very poor. I've tried each of these methods in the Dataset class that returns a ModelObjectVector but with no luck:
get_DgtSignatureByUserRelation
get_external_apps
get_fnd0complying_objects
get_fnd0defining_objects
get_Fnd0DiagramSnapshot
get_Fnd0DiagramTmplRelation
get_Fnd0Diagram_Attaches
get_fnd0FileAccessAuditLogs
get_fnd0GeneralAuditLogs
get_fnd0LicenseExportAuditLogs
get_Fnd0ShapeRelation
get_fnd0WorkflowAuditLogs
get_FND_TraceLink
get_IMAN_based_on
get_IMAN_Rendering
get_license_list
get_process_stage_list
get_release_statuses
get_revisions_prop
Teamcenter server version is 10.1 (20130604.00).

I believe you need to write a custom SOA (Service Oriented Architecture) API to to fulfill this particular need.
You to have the BMIDE (Business Modeler IDE). In it you need to create a new BMIDE template and setup the project appropriately.
Go to Advanced mode -> Extensions tab-> **Code -> Libraries -> create new SOA library (names may be inaccurate).
Now add custom service. Write ITK (Integrated Toolkit) code to fetch the information you need.
Then install this template to Teamcenter through TEM (Teamcenter Environment Manager).
Now you can call this API through your Client whether it is RAC (Remote Access Client) or any UI Client.
Let me know if something is not clear.
Alternatively, you can look for methods that exist for all the ModelObjects. You should look for a Relation Property and fetch the target from it using the API whose return type should be ModelObject/array of ModelObject (I don't know what exactly to look for).

Related

Using great expectations with streamed data

I am using great expectations to test streaming data (I collect a sample into a batch and test the batch). The issue is I cannot use the docs because this will results in 100 of 1000s of html pages being generated. What I would like to do is use my api to generate the page requested from the json result when the specific test results are clicked on (via the index page). Is great expectations able to generate only 1 html which can be disposed of when it is closed?
If you are using a ValidationOperator / Checkpoint, then using the UpdateDataDocsAction action supports only building the resources that were validated in that run, and is the recommended approach.
If you are interacting directly with the DataContext API, then the build_data_docs method on DataContext supports a resource identifier option that you can use to request only a single asset is built. I think to get the behavior you're looking for (a truly ephemeral build of just that page), you'd want to pair that with a site configuration for a site in a temporary location, e.g. /tmp.
The docs on the build_data_docs method are here:
https://docs.greatexpectations.io/en/latest/autoapi/great_expectations/data_context/data_context/index.html#great_expectations.data_context.data_context.BaseDataContext.build_data_docs
Note that the resource_identifiers parameter requires, e.g. a ValidationResultIdentifier object, such as:
context.build_data_docs("local_site", resource_identifiers=[ValidationResultIdentifier(
run_id="20201203T182816.362147Z",
expectation_suite_identifier=ExpectationSuiteIdentifier("foo"),
batch_identifier="b739515cf1c461d67b4e56d27f3bfd02",
)])

Ember JS for SCORM Compliance

Is there any references that explain how to make Ember JS Learning Content that will be used in the LMS (SCORM Compliance). I've already tried to ember build and put the imsmanifest.xml on the root folder(/dist). When I upload all the /dist folder's content to the LMS (cloud.scorm.com), the Ember JS app is not shown.
Is there any suggestion to make learning content using SCORM Compliance and Ember JS? I will use SCORM 2004 4th Edition. Thank you very much.
You have a couple options -
Is this untracked? Within the imsmanifest.xml you would label it's resource scormType as 'asset' or 'sco'. Hint: If you have no SCORM communication included within your EmberJS content, then its a asset.
If its tracked, you should set its resource scormType as "sco". This imply's your content is doing base things like Initializing and Terminating with the SCORM Runtime API (which in SCORM 2004 is the API_1484_11).
Example: https://github.com/cybercussion/SCOBot/blob/master/imsmanifest.xml
If this is the first time your hearing about the API, you'll need to consider what your goals are. Commonly curriculum will identify what data points are acceptable within your Shareable Content Object. You must Initialize and Terminate at minimum, but if you opt to track Score, Progress, Completion Status you'll need to integrate that into your existing work.
There are free JavaScript libraries available for interacting with the SCORM Runtime API. These will be called "SCORM Wrappers", "SCORM Content API" and there job is to locate the API_1484_11, and then begin to make Initialize, GetValue/SetValue, Terminate calls as needed. These libraries will range in features and functionality since the SCORM spec has been around since 2001+ and then enhanced in 2004.

Set a version to a SQLite database file

I have a C++ application that stores data in a database (SQLite) through QxOrm.
It is clear that in the next versions, columns are gonna be added/removed/renamed, so I would like to set a version number to each database created, so that when someone tries to load a database it compares its version with the current version of the application and automatically add/remove/rename the columns to match the current schema.
I couldn't find in the QxOrm documentation something that would look like:
qx::QxSqlDatabase::getSingleton()->setVersion(2);
So first is it possible to do that kind of thing with SQLite? and if not should I just create a table that would hold the database version?
A database version is perhaps not enough : you should store a version per persistent class (and maybe other informations per persistent class, like list of columns for example).
When you register a persistent class into QxOrm context, you have to put a version number :
QX_REGISTER_HPP_XXX(myClass, myBaseClass, myClassVersion)
You can find some informations about creating a SQL schema into the FAQ of QxOrm library :
http://www.qxorm.com/qxorm_en/faq.html#faq_230
Using introspection engine of QxOrm library, it's quite easy to do, more details about introspection engine here :
http://www.qxorm.com/qxorm_en/faq.html#faq_190
You should create a table into your database to store a state for each persistents classes : you can store a version number per class, a list of columns, etc... Then it will be quite easy to compare 2 versions of persistent class to modify your SQL schema.
Now, you have QxEntityEditor application to manage your database schema evolution.
QxEntityEditor is a multi-platform and cross-database graphic editor for QxOrm library.
A video presentation of QxEntityEditor features is available here : http://www.qxorm.com/qxorm_en/tutorial_4.html

Retrieving Enterprise Project Types using Project Server Interface

I am currently building an app to programatically create projects in Microsoft Project Server using the web services exposed through the Project Server Interface (PSI).
I am able to create a project with an Enterprise Project Type using the QueueCreateProject method, however, I need to specify the GUID of the EPT which I don't want to hard code into the code.
Is there another web service or way to get the GUID of a specific EPT found by its name?
Also, can the same be done for custom fields in the same way?
I think what you're looking for is PSI Filter parameters. Check out this post for an example of retrieving the Guid of a custom field.
Really, I think the key is setting the filter criteria:
cfFilter.Criteria = new PSLibrary.Filter.FieldOperator(equal, nameColumn, customFieldName);
Where nameColumn is cfDataSet.CustomFields.MD_PROP_NAMEColumn.ColumnName and customFieldName is a value you pass in.
If you are like me, you want to do this for a lot of fields. I used a filter to query all the field names and MD_PROP_UID's and then just put it in a hashtable so I don't have to keep making PSI calls.
Disclaimer: I use 2007 but I'm assuming it is mostly the same for custom fields (not for the EPT part which I didn't include).
Here is an answer: https://stackoverflow.com/a/12267251/1594383
In short: the methods are available from Workflow service.

(Java) How can I pass Schema-validated XML documents as parameters between distributed components (e.g. web services or sockets)?

Here is a description of the scenario and I would appreciate also any comments on the approach used
The core of my application is a set of web services backed by a P2P database. One service accepts a simple XML-based record (I have designed a generic schema for it). The service processes this data (mainly creating keys based on certain criteria) and pass the original data along with the created keys to a listening SocketServer in one of the listening P2P nodes. This key,data pair is routed to the proper node, which stores the data (associated with the key as an ID) in an XML database.
A second service accepts a query document that is structured based on the same schema, but with optional values that would be used for searching and matching from the previously stored ones. So the second service would pass this query (with the proper keys) to the P2P part, get back the results and pass them back to the service client.
E.g. if the original record submitted to the first service was < attr1 >value1 < /attr1 > < attr2 > value2 < / attr2 > (attribute list along with some other metadata mandated by the schema) then the second service should retrieve that record if the query received was < attr2 >value2 < / attr2 >
(I could later think about using more complex XPath or XQuery queries as the underlying XML database allows instead of exact matches for values here but that is not important at this stage. there is also a third service I am working on but it depends on getting the first two in proper shape first)
So my questions are:
1) What data type should I use as the parameters of the web services? How to utilize my schema for this usage? I was considering various XML binding frameworks (especially JAXB and SDO) for this but didn't know how to proceed.
2) How can I enhance the two services (call them store and search) to use dynamically created templates based on the original generic schema? The service would still accept documents of the main schema type but has the inner attribute list based on a template say template1 only requires whose values are ints while template2 require (float) and (string). The current JSP-based prototype manually creates this template but as an XML document that is assembled by hand (<>tags dispersed in text) and there is no type checking what so ever so I thought I could do better!
3) Is it possible to generate a quick web app prototype for simple access to this system (again by using the schema (&templates) to edit the appropriate XML message structures? What I am looking for is for the (human) user to choose a template and then just "fill in the blanks" and submit, no need for any fancy look and feel.
4) Can I or how can I also use this XML message type for communicating across sockets?
5) Does it matter if I deploy the services as stateless EJBs or not? Do I need them to be EJBs or servlets would be more than enough?
I currently have a rudimentary implementation (from previous developers) that were meant for a subset of my current requirements (I am improving on the services and adding new derived ones) but there was no schema nor validation and the data is passed all along as basic strings, thus providing weak typing and difficult to update manual parsing. The reason I want to update this to a stronger bound typing is to introduce changes in the data schema that would be passed along the whole system easily. Basically I want the system to be as less coupled to the data format/schema used as possible; the current prototype is too coupled to the data that I am finding it extremely difficult to change the data without breaking the system.
My initial investigation led me to consider JAXB but it supports only static typing (cannot create a schema/types dynamically at runtime that I want to persist for later usage). So I came across SDO which has both dynamic and static typing. The problem is just that there is not enough community and/or examples of using this approach so it seems risky (the examples of Apache Tuscany and Eclipselink implementations are very scarce and I could not find complete examples that are not 5+ years old (like this http://www.ibm.com/developerworks/java/library/j-sdo/) and also tackles the XML use case of SDO (most seem to focus on the relational usage of SDO).
This is my first time asking for programming help (here and elsewhere) so please bear with me. I searched a lot on the net but I could not find anything useful but pieces here and there that did not add up.
Any comment or hint is really appreciated.
trfndr
EDIT
I forgot one thing: how would the search service get back the results? Since it is opening a client socket connection, there is no way to get back any results synchronously. The current implementation tackles this by having the service client opening a listening socket on a random port and putting this contact info in the query document. After the search web service sends the query to the p2p part it finishes. The p2p sends the results as a WS call to another service which sends them back to the service client socket. I don't like this approach much, is there any more elegant solution?
I lead the EclipseLink JAXB & SDO implementations and represent Oracle on those specifications so hopefully I can help you out. This question is very similar to talk I'm giving at JavaOne in September.
1) What data type should I use as the
parameters of the web services? How to
utilize my schema for this usage? I
was considering various XML binding
frameworks (especially JAXB and SDO)
for this but didn't know how to
proceed.
This depend's on what web service framework you are using. JAXB is much easier to use with JAX-WS, and while JAXB is still easier to use with JAX-RS SDO, is a possible alternative.
2) How can I enhance the two services
(call them store and search) to use
dynamically created templates based on
the original generic schema? The
service would still accept documents
of the main schema type but has the
inner attribute list based on a
template say template1 only requires
whose values are ints while template2
require (float) and (string). The
current JSP-based prototype manually
creates this template but as an XML
document that is assembled by hand
(<>tags dispersed in text) and there
is no type checking what so ever so I
thought I could do better!
I'm not 100% what you mean here, but the following may be helpful:
Using #XmlAnyElement to Build a Generic Message
3) Is it possible to generate a quick
web app prototype for simple access to
this system (again by using the schema
(&templates) to edit the appropriate
XML message structures? What I am
looking for is for the (human) user to
choose a template and then just "fill
in the blanks" and submit, no need for
any fancy look and feel.
JAX-RS is a nice framework for creating quick prototypes. Below is an example I created:
Part 1 - The Database
Part 2 - Mapping the Database to Objects
Part 3 - Mapping the Objects to XML
Part 4 - The RESTful Service
Part 5 - The Client
4) Can I or how can I also use this
XML message type for communicating
across sockets?
I prefer frameworks like JAX-RS that communicate over the HTTP protocol.
5) Does it matter if I deploy the
services as stateless EJBs or not? Do
I need them to be EJBs or servlets
would be more than enough?
My preference is to use an EJB session bean for the service. If you are interacting with a database then you can leverage the Java Transaction API (JTA) to manage your database transactions.
Part 4 - The RESTful Service
SDO
EclipseLink is the SDO 2.1.1 (JSR-235) reference implementation. We have some examples posted below. If you are looking how to do something specific, I will try to post a relevant example.
http://wiki.eclipse.org/EclipseLink/Examples/SDO
JAXB
JAXB is static. It is also more popular than SDO. Recognizing this in EclipseLink we have implemented a dynamic JAXB feature. It gives you the dynamic aspect of SDO with a JAXB slant.
http://wiki.eclipse.org/EclipseLink/Examples/MOXy/Dynamic
EDIT #1
Since you are dealing with JAX-WS and your model is almost entirely dynamic, I think you should skip the JAXB binding altogether. In the following link see the section "Switching Off Data Binding"
http://java.sun.com/developer/technicalArticles/xml/jaxrpcpatterns3/
This will give us the body of the message as a javax.xml.transform.Source object. We will need to process the XML based on the dynamic templates. SDO would be a good choice here. You can constantly add new types to the HelperContext using XML schemas.
helperContext.getXSDHelper().define(schema1, null);
helperContext.getXSDHelper().define(schema2, null);
You wil be able to unmarshal the Source from the web service as follows:
XMLDocument doc = helperContext.getXMLHelper().load(source, null, null);
DataObject rootDataObject = doc.getRootObject();
String someValue = rootDataObject.getString("attr3/childAttr/anotherChildAttr");
You will also be able to use the XMLHelper to marshal your objects to XML when calling another service.