Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright 2005-2013 The Kuali Foundation Licensed under the Educational Community License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 package org.kuali.rice.ken.service.impl;
 import java.util.Map;
 //import org.kuali.rice.core.jpa.criteria.Criteria;

NotificationContentTypeService implementation - uses the businessObjectDao to get at the underlying data in the stock DBMS.

Kuali Rice Team (
     private GenericDao businessObjectDao;

Constructs a

     public NotificationContentTypeServiceImpl(GenericDao businessObjectDao) {
         this. = businessObjectDao;

     //this is the one need to tweek on criteria
 //        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<StringObjectc = new HashMap<StringObject>();
     	c.put("current"new Boolean(true));
         if (coll.size() == 0) {
             return null;
         } else {
             return coll.iterator().next();
     protected int findHighestContentTypeVersion(String name) {
         // there's probably a better way...'report'? or direct SQL
         Map<StringObjectfields = new HashMap<StringObject>(2);
         Collection<NotificationContentTypeBotypes = .findMatchingOrderBy(NotificationContentTypeBo.classfields"version"false);
         if (types.size() > 0) {
             return types.iterator().next().getVersion();
         return -1;

     public void saveNotificationContentType(NotificationContentTypeBo contentType) {
         NotificationContentTypeBo previous = getNotificationContentType(contentType.getName());
         if (previous != null) {
         int lastVersion = findHighestContentTypeVersion(contentType.getName());
         NotificationContentTypeBo next;
         if (contentType.getId() == null) {
             next = contentType
         } else {
             next = new NotificationContentTypeBo();
        next.setVersion(lastVersion + 1);
        // update all the old references
        if (previous != null) {
            Collection<NotificationBons = getNotificationsOfContentType(previous);
            for (NotificationBo nns) {
        Map<StringObjectfields = new HashMap<StringObject>(1);
        return .findMatching(NotificationBo.classfields);
//        Criteria c = new Criteria();
//        c.addEqualTo("current", true);
////    	Criteria c = new Criteria(NotificationContentType.class.getName());
////    	c.eq("current", true);
    	Map<StringBooleanc = new HashMap<StringBoolean>();
    	c.put("current"new Boolean(true));
        return .findMatching(NotificationContentTypeBo.classc);
New to GrepCode? Check out our FAQ X