10-08-2012 03:59 AM
10-08-2012 05:50 AM
10-08-2012 12:24 PM
10-09-2012 11:44 AM
<a:richList viewMode="details" pageSize="5" styleClass="datatable" style="border:thin"
rowStyleClass="recordSetRow" altRowStyleClass="recordSetRowAlt" width="100%"
value="#{TestList.rows}" var="r" initialSortColumn="name" initialSortDescending="true">
<a:column primary="true" width="200">
<f:facet name="header">
<a:sortLink label="Name" value="name" mode="case-insensitive" styleClass="header"/>
</f:facet>
<f:facet name="large-icon">
<%– this could be a clickable action image etc. –%>
<h:graphicImage tooltip="#{r.name}" width="38" height="38" url="/icons/folder_large.png" />
</f:facet>
<a:actionLink value="#{r.name}" actionListener="#{TestList.clickNameLink}">
<f:param name="name" value="#{r.name}" />
</a:actionLink>
</a:column>
<a:column>
<f:facet name="header">
<a:sortLink label="Created Date" value="created" styleClass="header"/>
</f:facet>
<h:outputText value="#{r.created}">
<f:convertDateTime dateStyle="short" />
</h:outputText>
</a:column>
<%– components other than columns added to a RichList will generally
be rendered as part of the list footer –%>
<a:dataPager/>
</a:richList>
10-10-2012 03:27 AM
10-10-2012 07:22 AM
<a:richList id="users-list" viewMode="details" pageSize="10" styleClass="recordSet" headerStyleClass="recordSetHeader" rowStyleClass="recordSetRow" altRowStyleClass="recordSetRowAlt" width="100%" value="#{WizardManager.bean.myUsers}" var="r"
initialSortColumn="userName" initialSortDescending="true">
<%– Primary column with full name –%>
<a:column primary="true" width="50" style="padding:2px;text-align:left">
<f:facet name="header">
<a:sortLink label="#{msg.name}" value="fullName" mode="case-insensitive" styleClass="header" />
</f:facet>
<f:facet name="small-icon">
<h:graphicImage url="/images/icons/person.gif" />
</f:facet>
<a:actionLink value="#{r.fullName}" actionListener="#{WizardManager.bean.clickfullNameLink}">
<f:param name="fullName" value="#{r.fullName}" />
</a:actionLink>
</a:column>
<%– Username column –%>
<a:column width="60" style="text-align:left">
<f:facet name="header">
<a:sortLink label="#{msg.username}" value="userName" styleClass="header" />
</f:facet>
<h:outputText value="#{r.userName}" />
</a:column>
</a:richList>
private List<Node> myUsers = Collections.<Node>emptyList();
// Bean Getters and Setters
public List<Node> getmyUsers()
{
searchmyUsers();
return this.myUsers;
}
………..
………..
/**
* @return the list of users Nodes to display
*/
public String searchmyUsers() {
FacesContext context = FacesContext.getCurrentInstance();
UserTransaction tx = null;
try
{
tx = Repository.getUserTransaction(context, true);
tx.begin();
// get organization of current user
String currentUserName = Repository.getServiceRegistry(context).getAuthenticationService().getCurrentUserName();
MapNode currentUsernode = new MapNode(personService.getPerson(currentUserName));
Map<String, Object> props_currentUser = currentUsernode.getProperties();
String currentUserOrg = props_currentUser.get("organization").toString().trim().toLowerCase();
// get all APPROVER group users
final Set<String> authorities = authorityService.getContainedAuthorities(AuthorityType.USER, GROUP_"+Constants.GROUP_APPROVER,false);
this.myUsers = new ArrayList<Node>(authorities.size());
// authorities contains [username1, username2,….]
for (final String authority : authorities) {
MapNode node = new MapNode(personService.getPerson(authority));
// set data binding properties
Map<String, Object> props = node.getProperties();
// add user only if its organization is the same of the current user
String UserOrg = props.get("organization").toString().trim().toLowerCase();
if (UserOrg.compareTo(currentUserOrg) == 0){
// node ok, same organization: I add it to the list
String firstName = (String)props.get("firstName");
String lastName = (String)props.get("lastName");
props.put("fullName", (firstName != null ? firstName : "") + ' ' + (lastName != null ? lastName : ""));
this.myUsers.add(node);
}
}
// commit the transaction
tx.commit();
}
catch (InvalidNodeRefException refErr)
{
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
context, Repository.ERROR_NODEREF), new Object[] {"root"}) );
this.myUsers = Collections.<Node>emptyList();
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
}
catch (Exception err)
{
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
context, Repository.ERROR_GENERIC), err.getMessage()), err );
this.myUsers = Collections.<Node>emptyList();
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
}
return null;
}
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.