How can I access to the DAnnotation eoi of a Diagram (Elements of Interest) with M2DOC - m2doc

Using M2DOC with Sirius Services in CAPELLA workbench, I would like to identify among diagrams (only those not Contextual) which ones are related to other elements of the CAPELLA models.
For that I would like to access to the DAnnotation eoi (Elements of Interest) when I'm using the sirius service: "representationByDescriptionName".
How should I proceed? Is it possible from this Sirius service?
Thanks in advance.

Annotations seems to be added to the DReprestationDescriptor and not the DRepresentation itself.
You will need to create a Java service:
public DRepresentationDescriptor getDescriptor(DRepresentation representation) {
return new DRepresentationQuery(representation)getRepresentationDescriptor();
}
Then you can use it this way in your template:
{m:myDiagram.getDescriptor().eAnnotations->select(a | a.source = 'http://www.polarsys.org/capella/dannotation/ContextualElements').references}
You will have to change the URI to select "Elements of Interest".

Related

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

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).

Liferay - how to get assetentry subtype in velocity template?

my asset publisher is displaying two types of Web Content Article Subtype (asset publisher->configuration->asset selection->asset type->web content article subtype->select more than one...).
I need to get subtype of asset entry to create a right structure based on entry subtype, something like:
#if (!$entries.isEmpty())
#foreach ($curEntry in $entries)
$curEntry.getSubtype()
#end
#end
Is it possible?
Thanks.
You can use liferay services in VM like example in below link
http://www.liferay.com/community/wiki/-/wiki/Main/Access+to+Liferay+services+in+Velocity
Go through Asset Publisher Portlet -> configuration_dynamic.jsp it has the code which gets the subType you require i.e. Structure created in webcontent.
Other way to get the structure for webcontent is using DDMStructureLocalService it has getStructures() method where you can pass webcontent (i.e. journal class id)
Hope it gives you the direction to achieve what you are looking for.

Styling Google Map in Android

I think I know the answer to this, but can we style a Google Map v2? By style, I mean like using the Google Maps API Styled Map Wizard (http://gmaps-samples-v3.googlecode.com/svn/trunk/styledmaps/wizard/index.html) that can be used to pull JSON styling data for the JavaScript API.
Google seems to have pulled it off for Ingress, so hoping there's a way. I can't seem to find a way so I suspect Google is using inside knowledge for Ingress. Anyone know for sure?
To style your map, call GoogleMap.setMapStyle() passing a MapStyleOptions object that contains your style declarations in JSON format. You can load the JSON from a raw resource or a string,in you mapReady() function ... so after ading he json call your map ready function will almost look like
#Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
try {
// Customise the styling of the base map using a JSON object defined
// in a raw resource file.
boolean success = mMap.setMapStyle(
MapStyleOptions.loadRawResourceStyle(
this, R.raw.style_json));
if (!success) {
Log.e("MapsActivityRaw", "Style parsing failed.");
}
} catch (Resources.NotFoundException e) {
Log.e("MapsActivityRaw", "Can't find style.", e);
}
}
Define a raw resource in /res/raw/style_json.json, containing the JSON style declaration for night-mode styling
You could get the json from the following Link
https://mapstyle.withgoogle.com/
Yes, now u can declare a Json object to style ur map with GoogleMap.setMapStyle() function. Check the docs.
As per the Google Geo developer advocate Mano Marks, Ingress doesn't use Google Maps and at the current moment, unlike the Javascript API, Android API (via Google Play services) doesn't support styled maps although it does support titles (see TilesProvider etc).
I am hoping they bring the styled maps to Android (Google Play services) soon.
Google just released it a new google maps styling API:
https://developers.google.com/maps/documentation/android-api/styling
Use Maps Platform Styling Wizard to export standard styles json, you could also validate your style with import option as well - https://mapstyle.withgoogle.com/

Can a .NET oData DataService force filtering child records?

This should be a simple scenario - I have a data model with a parent/child relationship. For example's sake, let's say it's Orders and OrderDetails - 1 Order -> many OrderDetails.
I'd like to expose the model via oData using a standard DataService, but with a few limitations.
First, I should only see my Orders. That's simple enough using EntitySetRights.ReadSingle and a QueryInterceptor to make sure the order is in fact mine.
So far, so good! But how can the associated OrderDetail records be exposed in the oData feed in a way where I can read OrderDetails for a specific (read single) Order without giving access to the entire OrderDetails table?
In other words, I want to allow reading my details
myUrl.com/OrderService.svc/Orders(5)/OrderDetails <-- Good! My order is #5
but not everyone's details
myUrl.com/OrderService.svc/OrderDetails <-- Danger, Scarry, Keep Out!
Thanks for the help!
This is so called "containment" - your sample exactly described here: http://data.uservoice.com/forums/72027-wcf-data-services-feature-suggestions/suggestions/1012615-support-containment-hierarchical-models-in-odata?ref=title
WCF Data Services doesn't support this out of the box yet.
It is theoretically possible to implement such restriction with a custom LINQ provider. In your LINQ implementation you could detect the expansion (not that hard) and in that case allow it. But you could prevent queries to the entity set itself (also rather easy to recognize). For more details of how the LINQ expressions look plese refere to this series: http://blogs.msdn.com/b/vitek/archive/2010/02/25/data-services-expressions-part-1-intro.aspx
It depends on what provider you wanted to use originally. If you had a custom provider already this is not that hard. If you had a reflection based provider, it is possible to layer this on top. If you had EF, this might be rather tricky (not sure if it's even possible).

(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.