EA Script for Defined Tag Types - automation

I would like to create an EA Script to configure (add/edit/delete) the Defined Tag Types (Settings > UML Types > Tagged Value Types) similar to what is done manually here.
I did not found any useful information about the object storing the Defined Tag Types. Any help?

This configuration is not available in EA's API. If you want to make changes to it programmatically, you'll have to manipulate the project database directly.
The "Tagged Value Types" are stored in the t_propertytypes table. Please note that tagged value types defined in an MDG Technology are not listed here, this table only contains those that are shown in the "UML Types" dialog.

Looks like that you can programmatically only read the Tagged Values and change their value. Apparently you cannot add/remove Tagged Values.
Here is a part of the corresponding API. To add/remove a tagged value, you have to go directly to the DB.
TaggedValue Methods:
Method
Type
Notes
GetAttribute(string propName)
String
Returns the text of a single named property within a structured Tagged Value.
Parameters:
· propName: String - the name of the property for which the text is being returned
GetLastError()
String
Returns a string value describing the most recent error that occurred in relation to this object.
HasAttributes()
Boolean
Returns true if the Tagged Value is a structured Tagged Value with one or more properties.
SetAttribute(
string propName,
string propValue)
Boolean
Sets the text of a single named property within a structured Tagged Value.
Parameters:
· propName: String - - the name of the property for which the text is being set
· propValue: the value of the property
Update()
Boolean
Updates the current TaggedValue object after modification or appending a new item.
If false is returned, check the GetLastError function for more information.

Related

Does OpenAPI allow a $ref to a _specific_ enum value? [duplicate]

This question already has an answer here:
Reusing a subset of an enum in OpenAPI (Swagger)
(1 answer)
Closed 2 years ago.
Let's say in my OpenAPI v3 description, I have the following /componenets/schemas entry (using YAML) format:
WidgetTypes:
type: string
enum:
- WIDGET_A
- WIDGET_B
- WIDGET_C
The WidgetTypes schema is thus a named (i.e. value $ref) enum 'class'. In various other places in the API spec, we can now refer to these enum values, e.g. perhaps there's an API path for which one of the path elements must come from the WidgetTypes set.
Now, I have also some additional schemas (i.e. object data models), and there might be a case where a specific WidgetType value is a constant for that object type. An example:
MySpecificWidgetA:
type: object
properties:
someField1:
type: string
someField2:
type: number
widgetType:
type: string
enum:
- WIDGET_A
This feels like the naïve way to accomplish this, since now MySpecificWidgetA's widgetType field is a string that comes from the set of possible WidgetType's, but there's no actual reference to WidgetType enforcing this.
In spirit, what I'd like to assert is that MySpecificWidgetA.widgetType is a specific value from the WidgetType enum schema (in this case WIDGET_A).
Using just $ref: '#/components/schemas/WidgetType' passes validation, but doesn't accomplish what I want: it states widgetType is simply a value coming from that set ... I want it to be a restricted value from that set (i.e. a constant).
I've tried experimenting with $ref a few other ways for the value of widgetType, including (without success):
$ref: '#/components/schemas/WidgetType/WIDGET_A'
$ref: '#/components/schemas/WidgetType/enum/WIDGET_A'
$ref: '#/components/schemas/WidgetType/enum/0'
(the last one being not very useful, but just testing out the exact JSON Pointer format that $ref uses.)
None of these attempts above pass the OpenAPI v3 validation ... does anyone know if it's possible to reference (via $ref or some other mechanism) a specific value from a defined enum schema element?
This is not allowed by JSON Schema. $ref is only allowed to resolved to other schema objects, not to individual data points.

Illegal characters in OrientDB graph for property-type string

I use the graph version of OrientDB. Now I created a schema-less class, where I want to index a variable. This variable needs to become a property first. But when I try to create this property - of type string (or binary, or whatever) - it responds:
com.orientechnologies.orient.core.exception.OSchemaException: The database contains some schema-less data in the property 'clazz.clazz_name' that is not compatible with the type STRING. Fix those records and change the schema again [ONetworkProtocolHttpDb]
So I need to fix something, but what? What characters are illegal for a variable to become a property so that it can be indexed? (BTW, lists are also not an option)
There was indeed a problem I created.
I created a super-class where the property had to be created. One of the sub-classes inserted a List instead of a String. So when querying all vertices of sub-type
final Iterable<Vertex> iterable = this.graph.getVerticesOfClass("clazz");
I printed all types of clazz_name by vertex.getProperty("clazz_name").getClass().getName() where I saw OLinkedList. Reinserting those vertices fixed my problem.

.NET Obfuscation [SmartAssembly]

Just a quick question in relation to SmartAssembly and .NET applications. - I am experimenting with the software at the moment and it seems to be obfuscating code but My.Settings is still visible in plain text?
So previous to obfucating my code (using .NET reflector) I could literally see almost everything. Including the My.Settings class containing lots of info such as passwords, ip's, MySQL connection strings etc..
So I obfuscated the code using RedGate's SmartAssembly and sure enough all the classes/functions etc appeared with random symbols, however several items (again including My.Settings) remained untouched?
SmartAssembly Screenshot
Obfuscated result in .NET reflector
There are limitations to what most obfuscation tools can do, and this is one of them. Settings values are not stored as string literals or in backing fields, but as an attribute value:
Global.System.Configuration.DefaultSettingValueAttribute("bar")> _
Public Property Foo() As String
Get
Return CType(Me("Foo"), String)
End Get
Set(value As String)
Me("Foo") = value
End Set
End Property
VB/VS generates the Property getter/setter, but as you can see it uses an attribute to store the initial value as opposed to:
Private _foo As String = "bar"
In most cases there is no reason to hide the string content used in Attributes because they are usually instructions to the compiler about the class or property:
<Description("Bar String")>
<DefaultValue("bar")>
<DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)>
Property BarString As String
None of these Attribute literals needs to be hidden because most Attributes contains neither runtime data nor sensitive information. As a result, My.Settings is a fringe case and is the result of how it is implemented. Note that this only applies to the default, initial values you enter in the IDE. If you update them at runtime, they are not written back to the Attributes, but saved to a file.
Since you have a trivial number of settings there, just write a small class to manage them yourself and save to a file in Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)

Is it possible to override the vb.net Resource Manager GetString function?

In the auto-generated resource designer file, there are properties for each resource. The property calls "GetString" which returns the string value. I would like to override this getstring function so I can do logic to see if I need to retrieve this value or a different value. I can't figure out how to do this because the designer file is auto-generated.
Public ReadOnly Property General() As String
Get
Return ResourceManager.GetString("General", resourceCulture)
End Get
End Property
For example, in my version of the GetString function, I would check the key passed in ("General") and see if there is a custom value for this key in a database. If the custom value exists, I would use that value. If the custom value does not exist, I would call the base GetString function to get the Resource value. I'd like to use the built in Resource class for this because then in my code I can just use "#Resources.General" and take advantage of the auto-complete functionality that already exists.
Refer to ASP.NET Resourcemanager to read local .resx. It's in C# but you can just convert it over. It isn't 100% of what you are looking for but shows a way of overriding in which you may be able to adjust to work with your needs.

Concrete form bean for html select

I have used <html:select> in one of my jsp pages with multiple selection. What varibles, for storing the selection, should i have in the form bean associated with this list?
Straight from the documentation:
This tag operates in two modes, depending upon the state of the
multiple attribute, which affects the data type of the associated
property you should use:
multiple="true" IS NOT selected - The corresponding property should be a scalar value of any supported data type.
multiple="true" IS selected - The corresponding property should be an array of any supported data type.
(emphasis mine)