Java 类com.liferay.portal.kernel.util.UnmodifiableList 实例源码

项目:OEPv2    文件:ApplicationFinderImpl.java   
public List<Application> getDownApplications(Application app, ServiceContext serviceContext) {
    List<Object> params = new ArrayList<Object>();
    Session session = openSession();
    try {
        String sql = CustomSQLUtil.get(ApplicationFinder.class.getName(), GET_DOWN_APPLICATION);        
        sql = sql.replace("[$COMPANY_FILTER$]", " AND companyId = ?");
        params.add(serviceContext.getCompanyId());
        sql = sql.replace("[$GROUP_FILTER$]", "");

        if (app != null) {
            sql = sql.replace("[$SEQUENCENO_FILTER$]", " AND sequenceNo > ?");
            params.add(app.getSequenceNo());            
        }
        else {
            sql = sql.replace("[$SEQUENCENO_FILTER$]", "");
        }

        SQLQuery query = session.createSQLQuery(sql);
        query.addEntity("Application", ApplicationImpl.class);
        if (params != null && params.size() > 0) {
            for (int index = 0; index < params.size(); index++) {
                query.setString(index, String.valueOf(params.get(index)));
            }
        }

        List<Application> list = query.list();
        list = new UnmodifiableList<Application>(list);

        return list;
    }
    finally {
        closeSession(session);
    }
}
项目:OEPv2    文件:ApplicationFinderImpl.java   
public Application getDownApplication(Application app, ServiceContext serviceContext) {
    List<Object> params = new ArrayList<Object>();
    Session session = openSession();
    try {
        String sql = CustomSQLUtil.get(ApplicationFinder.class.getName(), GET_DOWN_APPLICATION);        
        sql = sql.replace("[$COMPANY_FILTER$]", " AND companyId = ?");
        params.add(serviceContext.getCompanyId());
        sql = sql.replace("[$GROUP_FILTER$]", "");

        if (app != null) {
            sql = sql.replace("[$SEQUENCENO_FILTER$]", " AND sequenceNo > ?");
            params.add(app.getSequenceNo());            
        }
        else {
            sql = sql.replace("[$SEQUENCENO_FILTER$]", "");
        }

        SQLQuery query = session.createSQLQuery(sql);
        query.addEntity("Application", ApplicationImpl.class);
        if (params != null && params.size() > 0) {
            for (int index = 0; index < params.size(); index++) {
                query.setString(index, String.valueOf(params.get(index)));
            }
        }

        List<Application> list = query.list();
        list = new UnmodifiableList<Application>(list);

        if (list.size() > 0) {
            return (Application)list.get(0);
        }
        else {
            return null;
        }
    }
    finally {
        closeSession(session);
    }
}
项目:liferaylms-portlet    文件:CalificationTypeRegistry.java   
public CalificationTypeRegistry() {
    _calificationTypes =  _calificationTypeThreadLocal.get();
    if((Validator.isNull(_calificationTypes))||
        (_calificationTypes.isEmpty())||
        (!(_calificationTypes.get(0) instanceof CalificationType))) {
            CalificationType[] calificationTypes = _getCalificationTypes();
        _calificationTypes=new UnmodifiableList<CalificationType>(Arrays.asList(calificationTypes));
        _calificationTypeThreadLocal.set(_calificationTypes);

    }
}
项目:liferaylms-portlet    文件:CourseEvalRegistry.java   
public CourseEvalRegistry() {
    _courseEvals =  _courseEvalThreadLocal.get();
    if((Validator.isNull(_courseEvals))||
        (_courseEvals.isEmpty())||
        (!(_courseEvals.get(0) instanceof CourseEval))) {
            CourseEval[] courseEvals = _getCourseEvals();
        _courseEvals=new UnmodifiableList<CourseEval>(Arrays.asList(courseEvals));
        _courseEvalThreadLocal.set(_courseEvals);

    }
}
项目:liferaylms-portlet    文件:LearningActivityTypeRegistry.java   
public LearningActivityTypeRegistry() {
    _learningActivityTypes =  _learningActivityTypeThreadLocal.get();
    _learningActivityTypesForCreating = _learningActivityTypeForCreatingThreadLocal.get();
    if((Validator.isNull(_learningActivityTypes))||
        (_learningActivityTypes.isEmpty())||
        (!(_learningActivityTypes.get(0) instanceof LearningActivityType))) {
            LearningActivityType[] learningActivityTypes = _getLearningActivityTypes();
            int orderedIdsSize = learningActivityTypes.length; 
            try{
                long[] orderedIds = StringUtil.split(LmsPrefsLocalServiceUtil.getStrictLmsPrefsIni(CompanyThreadLocal.getCompanyId()).getActivities(), 
                                                        StringPool.COMMA, GetterUtil.DEFAULT_LONG);
                orderedIdsSize = orderedIds.length; 
                for (int currentPosition = 0; currentPosition < orderedIds.length; currentPosition++) {
                    for(int currentLearningActivityType=currentPosition+1;currentLearningActivityType<learningActivityTypes.length;currentLearningActivityType++){
                        if(learningActivityTypes[currentLearningActivityType].getTypeId()==orderedIds[currentPosition]){
                            LearningActivityType learningActivityType=learningActivityTypes[currentLearningActivityType];
                            learningActivityTypes[currentLearningActivityType]=learningActivityTypes[currentPosition];
                            learningActivityTypes[currentPosition]=learningActivityType;
                        }
                    }
                }
            } catch(NestableException e){}
        _learningActivityTypes=new UnmodifiableList<LearningActivityType>(Arrays.asList(learningActivityTypes));
        _learningActivityTypeThreadLocal.set(_learningActivityTypes);
        _learningActivityTypesForCreating = new UnmodifiableList<LearningActivityType>(Arrays.asList(Arrays.copyOf(learningActivityTypes, orderedIdsSize)));
        _learningActivityTypeForCreatingThreadLocal.set(_learningActivityTypesForCreating);

    }
}