本文整理汇总了Java中org.apache.velocity.tools.generic.SortTool类的典型用法代码示例。如果您正苦于以下问题:Java SortTool类的具体用法?Java SortTool怎么用?Java SortTool使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SortTool类属于org.apache.velocity.tools.generic包,在下文中一共展示了SortTool类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: init
import org.apache.velocity.tools.generic.SortTool; //导入依赖的package包/类
/**
* Initializes Velocity engine
*/
private void init() {
velocityEngine.setProperty(VelocityEngine.RESOURCE_LOADER, "class");
velocityEngine.setProperty("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
setLogFile();
DateTool dateTool = new DateTool();
dateTool.configure(this.configMap);
MathTool mathTool = new MathTool();
NumberTool numberTool = new NumberTool();
numberTool.configure(this.configMap);
SortTool sortTool = new SortTool();
defaultContext = new VelocityContext();
defaultContext.put("dateTool", dateTool);
defaultContext.put("dateComparisonTool", new ComparisonDateTool());
defaultContext.put("mathTool", mathTool);
defaultContext.put("numberTool", numberTool);
defaultContext.put("sortTool", sortTool);
// Following tools need VelocityTools version 2.0+
//defaultContext.put("displayTool", new DisplayTool());
//defaultContext.put("xmlTool", new XmlTool());
try {
velocityEngine.init();
} catch (Exception e) {
throw new VelocityException(e);
}
}
开发者ID:kuali,项目名称:kc-rice,代码行数:32,代码来源:VelocityTemplateEngine.java
示例2: sortCmObject
import org.apache.velocity.tools.generic.SortTool; //导入依赖的package包/类
/**
* Custom sort CM collections using properties provided object has getter & setter for
* properties in keys and orders
* defaults to eid & title if none specified
*
* @param collection a collection to be sorted
* @param keys properties to sort on
* @param orders properties on how to sort (asc, dsc)
* @return Collection the sorted collection
*/
private Collection sortCmObject(Collection collection, String[] keys, String[] orders) {
if (collection != null && !collection.isEmpty()) {
// Add them to a list for the SortTool (they must have the form
// "<key:order>" in this implementation)
List propsList = new ArrayList();
if (keys == null || orders == null || keys.length == 0 || orders.length == 0) {
// No keys are specified, so use the default sort order
propsList.add("eid");
propsList.add("title");
} else {
// Populate propsList
for (int i = 0; i < Math.min(keys.length, orders.length); i++) {
String key = keys[i];
String order = orders[i];
propsList.add(key + ":" + order);
}
}
// Sort the collection and return
SortTool sort = new SortTool();
return sort.sort(collection, propsList);
}
return Collections.emptyList();
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:37,代码来源:SiteBrowserAction.java
示例3: CourseOfferingObject
import org.apache.velocity.tools.generic.SortTool; //导入依赖的package包/类
public CourseOfferingObject(CourseOffering offering,
List unsortedSections) {
List propsList = new ArrayList();
propsList.add("category");
propsList.add("eid");
SortTool sort = new SortTool();
this.sections = new ArrayList();
if (unsortedSections != null) {
this.sections = (List) sort.sort(unsortedSections, propsList);
}
this.eid = offering.getEid();
this.title = offering.getTitle();
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:14,代码来源:SiteAction.java
示例4: CSViewModel
import org.apache.velocity.tools.generic.SortTool; //导入依赖的package包/类
/**
* @param viewName the view name
* @param isModal is the view a modal or not
* @param options server options
*/
public CSViewModel(String viewName, boolean isModal, EServerOptions options) {
super(viewName);
this.isSimpleView = false;
this.isModal = isModal;
this.addModel("C2InstanceOptions", options);
String implementationVersion = this.getClass().getPackage().getImplementationVersion();
this.addModel("C2InstanceVersion", implementationVersion != null ? implementationVersion : "DEV-SNAPSHOT");
this.addModel("VIEWNAME", viewName);
this.addModel("dateTool", new DateTool());
this.addModel("sorterTool", new SortTool());
this.addModel("NOW", DateTime.now());
}
开发者ID:cinovo,项目名称:cloudconductor-server,代码行数:19,代码来源:CSViewModel.java
示例5: initializeMessage
import org.apache.velocity.tools.generic.SortTool; //导入依赖的package包/类
/**
* Creates a message object with a set of standard parameters
* @param entityId
* @param userId
* @return The message object with many useful parameters
*/
private MessageDTO initializeMessage(Integer entityId, Integer userId)
throws SessionInternalError {
MessageDTO retValue = new MessageDTO();
try {
UserBL user = new UserBL(userId);
ContactBL contact = new ContactBL();
// this user's info
contact.set(userId);
if (contact.getEntity() != null) {
retValue.addParameter("contact", contact.getEntity());
retValue.addParameter("first_name", contact.getEntity().getFirstName());
retValue.addParameter("last_name", contact.getEntity().getLastName());
retValue.addParameter("address1", contact.getEntity().getAddress1());
retValue.addParameter("address2", contact.getEntity().getAddress2());
retValue.addParameter("city", contact.getEntity().getCity());
retValue.addParameter("organization_name", contact.getEntity().getOrganizationName());
retValue.addParameter("postal_code", contact.getEntity().getPostalCode());
retValue.addParameter("state_province", contact.getEntity().getStateProvince());
}
if (user.getEntity() != null) {
retValue.addParameter("user", user.getEntity());
retValue.addParameter("username", user.getEntity().getUserName());
retValue.addParameter("password", user.getEntity().getPassword());
retValue.addParameter("user_id", user.getEntity().getUserId().toString());
}
if (user.getCreditCard() != null) {
retValue.addParameter("credit_card", user.getCreditCard());
}
// the entity info
contact.setEntity(entityId);
if (contact.getEntity() != null) {
retValue.addParameter("company_contact", contact.getEntity());
retValue.addParameter("company_id", entityId.toString());
retValue.addParameter("company_name", contact.getEntity().getOrganizationName());
}
//velocity tools
retValue.addParameter("tools-date", new DateTool());
retValue.addParameter("tools-math", new MathTool());
retValue.addParameter("tools-number", new NumberTool());
retValue.addParameter("tools-render", new RenderTool());
retValue.addParameter("tools-escape", new EscapeTool());
retValue.addParameter("tools-resource", new ResourceTool());
retValue.addParameter("tools-alternator", new AlternatorTool());
// retValue.addParameter("tools-valueParser", new ValueParser());
retValue.addParameter("tools-list", new ListTool());
retValue.addParameter("tools-sort", new SortTool());
retValue.addParameter("tools-iterator", new IteratorTool());
//Adding a CCF Field to Email Template
if (user.getEntity().getCustomer() != null && user.getEntity().getCustomer().getMetaFields() != null) {
for (MetaFieldValue metaFieldValue : user.getEntity().getCustomer().getMetaFields()) {
retValue.addParameter(metaFieldValue.getField().getName(), metaFieldValue.getValue());
}
}
LOG.debug("Retvalue >>>> "+retValue.toString());
LOG.debug("Retvalue partameters >>>> "+retValue.getParameters());
} catch (Exception e) {
throw new SessionInternalError(e);
}
return retValue;
}
开发者ID:maxdelo77,项目名称:replyit-master-3.2-final,代码行数:78,代码来源:NotificationBL.java
注:本文中的org.apache.velocity.tools.generic.SortTool类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论