Enterprise Architect document template conditions like `if` and `else´ - if-statement

I'm working on my first Enterprise Architect custom document template to export our use cases considering the company design guidelines. Unfortunately, I am not able to print data based on certain conditions. E. g. hide fields with specific values or change their layout.
In my example or screenshot below I would like to hide {ElemScenario.Type} if the value is Basic Path, in example something like (I highlighted the position red):
if ({ElemScenario.Type} != "Basic Path") {
{ElemScenario.Type}
}
How can I change the document template in Enterprise Architect with certain conditions? Is it even possible?

You filter the content in the document options.
If you need only one type of scenario then you can do that in your main template, but you'll probably want to make three separate template fragments, each showing only one specific type of scenario.
See also my article Tutorial: Generate complex documents from Enterprise Architect with a two-step semi-automated approach for a complete example of a use case template.

Related

How do you make a report template for a single Enterprise Architect diagram?

I have a package with about 25 diagrams in it. I have used EA templates to make a package report that gives the name and notes for each diagram. However I want make a more specific report that can generates the report for just one diagram containing the description from each element in the diagram. Is this possible? It does not seem like diagrams have anywhere I can generate reports from.
UPDATE: I am currently trying to figure out how to do this with Document Options>Except where Query excludes Package:>Custom SQL but cannot get it. Here is my SQL statement:
SELECT t_diagram.ea_guid & t_diagram.Name AS [DesiredService-Hyperlink]
FROM t_diagram
WHERE t_diagram.Name = 'Diagram_Name'
I tried putting this in the Report's Custom SQL, that didn't work. Then I tried putting it in a fragment's Custom SQL with the following in the template itself
custom >
{DesiredService-Hyperlink}
< custom
This also did not work. I have been trying to go off of various documentation and YouTube Videos. If anyone could point me in the right direction that would be great.
Enterprise Architect document generation is based more on the model structure then on the diagrams.
The easiest approach would be to put each diagram in a different package or nested under a specific element, even if only temporary to generate the document.

Controlling custom code usage in camunda modeller

I intend to use Camunda for my product. While all camunda abilities match with my needs, i have a concern about camunda modeler controlled usage. Following are my needs in modeller
Is it possible to create custom domain specific tasks which i can simply drag-drop during modeling. It should be possible to define custom properties needed by this custom state
Can I somehow control/prevent use of custom java code/scripts by person modeling process. I want to restrict use of only my custom tasks, so that we don't end up with lot of scattered code across processes.
Can experts share views to achieve these targets?
Recently Camunda Modeler (I am using release 1.4.0, published on October 2016) has been extended to allow json template installation, which can meets all of your needs (if I understand them correctly), or at least the most of them.
You may find documentation for templates build here. The documentation is in progress, but what is already published I think it is quite clear. Briefly you have to
list all the elements you want to customise (user tasks, general tasks, service tasks, listeners, links and so on)
find out the json representation (explained in the short documentation) of each element
insert all the jsoned elements in a file (for example: myElements.json)
put the file in a specific modeler folder (see below)
close and restart the modeler
For example if you have installed the modeler in C:\Tools\camunda-modeler\, the folder to publish the file into will be C:\Tools\camunda-modeler\resources\element-templates (note that resources will be already present, but element-templates will not; it will have to be created).
If all will be right the modeler will start without any error and you will find a new dropdown list selector on the right panel (as stated in the documentation) for all the elements for which a template has been defined. Generally you have to classify each templates as either a user task, or a service task, or generic task and so on, so that when you want to use it you have to start from the generic element. For example, if you prepare in the json file 2 templates of kind of user task, say userTask1 and userTask2, if you want to insert in your new process userTask1 you have to
pick up an empty userTask
and choose from the element template selector on the right the voice userTask1, so that the empty user task becomes quickly the userTask1 (with all my custom properties with my default values)
that's it
To sum up, you may build templates with custom id and name (editable), with custom properties (editable or not, or even hidden), with eventual input/output parameters. So you may have default values properties and also tasks with simplified selections or without any selections at all.
You may find good starting examples to build your own templates at this GIT repository.
Hope that is enough to understand.

Sitecore - Different presentation details for same template

I will preface that this may not be the best use of a branch template, but it seems ok on paper, with a few drawbacks.
Sitecore 8, we have a Template called "Program." Program needs the ability to either be a two-column (9-3 grid) or a full (12-col grid). These basically represent a full version and a version with a right rail.
We want the content editors to be able to decide when they create the page whether they want a "program" or "program with right rail." To set this up, we created two branch templates. One that looks like this:
Layout: Base Layout
Renderings: Full (sublayout), Program Detail (rendering, dropped onto Full's placeholder)
And one that looks like this:
Layout: Base Layout
Renderings: Two-Column (sublayout), Program Detail (rendering, dropped onto Two-Column's placeholder)
Placeholder settings: Right Rail (allows right rail components to be added)
Then when the user right clicks on the "programs" item in the tree, they can pick one of the two options above and it creates the program item with the appropriate presentation details (again, either a full width or a two-col).
This all works, but the problem is if I ever have to change something on one of the branch templates, that change is not propagated to any items that were created based off of that branch like standard values works. There's no "branch delta" that I'm aware of.
Is there a better way to handle this? In my head, it essentially sounds like I need standard values for a branch template, but I don't think that exists.
Another thought I had was to create an "Program Master" template and then create two templates that inherit from it, Program and Program with Rail. That way they would share the same data but would have different standard values and allow me to set different presentation details for it. This feels a little dirty since I'd basically be creating a template to handle look and feel. I hope I'm explaining this correctly, but if not I'll update with more info if I'm being unclear.
Unfortunately if you want to take advantage of "layout deltas," out of the box you would need to have a separate template with its own standard values, as far as I'm aware.
You could probably do something fancy with the renderLayout pipeline if you wanted -- e.g. Sitecore Zen Garden introduces the concept of "Designs" which are used to define default layout, and allow you to separate layout from Standard Values. But you're going off the reservation at that point.

Ckeditor, let user insert into predefined elements in template

Using CKeditor is it possible to create a template, and only let users edit certain elements in it while keeping the structure intact?
For example a header, a subtext, a paragraph and list of items. But they mustn't delete any of these or add other elements.
The use case is that users have to create a bunch of documents that has to look a certain way. They aren't allowed to veer from the standard layouts.
Or is that use case beyond the scope of the editor?
I can't seem to find examples of this in their documentation.
The alternative could be to create custom forms in html on the left side of the page and simultaneously update a "read only" document on the right side of the page so that they can "preview" the final document in CKeditor.
Though just letting users edit a "locked" template would be a smoother experience.
-Thanks in Advance
Have a look at widgets. Online demo of a sample widget (explained in a tutorial) with predefined structure is available here: http://sdk.ckeditor.com/samples/simplebox.html

Stackoverflow like tag system form for django?

What I am trying to create is a site for resources. Basically, you add resources such as books and videos via links. Now, with any resource site that caters to a variety of resources, you need to tag them in order to understand what kind of resource you are using.
For example, if you make notes on something like Chemistry or key points from a talk on lets say "Django", then these are text documents. Thus you would want them inside a TEXT TAG.
So, when you are making a form for this kind of thing, what form field would you use? For example, by knee-jerk approach is to simple make a text area field, and then separate the different tags via comma. Now, this can be prone to many problems, I'd just like to know what is the best approach to take to solving this problem? Basically, an easy way to validate the data input? Would forms.ChoiceField be the best approach to the problem or is there something else that is superior?
https://www.djangopackages.com/grids/g/tagging/ is your best bet, most specifically https://github.com/alex/django-taggit. If you want to run your own tagging system, take a look at the source code for some ideas.
EDIT: The easiest way to display this in a form would be to use a ModelMultipleChoiceField. This allows you to select multiple tags for a single resource, and handles server-side validation and conversion to the actual Tag instances. However, I think most people would agree this option looks hideous, and it is certainly not user-friendly if there is a large amount of possible tags.
If you're using jQUery, another option is to use Django_select2. This is what I have personally used in a similar situation, and it handles a large amount of possible tags very well. Django_select2 is a thin wrapper around jQuery's Select2 plugin, with a bit of added functionality (most notably the AutoView and AutoModelSelect2Field). This provides a hybrid between a text field and a select list, allowing you to search all tags and easily select multiple tags. See http://ivaynberg.github.io/select2/ for examples of what you can achieve.