Is it possible to group participants in PlantUML? - plantuml

I want to have a box around a couple of participants showing that they are part of an entity. How can you do this in PlantUML?

You can "box" participants as shown on plantuml site (extract below)
#startuml
box "Internal Service" #LightBlue
participant Bob
participant Alice
end box
participant Other
Bob -> Alice : hello
Alice -> Other : hello
#enduml
This produces:

Related

In PlantUML, how do I specify role names at either end of an association between two classes?

How do I specify role names 'employer' and 'employee' at either end of the association 'employs' between the classes 'Person' and 'Company'? That is, of course, different from the name of the association:
#startuml
hide circle
class Person {
}
class Company {
}
Person "+employee 0..*" <-- "+employer 0..1" Company : employs
note on link: [[https://en.wiktionary.org/wiki/employ employs]] is the name of the association
#enduml
see also wiki.bitplan.com
try it out at
http://diagrams.bitplan.com
see rendered png image
see rendered svg image

user merge fields doesn't replace by user record ID

I am trying to send email through email template to user but It is always replacing the user merge fields by org admin's user name instead of targetobjectID user.
Org admin : luke wright
Email template Body :
Dear {!User.Name} ,
Hearty Congratulations on this beautiful occasion. May your marriage bring great joy, love and passion in your life. I wish to God to bless you with a wonderful marriage and a happy life ahead.
Thanks and Regards.
{!Organization.Name}
OrgWideEmailAddress owa = [select id, DisplayName, Address from OrgWideEmailAddress limit 1];
List<Messaging.SingleEmailMessage> allmsg = new List<Messaging.SingleEmailMessage>();
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setTemplateID('00X0S000000iBYB'); // Template Id
mail.setSaveAsActivity(false);
mail.setTargetObjectId('0050S0000023KS9'); // UserId Name: John Doe
mail.setOrgWideEmailAddressId(owa.id);
allmsg.add(mail);
Messaging.sendEmail(allmsg,false);
Issue: Dear {!User.Name} should be replace by john doe while it is replacing by luke wright and email goes to correct user i.e. john doe
P.S. User's merge fields is not replacing by that record ID
User error? ;)
User is for current running user. Looks like you want Receiving_User.
If you have Communities enabled you probably have this built-in email template. And even if not - check the top of the screenshot.
And if your email template is Visualforce rather than normal - probably you should be using {!relatedTo}.

Grouping with Filter Query Solr

I had document in solr as mentioned below
Document 1
{
"event_name":"product viewed",
"event_property":["category","product_name","product_code","price","brand","color","discount","is_new_visitor"],
"event_value":["category-sunglasses","product_name-david blake grey sunglasses","product_code-lcsgdb364x1880gryx""price-590","brand-david blake","color-grey","discount-70"],
"session_id":"mf1545212054754888840",
"company_id":"31",
"created":1545212153,
"email":"zzzz#gmail.com",
"name":"zzzz"
}
Document 2
{
"event_name":"add to cart",
"event_property":["category","product_name","product_code","price","brand","color","discount","is_new_visitor"],
"event_value":["category-sunglasses","product_name-david blake grey sunglasses","product_code-lcsgdb364x1880gryx""price-590","brand-david blake","color-grey","discount-70"],
"session_id":"mf1545212054754888840",
"company_id":"31",
"created":1545212153,
"email":"zzzz#gmail.com",
"name":"zzzzz"
}
Document 3
{
"event_name":"product viewed",
"event_property":["category","product_name","product_code","price","brand","color","discount","is_new_visitor"],
"event_value":["category-sunglasses","product_name-david blake grey sunglasses","product_code-lcsgdb364x1880gryx""price-590","brand-david blake","color-grey","discount-70"],
"session_id":"mf1545212054754888841",
"company_id":"31",
"created":1545212153,
"email":"yyyy#gmail.com",
"name":"xxxxxx"
}
document have email and activity perform by user in event key.now i need to make request to group email to find unique email using filter query.i have used the query mentioned below
http://solr-url/solr/solr-core/select?q=*:*&fq=((event_name:"product+viewed"
+AND+event_property:"product_name"+AND+event_value:"category-sunglasses")+AND+(event_name:"add+to+cart"+AND+event_property:"product_name"+AND+event_value:"category-sunglasses"))&group.limit=1&group.ngroups=true&group=true&group.field=email
In response i am not getting the email e.g user who as performed both event e.g "product viewed" and "add to cart".
Just check your query, the filter query should AND, should be OR.
fq=((event_name:"product+viewed"
+AND+event_property:"product_name"+AND+event_value:"category-sunglasses")+OR+(event_name:"add+to+cart"+AND+event_property:"product_name"+AND+event_value:"category-sunglasses"))

Angular Display Data

I have a form with a dropdown element. The value of the options in the select are IDs from another table. When I click save/add, I save the data to the server, and I add the data to a dynamic table under the form.
In the table I want to display the corresponding name, as in the dropdown element, but I only have the ID which was saved. What is the best method or common practices to display the name?
Example:
Dropdown:
1: Jackson Middle School
2: St Thomas High School
3: Jackson High School
Display table using ng-repeat:
{{school}} *Displays 1,2,3 not 'Jackson Middle School'
Assuming you send a GET request with the following result:
[
{
"Id":1,
"Name":"Jackson Middle School"
},
{
"Id":2,
"Name":"St Thomas High School"
},
{
"Id":3,
"Name":"Jackson High School"
}
]
and you assign this to $scope.Schools, you should be able to use it like this:
<li ng-repeat="school in Schools">{{ school.Name }}</li>
I just created an array "school_names = [1: Jackson Middle School, 2: St Thomas High School, 3: Jackson High School]" and in the table i just did an array look up {{school_names[school]]}}

How to scan the database and match models based on certain attributes? (django)

I have a model
class dog(models.Model):
name = models.CharField(max_length=30, blank=True)
type = models.CharField(max_length=30, blank=True)
sex = models.CharField(max_length=30, blank=True)
and a views
def dog_matching(request):
# Create the new dog, starting with data from the previous HTML page
name = request.session['name']
# Fill in the rest of the information on the current HTML page
if request.method == 'GET':
type = request.GET['type']
sex = request.GET['sex']
# Create an instance of the dog
dog_inst = dog(name=name, type=type, sex=sex)
# Save the instance to database
dog_inst.save()
# Perform matching and send email
When a new dog gets created and saved, I want to find each previous dog in the database where the 'type' matches, and the 'sex' differs. Then for each match, I want to get notified via email that a submission on the website resulted in a match (i.e., an email that says, for example, "Scruffles and JayJay match!".)
How do I perform the matching operation, so that each email I receive corresponds to each match?
I am trying something like this
if dog_inst.sex = 'male':
for dog.objects.get(sex__iexact="female"):
test = dog.objects.get(sex__iexact="female")
if test.type = dog_inst.type:
#Send email (I can find documentation for this)
if dog_inst.sex = 'female':
for dog.objects.get(sex__iexact="male"):
test = dog.objects.get(sex__iexact="male")
if test.type = dog_inst.type:
#Send email (I can find documentation for this)
Any ideas?
In Django, you would normally call your model Dog. Then you can use dog to refer to a dog instance. I have done that in my answer.
The main problem is that you are using get() when you should be using filter(). I think you'd find it really useful to have a read of the Django Making queries guide.
In short, you use get() when you want to fetch a particular object.
dog = Dog.objects.get(pk=5) # gets the dog with primary key 5
After you have saved a new female dog to the database, you want to find all male dogs of the same type as new_dog. Here we use filter().
We can filter on sex and type instead of checking the type of each dog in the loop.
if new_dog.sex == 'female': # new_dog is the dog you have just created
dogs = Dog.objects.filter(sex__iexact="male", type=new_dog.type)
for dog in dogs:
# send email

Resources