Usecase :
How to store user specific defaults into MDS ?
How to retrieve user specific defaults from MDS ?
How to delete user specific defaults from MDS ?
Implementation :
Below blog clearly explains about MDS and installation steps
http://fortunefusionminds.blogspot.com/2013/04/how-to-apply-mds-to-adf-application.html
I will give a quick glance at API to access MDS data in this blog.
How to store user specific defaults into MDS ?
Ans : Below implementation stores the data into MDS in file system or Database.
public static void saveSearchDefaults(String pSearchName,
ViewObject pViewObject,
ViewRowImpl pViewRow) {
ViewCriteria vc = pViewObject.createViewCriteria();
vc.setName(pSearchName);
ViewCriteriaRow vcRow = vc.createViewCriteriaRow();
String[] attNames = pViewRow.getAttributeNames();
for (String s : attNames) {
Object viewRowAttributeValue = pViewRow.getAttribute(s);
vcRow.setAttribute(s, viewRowAttributeValue);
}
vc.add(vcRow);
pViewObject.getViewCriteriaManager().putViewCriteria(pSearchName, vc);
JUSearchBindingCustomizer.createPersonalization(pViewObject, vc);
}
How to retrieve user specific defaults from MDS ?
Answer :
/**
* Retrieves all the saved search names from MDS for a given
* Viewobject based on logged in user ID
* @param pViewObject
* @return
*/
public static String[] getAllSavedSearchNames(ViewObject pViewObject) {
String[] result =
pViewObject.getViewCriteriaManager().getAllViewCriteriaNames();
return result;
}
How to apply User specific defaults to a given Row from MDS ?
Ans:
/** Get the user specific default row from MDS based on
* logged in user ID, Provided view object name and search name
* Set the rows retrieved from MDS defaults row to provided row Impl class
* Applies search preferences for saved search.
* @param pSearchName
* @param pViewObject
* @param pViewRow
*/
public static void applyUserSpecificDefaults(String pSearchName,
ViewObject pViewObject,
ViewRowImpl pViewRow) {
ViewCriteria vc =
pViewObject.getViewCriteriaManager().getViewCriteria(pSearchName);
ViewCriteriaRow vcRow = (ViewCriteriaRow)vc.get(0);
String[] attNames = vcRow.getAttributeNames();
StringBuffer buf = null;
for (String s : attNames) {
Object vcRowAttributeValue = vcRow.getAttribute(s);
if (vcRowAttributeValue != null) {
pViewRow.setAttribute(s, vcRowAttributeValue);
}
}
}
How to Delete User Specific defaults from MDS
Ans:
/**
* Deletes the saved search defaults from MDS based on
* logged in user, search Name and given VIew Object
* @param pSearchName
* @param pViewObject
*/
public static void deleteUserSpecificDefaultsFromMDS(String pSearchName,
ViewObject pViewObject)
{
JUSearchBindingCustomizer.deletePersonalization(pViewObject,
pSearchName);
pViewObject.getViewCriteriaManager().removeViewCriteria(pSearchName);
}
How to store user specific defaults into MDS ?
How to retrieve user specific defaults from MDS ?
How to delete user specific defaults from MDS ?
Implementation :
Below blog clearly explains about MDS and installation steps
http://fortunefusionminds.blogspot.com/2013/04/how-to-apply-mds-to-adf-application.html
I will give a quick glance at API to access MDS data in this blog.
How to store user specific defaults into MDS ?
Ans : Below implementation stores the data into MDS in file system or Database.
public static void saveSearchDefaults(String pSearchName,
ViewObject pViewObject,
ViewRowImpl pViewRow) {
ViewCriteria vc = pViewObject.createViewCriteria();
vc.setName(pSearchName);
ViewCriteriaRow vcRow = vc.createViewCriteriaRow();
String[] attNames = pViewRow.getAttributeNames();
for (String s : attNames) {
Object viewRowAttributeValue = pViewRow.getAttribute(s);
vcRow.setAttribute(s, viewRowAttributeValue);
}
vc.add(vcRow);
pViewObject.getViewCriteriaManager().putViewCriteria(pSearchName, vc);
JUSearchBindingCustomizer.createPersonalization(pViewObject, vc);
}
How to retrieve user specific defaults from MDS ?
Answer :
/**
* Retrieves all the saved search names from MDS for a given
* Viewobject based on logged in user ID
* @param pViewObject
* @return
*/
public static String[] getAllSavedSearchNames(ViewObject pViewObject) {
String[] result =
pViewObject.getViewCriteriaManager().getAllViewCriteriaNames();
return result;
}
How to apply User specific defaults to a given Row from MDS ?
Ans:
/** Get the user specific default row from MDS based on
* logged in user ID, Provided view object name and search name
* Set the rows retrieved from MDS defaults row to provided row Impl class
* Applies search preferences for saved search.
* @param pSearchName
* @param pViewObject
* @param pViewRow
*/
public static void applyUserSpecificDefaults(String pSearchName,
ViewObject pViewObject,
ViewRowImpl pViewRow) {
ViewCriteria vc =
pViewObject.getViewCriteriaManager().getViewCriteria(pSearchName);
ViewCriteriaRow vcRow = (ViewCriteriaRow)vc.get(0);
String[] attNames = vcRow.getAttributeNames();
StringBuffer buf = null;
for (String s : attNames) {
Object vcRowAttributeValue = vcRow.getAttribute(s);
if (vcRowAttributeValue != null) {
pViewRow.setAttribute(s, vcRowAttributeValue);
}
}
}
How to Delete User Specific defaults from MDS
Ans:
/**
* Deletes the saved search defaults from MDS based on
* logged in user, search Name and given VIew Object
* @param pSearchName
* @param pViewObject
*/
public static void deleteUserSpecificDefaultsFromMDS(String pSearchName,
ViewObject pViewObject)
{
JUSearchBindingCustomizer.deletePersonalization(pViewObject,
pSearchName);
pViewObject.getViewCriteriaManager().removeViewCriteria(pSearchName);
}
No comments:
Post a Comment