Stefan
(Stefan)
March 14, 2017, 6:25am
#1
CUBA has a feature to add entities to favorites. I think it would be a good idea if entities could be opened directly via a deep link in the CUBA app.
E.g. there could be a new standard action “Get Entitiy Link” or “Send Entity Link” to generate a deep link. So these links can be saved in browser favorites or send to others. I think the deep link just needs the classname and id value as parameter.
mario
(Mario David)
March 14, 2017, 8:02am
#2
Hi Stefan,
in fact this feature is already there. I wrote a blog post about a while ago: Deep Links for Resources – Road to CUBA and beyond...
It is just a little bit hidden.
Bye
Mario
2 Likes
tommeacham
(Thomas Meacham)
October 9, 2018, 5:22pm
#3
Great write up mario, but I also like the idea of a standard action in Studio for this.
1 Like
tommeacham
(Thomas Meacham)
October 12, 2018, 3:10am
#4
For some reason I wasn’t able to get this to work exactly as written in the blog.
Likely because:
I wasn’t using groovy
I use Integer Identity rather than UUID for my entities (SQL Server, So I want a clustered primary key)
I was able to get this to work on the screen controller itself however:
package com.company.tts.web.account;
import com.company.tts.entity.Account;
import com.haulmont.cuba.core.global.GlobalConfig;
import com.haulmont.cuba.gui.components.AbstractLookup;
import com.haulmont.cuba.gui.data.Datasource;
import javax.inject.Inject;
public class AccountBrowse extends AbstractLookup {
@Inject
private Datasource<Account> accountsDs;
@Inject
private GlobalConfig globalConfig;
public void showDeepLink() {
Account account = accountsDs.getItem();
String title = "Direct Link to Account: "+accountsDs.getItem().getAccountName();
String webAppUrl = globalConfig.getWebAppUrl();
String className = account.getMetaClass().getName();
String screen = className+".edit";
String item = className+"-"+(accountsDs.getItem().getId());
String deepLink = webAppUrl+"/open?screen="+screen+"&item="+item;
showMessageDialog(title, deepLink, MessageType.CONFIRMATION);
}
}
Your blog definitely pointed me in the right direction. So I wanted to say thanks!
tsarev
(Daniil Tsaryov)
October 12, 2018, 8:32am
#5
We are working on supporting URLs that will represent current app state. It also includes open entitiy editors and enables to copy-paste a link to current entity: URL browser history and navigation #280 .
Regards,
Daniil.
1 Like
gdaylight
(Gdaylight)
May 28, 2020, 12:06pm
#6
Hello,
Can you help?
How can I get a deep link for a screen like MasterDetailScreen?
albudarov
(Alexander Budarov)
May 29, 2020, 7:01am
#7
Hi,
This feature has been implemented as a Routing API.
Take a look at this documentation section : URL History and Navigation - CUBA Platform. Developer’s Manual
1 Like