I have to create a class diagram for a tree structure of a filesystem.
I have directory/folder named myfolder. In that folder I have two files: file1 and file2. file1 will be there forever so I have a composition between file1 and myfolder. On the other hand file2 will appear and disappear because it is a product of compiled file1. When I tell the build file to clean the target file2 disappears.
What connection should I use between myfolder and file2?
What connection should I use between file1 and file2?
Thank you.
I am using a deployment diagram for that. To symbolize a folder I use a package stereotyped as <<folder>> and for file simple artifacts like this:
Of course this will only show a static configuration. Dynamic behavior will be caused by some object interaction for which you can use sequence diagrams. Or use informal notes/constraints.
The Class diagram does not work with the objects themselves, but with the classes. (You CAN use objects in it, but their use is not the theme of this diagram normally)
Of course, you can add many fields to the File, such as name, Date and so on, but the bulk is here.
If you want to show the concrete structure of dependency of objects, use Object diagram instead:
These connections with crosses in circles mean containment.
BTW, you can show the package on the class diagram, too, and not include classes rectangles into the package rectangle, but connect them with containment relationship, too, if you wish. But notice, packages tell us not about the product that the client get, but about organization of your classes in your source code. Usually package diagram tells about that, but you can show it on the class diagram, too.
Composition means that item belongs only to the collection in a natural way and can't belong to any other. But it is for classes, not objects.
The fact of appearing and disappearing of something can not be shown in the structure diagrams, such as Deployment, Component, Package, Class and Object. You should use interactions diagrams for that - State, Sequence, Activity, Timing.
But, hooray! There is always such thing as a comment. You can put comments on both containment connections and simply write in them, that one is forever, and the other one appears and disappears.
As for relationship between file1 and file2 use Dependency arrow with text explanation on it.
Related
I am using Sparx Enterprise Architect and am somehow confused that I did not find any hint on the internet regarding the following question: How can I show the programming language of a component in the component diagram?
It is clear to me that I could use custom stereotypes but this is not a good idea as it prevents me from using "real" stereotypes later on.
The reason is simply that you can not show it using EA's GUI. You would need to stereotype the element and come up with a shape script to display the language with a
print("#language#");
somewhere.
To assign a shape script to a stereotype there are two ways, the quick and dirty and the difficult one. Here's the q&d one:
Under Configure/UML Types you can add a new 'wild' stereotype. That is one with no profile. EA will show that as <none> when applied. Think of a fitting name and choose Edit with the shape script:
Here can enter the new shape script (since this depends very much here's a simple one):
shape main {
Rectangle(0, 0, 100, 100);
println("#name#");
println("#language#");
}
Save the edit and close the dialog. Once you assign the stereotype to an element it will render like this:
I know this is not pretty and you need to dig into shape scripts to make it useful, but that can't be avoided.
So the difficult, but better and preferred, way is to create your own profile containing the stereotype along with the shape script. The above would just be a way of testing it but finally you would need to create your profile and put it in a MDG. Since this is a quite complex task it won't go here into this answer (no, I'm not Fermat, but you need quite some effort to get that far).
There is no standardized way to show the programming language of a component in UML. There are several ways you can do it, for example:
Stereotype. This will not prevent you from adding other stereotypes in the future. Multiple stereotypes are shown comma separated: «stereotype1, stereotype2»
Generalization. You can define a component called 'JavaComponent' and let all Java components inherit from this base component.
Note. You can attach a note to the component specifying the language.
I have been following the steps outlined here: https://dev.liferay.com/develop/tutorials/-/knowledge_base/6-2/importing-resources-with-your-themes
My custom structures and templates are being imported. The problem that I have is that I also want to define an ADT to be imported. Nothing happens when I create the directory structure outline here:https://dev.liferay.com/develop/tutorials/-/knowledge_base/6-2/creating-plugins-to-share-structures-templates-and-more
Is the "templates-importer" standard deprecated? Can the "resources-importer" and "templates-importer" not be used at the same time?
I don't see any exceptions in the log and there's nothing to indicate why the ADT is not being imported. I have checked in the site template that is generated and in the global site.
Suggestions? Do I really need to create a hook to import the ADT?
You can use only one of those two, but they share common code and functionality (here are if...else statements responsible for chosing one of). If you use Resources Importer already, you can add your ADT's to resources-importer folder (in the same way it is done within templates-importer) and it will be imported as well.
I have a hook project which resources-importer which contains (among others) 4 ADTs. They are located in the following folders:
resources-importer/templates/application_display/asset_category
resources-importer/templates/application_display/asset_entry
First one is imported as ADT for Categories Navigation portlet and second for Asset Publisher portlet.
I imported my Java code in Enterprise Architect with the code engineering tool. If I add a class in the class diagram editor (UML) it automatically adds the associations and the generalizations but not the dependencies. Is it possible to setup EA that it also includes the existing dependencies from source code (local variables, parameters etc)?
There is one option you can set which controls this in EA 10: look at Tools -- Options -- Source Code Engineering. The last of the list of check boxes is called "Create dependencies for operation returns and parameter types."
This solves the problem as far as parameters are concerned (you'd have to reimport the code, of course), but I haven't tested it to see how it deals with local variables. I'm guessing it doesn't create dependencies for those.
I got an .xsd scheme that has multiple root elements, few complex and simple types, complex types refer to those root elements. I can't generate .xml in a way i want from it because of those root elements. So i think i need to add element that will serve as the root element, and add all other elements as its children, or am i wrong?
Is there a tool that can help me create root element and refactor scheme? What i got:
I was thinking maybe i just need to create another xsd with 1 element and ref all elements form first xsd in it, but i don't exactly know how to do it. Is this a good idea?
The answer to your edit is indeed, as Pangea said, NO. And that is because to ref another element (as in <xsd:element ref="SomeElement" ... />), the referenced element must be declared globally.
Other scenario that requires global elements is the use of substitution groups. What I am trying to suggest is that it may not always be possible to refactor an XSD in a way that leaves global only the elements you want as root in instance XML.
Which should make you think that to solve your problem, a better way might be to go after the reason why you can't generate .xml the way you want. If you can describe a bit of that, you might get a better answer here...
Another reason I wanted to add this answer was that I noticed the use of XML as a tag name. While it may seem OK, I can tell you that I've seen some pretty "big-name" applications that would simply choke with that <XML/> tag name. XML is actually "reserved", please take a look at this section of the XML Spec. To quote: "Names beginning with the string "xml", or with any string which would match (('X'|'x') ('M'|'m') ('L'|'l')), are reserved for standardization in this or future versions of this specification."
Always play nice with the specs....
Any global element you define in the schema is a potential root element in the the instance document. If you doesn't want this behavior then make sure you have only one global element definition in the xsd. It has nothing to do with the tool (though xml editors can simplify this).
I'm Using Papyrus UML and I have to use in my diagram, a class which is defined in another .uml file. HowI can do it?
Thank you
You need to create a shortcut but for me this is not usable because I prefer to mix usecase and class diagram elements inside the same model and sometimes even the same diagram.
You can do it with RSA IBM or Omondo EclipseUML.
I do not know particularly about Papyrus, but in UML in general, you should have a Model-element at the top-level, and in there, you create a PackageImport. Now you should be able to set the ``Imported Package'' reference---but the other UML must be loaded from the workspace first:
This is where things become interesting! in the plain Eclipse UML editor, you have to load the resource first using the 'UML Editor' menu or the ``Additional Resources'' sub-tree in the model-outline. I guess Papyrus offers at least the same way through the outline.