本文整理汇总了Java中org.kuali.rice.ken.bo.NotificationContentTypeBo类的典型用法代码示例。如果您正苦于以下问题:Java NotificationContentTypeBo类的具体用法?Java NotificationContentTypeBo怎么用?Java NotificationContentTypeBo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NotificationContentTypeBo类属于org.kuali.rice.ken.bo包,在下文中一共展示了NotificationContentTypeBo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createNotification
import org.kuali.rice.ken.bo.NotificationContentTypeBo; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* Overrides to set the content type to "simple".
*/
@Override
protected NotificationBo createNotification(HttpServletRequest request, Map<String, Object> model,
ErrorList errors) throws ErrorList {
NotificationBo notification = super.createNotification(request, model, errors);
String message = getParameter(request, "message", model, errors, "You must fill in a message.");
// stop processing if there are errors
if (!errors.getErrors().isEmpty()) {
throw errors;
}
NotificationContentTypeBo contentType = Util.retrieveFieldReference("contentType", "name",
NotificationConstants.CONTENT_TYPES.SIMPLE_CONTENT_TYPE, NotificationContentTypeBo.class,
dataObjectService, Boolean.TRUE);
notification.setContentType(contentType);
notification.setContent(NotificationConstants.XML_MESSAGE_CONSTANTS.CONTENT_SIMPLE_OPEN
+ NotificationConstants.XML_MESSAGE_CONSTANTS.MESSAGE_OPEN
+ message
+ NotificationConstants.XML_MESSAGE_CONSTANTS.MESSAGE_CLOSE
+ NotificationConstants.XML_MESSAGE_CONSTANTS.CONTENT_CLOSE);
return notification;
}
示例2: getNotificationContentType
import org.kuali.rice.ken.bo.NotificationContentTypeBo; //导入依赖的package包/类
/**
* @see org.kuali.rice.ken.service.NotificationContentTypeService#getNotificationContentType(java.lang.String)
*/
//this is the one need to tweek on criteria
@Override
public NotificationContentTypeBo getNotificationContentType(String name) {
if (StringUtils.isBlank(name)) {
throw new RiceIllegalArgumentException("name is blank");
}
QueryByCriteria.Builder criteria = QueryByCriteria.Builder.create();
criteria.setPredicates(equal("name", name), equal("current", new Boolean(true)));
List<NotificationContentTypeBo> coll= dataObjectService.findMatching(NotificationContentTypeBo.class, criteria.build()).getResults();
if (coll.isEmpty()) {
return null;
} else {
return coll.get(0);
}
}
示例3: findHighestContentTypeVersion
import org.kuali.rice.ken.bo.NotificationContentTypeBo; //导入依赖的package包/类
/**
* Returns the highest version found for the given name or negative one if the name is not found.
* @param name the name to query for
* @return the highest version number found or negative one if the name is not found.
*/
protected int findHighestContentTypeVersion(String name) {
int highestVersion = -1;
QueryByCriteria.Builder criteria = QueryByCriteria.Builder.create();
criteria.setPredicates(equal("name", name));
List<NotificationContentTypeBo> ntfyCntTypes = dataObjectService.findMatching(NotificationContentTypeBo.class, criteria.build()).getResults();
for (NotificationContentTypeBo ntfyCntType : ntfyCntTypes) {
if (ntfyCntType.getVersion() > highestVersion) {
highestVersion = ntfyCntType.getVersion();
}
}
return highestVersion;
}
示例4: buildTestNotification
import org.kuali.rice.ken.bo.NotificationContentTypeBo; //导入依赖的package包/类
/**
* This method is a helper to build a Notification instance.
* @param recipientId
* @param recipientType
* @return Notification
*/
public static final NotificationBo buildTestNotification(String deliveryType, Timestamp sendDateTime, Timestamp autoRemoveDateTime, NotificationContentTypeBo contentType,
String content, NotificationPriorityBo priority, NotificationProducerBo producer, NotificationChannelBo channel, List<NotificationRecipientBo> recipients,
List<NotificationSenderBo> senders) {
NotificationBo notification = new NotificationBo();
notification.setCreationDateTimeValue(new Timestamp(System.currentTimeMillis()));
notification.setDeliveryType(deliveryType);
notification.setSendDateTimeValue(sendDateTime);
notification.setAutoRemoveDateTimeValue(autoRemoveDateTime);
notification.setContentType(contentType);
notification.setContent(content);
notification.setPriority(priority);
notification.setProducer(producer);
notification.setChannel(channel);
notification.setRecipients(recipients);
notification.setSenders(senders);
return notification;
}
示例5: getNotificationContentType
import org.kuali.rice.ken.bo.NotificationContentTypeBo; //导入依赖的package包/类
/**
* @see org.kuali.rice.ken.service.NotificationContentTypeService#getNotificationContentType(java.lang.String)
*/
//this is the one need to tweek on criteria
public NotificationContentTypeBo getNotificationContentType(String name) {
// Criteria c = new Criteria();
// c.addEqualTo("name", name);
// c.addEqualTo("current", true);
// Criteria c = new Criteria(NotificationContentType.class.getName());
// c.eq("name", name);
// c.eq("current", true);
Map<String, Object> c = new HashMap<String, Object>();
c.put("name", name);
c.put("current", new Boolean(true));
Collection<NotificationContentTypeBo> coll = businessObjectDao.findMatching(NotificationContentTypeBo.class, c);
if (coll.size() == 0) {
return null;
} else {
return coll.iterator().next();
}
}
示例6: displayContentTypes
import org.kuali.rice.ken.bo.NotificationContentTypeBo; //导入依赖的package包/类
/**
* display ContentTypes
* @param request : a servlet request
* @param response : a servlet response
* @throws ServletException : an exception
* @throws IOException : an exception
* @return a ModelAndView object
*/
public ModelAndView displayContentTypes(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
view = "ContentTypeManager";
Collection<NotificationContentTypeBo> contentTypes = this.notificationContentTypeService.getAllCurrentContentTypes();
Map<String, Object> model = new HashMap<String, Object>();
model.put("contentTypes", contentTypes);
return new ModelAndView(view, model);
}
示例7: addContentType
import org.kuali.rice.ken.bo.NotificationContentTypeBo; //导入依赖的package包/类
/**
* addContentType
* @param request : a servlet request
* @param response : a servlet response
* @throws ServletException : an exception
* @throws IOException : an exception
* @return a ModelAndView object
*/
public ModelAndView addContentType(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
view = "ContentTypeManager";
String id = request.getParameter("id");
String name = request.getParameter("name");
String description = request.getParameter("description");
String namespace = request.getParameter("namespace");
String xsd = request.getParameter("xsd");
String xsl = request.getParameter("xsl");
LOG.debug("id: "+id);
LOG.debug("name: "+name);
LOG.debug("description: "+description);
LOG.debug("namespace: "+namespace);
LOG.debug("xsd: "+xsd);
LOG.debug("xsl: "+xsl);
NotificationContentTypeBo notificationContentType = new NotificationContentTypeBo();
notificationContentType.setName(name);
notificationContentType.setDescription(description);
notificationContentType.setNamespace(namespace);
notificationContentType.setXsd(xsd);
notificationContentType.setXsl(xsl);
notificationContentTypeService.saveNotificationContentType(notificationContentType);
Collection<NotificationContentTypeBo> contentTypes = this.notificationContentTypeService.getAllCurrentContentTypes();
Map<String, Object> model = new HashMap<String, Object>();
model.put("contentTypes", contentTypes);
return new ModelAndView(view, model);
}
示例8: updateContentType
import org.kuali.rice.ken.bo.NotificationContentTypeBo; //导入依赖的package包/类
/**
* updateContentType
* @param request : a servlet request
* @param response : a servlet response
* @throws ServletException : an exception
* @throws IOException : an exception
* @return a ModelAndView object
*/
public ModelAndView updateContentType(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
view = "ContentTypeManager";
String id = request.getParameter("id");
String name = request.getParameter("name");
String description = request.getParameter("description");
String namespace = request.getParameter("namespace");
String xsd = request.getParameter("xsd");
String xsl = request.getParameter("xsl");
LOG.debug("id: "+id);
LOG.debug("name: "+name);
LOG.debug("description: "+description);
LOG.debug("namespace: "+namespace);
LOG.debug("xsd: "+xsd);
LOG.debug("xsl: "+xsl);
NotificationContentTypeBo notificationContentType = this.notificationContentTypeService.getNotificationContentType(name);
notificationContentType.setName(name);
notificationContentType.setDescription(description);
notificationContentType.setNamespace(namespace);
notificationContentType.setXsd(xsd);
notificationContentType.setXsl(xsl);
this.notificationContentTypeService.saveNotificationContentType(notificationContentType);
// get updated content type collection
Collection<NotificationContentTypeBo> contentTypes = this.notificationContentTypeService.getAllCurrentContentTypes();
Map<String, Object> model = new HashMap<String, Object>();
model.put("contentTypes", contentTypes);
return new ModelAndView(view, model);
}
示例9: generateNotificationMessage
import org.kuali.rice.ken.bo.NotificationContentTypeBo; //导入依赖的package包/类
/**
* This method will marshall out the Notification object as a String of XML, using XStream and replaces the
* full recipient list with just a single recipient.
* @see org.kuali.rice.ken.service.NotificationMessageContentService#generateNotificationMessage(org.kuali.rice.ken.bo.NotificationBo, java.lang.String)
*/
public String generateNotificationMessage(NotificationBo notification, String userRecipientId) {
// create a new fresh instance so we don't screw up any references
NotificationBo clone = Util.cloneNotificationWithoutObjectReferences(notification);
/* TODO: modify clone recipient list so that:
1. only the specified user is listed as a recipient (no other users or groups)
2. if the specified user was resolved from a group, make sure to include
that group in the list so it can be searched against for this
particular per-user notification
Group1 --> testuser1 --> "Group1 testuser1"
--> testuser2 --> "Group1 testuser2"
*/
// inject only the single specified recipient
if(StringUtils.isNotBlank(userRecipientId)) {
clone.getRecipients().clear();
NotificationRecipientBo recipient = new NotificationRecipientBo();
recipient.setRecipientId(userRecipientId);
recipient.setRecipientType(KimGroupMemberTypes.PRINCIPAL_MEMBER_TYPE.getCode());
clone.getRecipients().add(recipient);
}
// now marshall out to XML
XStream xstream = new XStream(new DomDriver());
xstream.alias("notification", NotificationBo.class);
xstream.alias("channel", NotificationChannelBo.class);
xstream.alias("contentType", NotificationContentTypeBo.class);
xstream.alias("title", String.class);
xstream.alias("priority", NotificationPriorityBo.class);
xstream.alias("producer", NotificationProducerBo.class);
xstream.alias("recipient", NotificationRecipientBo.class);
xstream.alias("sender", NotificationSenderBo.class);
String xml = xstream.toXML(clone);
return xml;
}
示例10: getAllCurrentContentTypes
import org.kuali.rice.ken.bo.NotificationContentTypeBo; //导入依赖的package包/类
/**
* @see org.kuali.rice.ken.service.NotificationContentTypeService#getAllCurrentContentTypes()
*/
@Override
public Collection<NotificationContentTypeBo> getAllCurrentContentTypes() {
QueryByCriteria.Builder criteria = QueryByCriteria.Builder.create();
criteria.setPredicates(equal("current", new Boolean(true)));
return dataObjectService.findMatching(NotificationContentTypeBo.class, criteria.build()).getResults();
}
示例11: getAllContentTypes
import org.kuali.rice.ken.bo.NotificationContentTypeBo; //导入依赖的package包/类
/**
* @see org.kuali.rice.ken.service.NotificationContentTypeService#getAllContentTypes()
*/
@Override
public Collection<NotificationContentTypeBo> getAllContentTypes() {
QueryByCriteria.Builder criteria = QueryByCriteria.Builder.create();
criteria.setPredicates(greaterThanOrEqual("version", 0));
return dataObjectService.findMatching(NotificationContentTypeBo.class, criteria.build()).getResults();
}
示例12: resolveResource
import org.kuali.rice.ken.bo.NotificationContentTypeBo; //导入依赖的package包/类
/**
* @see org.w3c.dom.ls.LSResourceResolver#resolveResource(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) {
if (!type.equals(XMLConstants.W3C_XML_SCHEMA_NS_URI)) {
return null;
}
if (!systemId.startsWith(CONTENT_TYPE_PREFIX)) {
LOG.warn("Cannot resolve non-ContentType resources");
return null;
}
NotificationContentTypeBo notificationContentType = resolveContentType(systemId);
if (notificationContentType == null) {
LOG.error("Unable to resolve system id '" + systemId + "' locally...delegating to default resolution strategy.");
return null;
}
Reader reader = new StringReader(notificationContentType.getXsd());
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
DOMImplementation domImpl = builder.getDOMImplementation();
DOMImplementationLS dils = (DOMImplementationLS) domImpl;
LSInput input = dils.createLSInput();
input.setCharacterStream(reader);
return input;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例13: resolveContentType
import org.kuali.rice.ken.bo.NotificationContentTypeBo; //导入依赖的package包/类
/**
* This method resolves the NotificationContentType by id.
* @param id
* @return
*/
public NotificationContentTypeBo resolveContentType(String id) {
if (!id.startsWith(CONTENT_TYPE_PREFIX)) return null;
String contentType = id.substring(CONTENT_TYPE_PREFIX.length());
NotificationContentTypeBo notificationContentType = notificationContentTypeService.getNotificationContentType(contentType);
if (contentType == null) {
LOG.warn("Content type '" + contentType + "' not found in notification database");
return null;
}
LOG.info("Resolved '" + id + "' to notification content type: " + notificationContentType);
return notificationContentType;
}
示例14: resolveEntity
import org.kuali.rice.ken.bo.NotificationContentTypeBo; //导入依赖的package包/类
/**
* @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String)
*/
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
LOG.debug("Resolving '" + publicId + "' / '" + systemId + "'");
if (!systemId.startsWith(CONTENT_TYPE_PREFIX)) {
LOG.warn("Cannot resolve non-ContentType resources");
return null;
}
NotificationContentTypeBo notificationContentType = resolveContentType(systemId);
if (notificationContentType == null) {
LOG.error("Unable to resolve system id '" + systemId + "' locally...delegating to default resolution strategy.");
return null;
}
LOG.debug("Resolved '" + systemId + "' to " + notificationContentType.getXsd());
return new InputSource(new StringReader(notificationContentType.getXsd()));
}
示例15: testVersioning
import org.kuali.rice.ken.bo.NotificationContentTypeBo; //导入依赖的package包/类
@Test public void testVersioning() {
NotificationContentTypeService impl = services.getNotificationContentTypeService();
int originalCurrentSize = impl.getAllCurrentContentTypes().size();
int originalSize = impl.getAllContentTypes().size();
NotificationBo n = services.getNotificationService().getNotification(TestConstants.NOTIFICATION_1);
NotificationContentTypeBo ct = n.getContentType();
int originalVersion = ct.getVersion();
assertTrue(ct.isCurrent());
ct.setDescription("I was updated");
impl.saveNotificationContentType(ct);
assertEquals(originalCurrentSize, impl.getAllCurrentContentTypes().size());
assertEquals(originalSize + 1, impl.getAllContentTypes().size());
ct = impl.getNotificationContentType(ct.getName());
assertEquals("I was updated", ct.getDescription());
assertTrue(ct.isCurrent());
assertEquals(originalVersion + 1, ct.getVersion().intValue());
n = services.getNotificationService().getNotification(TestConstants.NOTIFICATION_1);
NotificationContentTypeBo nct = n.getContentType();
assertEquals(ct.getId(), nct.getId());
assertEquals(ct.getVersion(), nct.getVersion());
assertEquals(ct.isCurrent(), nct.isCurrent());
assertEquals(originalVersion + 1, nct.getVersion().intValue());
}